Changeset 159605 in webkit
- Timestamp:
- Nov 20, 2013 9:29:42 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 added
- 1 deleted
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSBase.cpp
r157794 r159605 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 56 56 // evaluate sets "this" to the global object if it is NULL 57 JSGlobalObject* globalObject = exec-> dynamicGlobalObject();57 JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); 58 58 SourceCode source = makeSource(script->string(), sourceURL->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); 59 59 … … 86 86 87 87 JSValue syntaxException; 88 bool isValidSyntax = checkSyntax(exec-> dynamicGlobalObject()->globalExec(), source, &syntaxException);88 bool isValidSyntax = checkSyntax(exec->vmEntryGlobalObject()->globalExec(), source, &syntaxException); 89 89 90 90 if (!isValidSyntax) { -
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r159531 r159605 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 156 156 157 157 VM& vm = exec->vm(); 158 gcProtect(exec-> dynamicGlobalObject());158 gcProtect(exec->vmEntryGlobalObject()); 159 159 vm.ref(); 160 160 return ctx; … … 171 171 savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(vm.identifierTable); 172 172 173 bool protectCountIsZero = Heap::heap(exec-> dynamicGlobalObject())->unprotect(exec->dynamicGlobalObject());173 bool protectCountIsZero = Heap::heap(exec->vmEntryGlobalObject())->unprotect(exec->vmEntryGlobalObject()); 174 174 if (protectCountIsZero) 175 175 vm.heap.reportAbandonedObjectGraph(); -
trunk/Source/JavaScriptCore/CMakeLists.txt
r159394 r159605 423 423 runtime/TypedArrayType.cpp 424 424 runtime/VM.cpp 425 runtime/VMEntryScope.cpp 425 426 runtime/Watchdog.cpp 426 427 runtime/WatchdogNone.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r159593 r159605 1 2013-11-20 Mark Lam <mark.lam@apple.com> 2 3 Introducing VMEntryScope to update the VM stack limit. 4 https://bugs.webkit.org/show_bug.cgi?id=124634. 5 6 Reviewed by Geoffrey Garen. 7 8 1. Introduced USE(SEPARATE_C_AND_JS_STACK) (defined in Platform.h). 9 Currently, it is hardcoded to use separate C and JS stacks. Once we 10 switch to using the C stack for JS frames, we'll need to fix this to 11 only be enabled when ENABLE(LLINT_C_LOOP). 12 13 2. Stack limits are now tracked in the VM. 14 15 Logically, there are 2 stack limits: 16 a. m_stackLimit for the native C stack, and 17 b. m_jsStackLimit for the JS stack. 18 19 If USE(SEPARATE_C_AND_JS_STACK), then the 2 limits are the same 20 value, and are implemented as 2 fields in a union. 21 22 3. The VM native stackLimit is set as follows: 23 a. Initially, the VM sets it to the limit of the stack of the thread that 24 instantiated the VM. This allows the parser and bytecode generator to 25 run before we enter the VM to execute JS code. 26 27 b. Upon entry into the VM to execute JS code (via one of the 28 Interpreter::execute...() functions), we instantiate a VMEntryScope 29 that sets the VM's stackLimit to the limit of the current thread's 30 stack. The VMEntryScope will automatically restore the previous 31 entryScope and stack limit upon destruction. 32 33 If USE(SEPARATE_C_AND_JS_STACK), the JSStack's methods will set the VM's 34 jsStackLimit whenever it grows or shrinks. 35 36 4. The VM now provides a isSafeToRecurse() function that compares the 37 current stack pointer against its native stackLimit. This subsumes and 38 obsoletes the VMStackBounds class. 39 40 5. The VMEntryScope class also subsumes DynamicGlobalObjectScope for 41 tracking the JSGlobalObject that we last entered the VM with. 42 43 6. Renamed dynamicGlobalObject() to vmEntryGlobalObject() since that is 44 the value that the function retrieves. 45 46 7. Changed JIT and LLINT code to do stack checks against the jsStackLimit 47 in the VM class instead of the JSStack. 48 49 * API/JSBase.cpp: 50 (JSEvaluateScript): 51 (JSCheckScriptSyntax): 52 * API/JSContextRef.cpp: 53 (JSGlobalContextRetain): 54 (JSGlobalContextRelease): 55 * CMakeLists.txt: 56 * GNUmakefile.list.am: 57 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 58 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 59 * JavaScriptCore.xcodeproj/project.pbxproj: 60 * bytecompiler/BytecodeGenerator.cpp: 61 (JSC::BytecodeGenerator::BytecodeGenerator): 62 * bytecompiler/BytecodeGenerator.h: 63 (JSC::BytecodeGenerator::emitNode): 64 (JSC::BytecodeGenerator::emitNodeInConditionContext): 65 * debugger/Debugger.cpp: 66 (JSC::Debugger::detach): 67 (JSC::Debugger::recompileAllJSFunctions): 68 (JSC::Debugger::pauseIfNeeded): 69 * debugger/DebuggerCallFrame.cpp: 70 (JSC::DebuggerCallFrame::vmEntryGlobalObject): 71 * debugger/DebuggerCallFrame.h: 72 * dfg/DFGJITCompiler.cpp: 73 (JSC::DFG::JITCompiler::compileFunction): 74 * dfg/DFGOSREntry.cpp: 75 * ftl/FTLLink.cpp: 76 (JSC::FTL::link): 77 * ftl/FTLOSREntry.cpp: 78 * heap/Heap.cpp: 79 (JSC::Heap::lastChanceToFinalize): 80 (JSC::Heap::deleteAllCompiledCode): 81 * interpreter/CachedCall.h: 82 (JSC::CachedCall::CachedCall): 83 * interpreter/CallFrame.cpp: 84 (JSC::CallFrame::vmEntryGlobalObject): 85 * interpreter/CallFrame.h: 86 * interpreter/Interpreter.cpp: 87 (JSC::unwindCallFrame): 88 (JSC::Interpreter::unwind): 89 (JSC::Interpreter::execute): 90 (JSC::Interpreter::executeCall): 91 (JSC::Interpreter::executeConstruct): 92 (JSC::Interpreter::prepareForRepeatCall): 93 (JSC::Interpreter::debug): 94 * interpreter/JSStack.cpp: 95 (JSC::JSStack::JSStack): 96 (JSC::JSStack::growSlowCase): 97 * interpreter/JSStack.h: 98 * interpreter/JSStackInlines.h: 99 (JSC::JSStack::shrink): 100 (JSC::JSStack::grow): 101 - Moved these inlined functions here from JSStack.h. It reduces some 102 #include dependencies of JSSTack.h which had previously resulted 103 in some EWS bots' unhappiness with this patch. 104 (JSC::JSStack::updateStackLimit): 105 * jit/JIT.cpp: 106 (JSC::JIT::privateCompile): 107 * jit/JITCall.cpp: 108 (JSC::JIT::compileLoadVarargs): 109 * jit/JITCall32_64.cpp: 110 (JSC::JIT::compileLoadVarargs): 111 * jit/JITOperations.cpp: 112 * llint/LLIntSlowPaths.cpp: 113 * llint/LowLevelInterpreter.asm: 114 * parser/Parser.cpp: 115 (JSC::::Parser): 116 * parser/Parser.h: 117 (JSC::Parser::canRecurse): 118 * runtime/CommonSlowPaths.h: 119 * runtime/Completion.cpp: 120 (JSC::evaluate): 121 * runtime/FunctionConstructor.cpp: 122 (JSC::constructFunctionSkippingEvalEnabledCheck): 123 * runtime/JSGlobalObject.cpp: 124 * runtime/JSGlobalObject.h: 125 * runtime/StringRecursionChecker.h: 126 (JSC::StringRecursionChecker::performCheck): 127 * runtime/VM.cpp: 128 (JSC::VM::VM): 129 (JSC::VM::releaseExecutableMemory): 130 (JSC::VM::throwException): 131 * runtime/VM.h: 132 (JSC::VM::addressOfJSStackLimit): 133 (JSC::VM::jsStackLimit): 134 (JSC::VM::setJSStackLimit): 135 (JSC::VM::stackLimit): 136 (JSC::VM::setStackLimit): 137 (JSC::VM::isSafeToRecurse): 138 * runtime/VMEntryScope.cpp: Added. 139 (JSC::VMEntryScope::VMEntryScope): 140 (JSC::VMEntryScope::~VMEntryScope): 141 (JSC::VMEntryScope::requiredCapacity): 142 * runtime/VMEntryScope.h: Added. 143 (JSC::VMEntryScope::globalObject): 144 * runtime/VMStackBounds.h: Removed. 145 1 146 2013-11-20 Michael Saboff <msaboff@apple.com> 2 147 -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r159394 r159605 914 914 Source/JavaScriptCore/runtime/VM.cpp \ 915 915 Source/JavaScriptCore/runtime/VM.h \ 916 Source/JavaScriptCore/runtime/VMEntryScope.cpp \ 917 Source/JavaScriptCore/runtime/VMEntryScope.h \ 916 918 Source/JavaScriptCore/runtime/JSFunctionInlines.h \ 917 919 Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h \ … … 1128 1130 Source/JavaScriptCore/runtime/Uint8Array.h \ 1129 1131 Source/JavaScriptCore/runtime/Uint8ClampedArray.h \ 1130 Source/JavaScriptCore/runtime/VMStackBounds.h \1131 1132 Source/JavaScriptCore/runtime/Watchdog.cpp \ 1132 1133 Source/JavaScriptCore/runtime/Watchdog.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r159499 r159605 663 663 <ClCompile Include="..\runtime\TypedArrayType.cpp" /> 664 664 <ClCompile Include="..\runtime\VM.cpp" /> 665 <ClCompile Include="..\runtime\VMEntryScope.cpp" /> 665 666 <ClCompile Include="..\runtime\Watchdog.cpp" /> 666 667 <ClCompile Include="..\runtime\WatchdogNone.cpp" /> … … 1290 1291 <ClInclude Include="..\runtime\Uint8Array.h" /> 1291 1292 <ClInclude Include="..\runtime\VM.h" /> 1293 <ClInclude Include="..\runtime\VMEntryScope.h" /> 1292 1294 <ClInclude Include="..\runtime\Watchdog.h" /> 1293 1295 <ClInclude Include="..\runtime\WeakGCMap.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r159499 r159605 802 802 <Filter>runtime</Filter> 803 803 </ClCompile> 804 <ClCompile Include="..\runtime\VMEntryScope.cpp"> 805 <Filter>runtime</Filter> 806 </ClCompile> 804 807 <ClCompile Include="..\parser\SourceCode.cpp"> 805 808 <Filter>parser</Filter> … … 2417 2420 </ClInclude> 2418 2421 <ClInclude Include="..\runtime\VM.h"> 2422 <Filter>runtime</Filter> 2423 </ClInclude> 2424 <ClInclude Include="..\runtime\VMEntryScope.h"> 2419 2425 <Filter>runtime</Filter> 2420 2426 </ClInclude> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r159520 r159605 1239 1239 FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */; }; 1240 1240 FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1241 FE6617281774E03500495B00 /* VMStackBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6617271774E03500495B00 /* VMStackBounds.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1241 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */; }; 1242 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1242 1243 FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1243 1244 FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2567 2568 FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMInspector.cpp; sourceTree = "<group>"; }; 2568 2569 FE4A331E15BD2E07006F54F3 /* VMInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInspector.h; sourceTree = "<group>"; }; 2569 FE6617271774E03500495B00 /* VMStackBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMStackBounds.h; sourceTree = "<group>"; }; 2570 FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMEntryScope.cpp; sourceTree = "<group>"; }; 2571 FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMEntryScope.h; sourceTree = "<group>"; }; 2570 2572 FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; }; 2571 2573 FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; }; … … 3317 3319 isa = PBXGroup; 3318 3320 children = ( 3321 FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */, 3322 FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */, 3319 3323 BCF605110E203EF800B9A64D /* ArgList.cpp */, 3320 3324 BCF605120E203EF800B9A64D /* ArgList.h */, … … 3663 3667 E18E3A570DF9278C00D90B34 /* VM.cpp */, 3664 3668 E18E3A560DF9278C00D90B34 /* VM.h */, 3665 FE6617271774E03500495B00 /* VMStackBounds.h */,3666 3669 FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */, 3667 3670 FED94F2C171E3E2300BE77A4 /* Watchdog.h */, … … 4178 4181 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */, 4179 4182 65C0285D1717966800351E35 /* ARMv7DOpcode.h in Headers */, 4183 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */, 4180 4184 0F24E54F17EE274900ABB217 /* TempRegisterSet.h in Headers */, 4181 4185 A7BFF3C0179868940002F462 /* DFGFiltrationResult.h in Headers */, … … 4829 4833 BC18C4200E16F5CD00B34460 /* VM.h in Headers */, 4830 4834 FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */, 4831 FE6617281774E03500495B00 /* VMStackBounds.h in Headers */,4832 4835 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */, 4833 4836 0F919D2615853CE3004A4E7D /* Watchpoint.h in Headers */, … … 5567 5570 147F39D7107EC37600427A48 /* JSVariableObject.cpp in Sources */, 5568 5571 86E3C61C167BABEE006D760A /* JSVirtualMachine.mm in Sources */, 5572 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */, 5569 5573 A7CA3AE717DA41AE006538AF /* JSWeakMap.cpp in Sources */, 5570 5574 A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */, -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r158793 r159605 160 160 , m_lastOpcodePosition(0) 161 161 #endif 162 , m_stack(vm, wtfThreadData().stack())163 162 , m_usesExceptions(false) 164 163 , m_expressionTooDeep(false) … … 208 207 , m_lastOpcodePosition(0) 209 208 #endif 210 , m_stack(vm, wtfThreadData().stack())211 209 , m_usesExceptions(false) 212 210 , m_expressionTooDeep(false) … … 422 420 , m_lastOpcodePosition(0) 423 421 #endif 424 , m_stack(vm, wtfThreadData().stack())425 422 , m_usesExceptions(false) 426 423 , m_expressionTooDeep(false) -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r157656 r159605 45 45 #include "StaticPropertyAnalyzer.h" 46 46 #include "UnlinkedCodeBlock.h" 47 #include "VMStackBounds.h"48 47 49 48 #include <functional> … … 234 233 // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary. 235 234 ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount()); 236 if (!m_ stack.isSafeToRecurse()) {235 if (!m_vm->isSafeToRecurse()) { 237 236 emitThrowExpressionTooDeepException(); 238 237 return; … … 250 249 // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary. 251 250 ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount()); 252 if (!m_ stack.isSafeToRecurse())251 if (!m_vm->isSafeToRecurse()) 253 252 return emitThrowExpressionTooDeepException(); 254 253 return n->emitBytecode(*this, dst); … … 262 261 void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, FallThroughMode fallThroughMode) 263 262 { 264 if (!m_ stack.isSafeToRecurse()) {263 if (!m_vm->isSafeToRecurse()) { 265 264 emitThrowExpressionTooDeepException(); 266 265 return; … … 640 639 #endif 641 640 642 VMStackBounds m_stack;643 644 641 bool m_usesExceptions; 645 642 bool m_expressionTooDeep; -
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r159110 r159605 33 33 #include "Parser.h" 34 34 #include "Protect.h" 35 #include "VMEntryScope.h" 35 36 36 37 namespace { … … 173 174 // stack, since we won't get further debugger callbacks to do so. Also, resume execution, 174 175 // since there's no point in staying paused once a window closes. 175 if (m_currentCallFrame && m_currentCallFrame-> dynamicGlobalObject() == globalObject) {176 if (m_currentCallFrame && m_currentCallFrame->vmEntryGlobalObject() == globalObject) { 176 177 m_currentCallFrame = 0; 177 178 m_pauseOnCallFrame = 0; … … 194 195 // If JavaScript is running, it's not safe to recompile, since we'll end 195 196 // up throwing away code that is live on the stack. 196 ASSERT(!vm-> dynamicGlobalObject);197 if (vm-> dynamicGlobalObject)197 ASSERT(!vm->entryScope); 198 if (vm->entryScope) 198 199 return; 199 200 … … 439 440 return; 440 441 441 JSGlobalObject* dynamicGlobalObject = callFrame->dynamicGlobalObject();442 if (!needPauseHandling( dynamicGlobalObject))442 JSGlobalObject* vmEntryGlobalObject = callFrame->vmEntryGlobalObject(); 443 if (!needPauseHandling(vmEntryGlobalObject)) 443 444 return; 444 445 … … 471 472 } 472 473 473 handlePause(m_reasonForPause, dynamicGlobalObject);474 handlePause(m_reasonForPause, vmEntryGlobalObject); 474 475 475 476 if (!m_pauseOnNextStatement && !m_pauseOnCallFrame) { -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r158937 r159605 36 36 #include "Parser.h" 37 37 #include "StackVisitor.h" 38 #include "VMEntryScope.h" 38 39 39 40 namespace JSC { … … 78 79 } 79 80 80 JSC::JSGlobalObject* DebuggerCallFrame:: dynamicGlobalObject() const81 { 82 ASSERT(isValid()); 83 if (!isValid()) 84 return 0; 85 return m_callFrame-> dynamicGlobalObject();81 JSC::JSGlobalObject* DebuggerCallFrame::vmEntryGlobalObject() const 82 { 83 ASSERT(isValid()); 84 if (!isValid()) 85 return 0; 86 return m_callFrame->vmEntryGlobalObject(); 86 87 } 87 88 -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
r158937 r159605 59 59 JS_EXPORT_PRIVATE const TextPosition& position() const { return m_position; } 60 60 61 JS_EXPORT_PRIVATE JSGlobalObject* dynamicGlobalObject() const;61 JS_EXPORT_PRIVATE JSGlobalObject* vmEntryGlobalObject() const; 62 62 JS_EXPORT_PRIVATE JSScope* scope() const; 63 63 JS_EXPORT_PRIVATE String functionName() const; -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r159577 r159605 332 332 Label fromArityCheck(this); 333 333 // Plant a check that sufficient space is available in the JSStack. 334 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=56291335 334 addPtr(TrustedImm32(virtualRegisterForLocal(m_codeBlock->m_numCalleeRegisters).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1); 336 Jump stackCheck = branchPtr(Above, AbsoluteAddress(m_vm-> interpreter->stack().addressOfEnd()), GPRInfo::regT1);335 Jump stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), GPRInfo::regT1); 337 336 // Return here after stack check. 338 337 Label fromStackCheck = label(); -
trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
r156984 r159605 34 34 #include "DFGNode.h" 35 35 #include "JIT.h" 36 #include "JSStackInlines.h" 36 37 #include "Operations.h" 37 38 -
trunk/Source/JavaScriptCore/ftl/FTLLink.cpp
r158315 r159605 85 85 CCallHelpers::Jump stackCheck = jit.branchPtr( 86 86 CCallHelpers::Above, 87 CCallHelpers::AbsoluteAddress(state.graph.m_vm. interpreter->stack().addressOfEnd()),87 CCallHelpers::AbsoluteAddress(state.graph.m_vm.addressOfJSStackLimit()), 88 88 GPRInfo::regT1); 89 89 CCallHelpers::Label fromStackCheck = jit.label(); -
trunk/Source/JavaScriptCore/ftl/FTLOSREntry.cpp
r156511 r159605 31 31 #include "DFGJITCode.h" 32 32 #include "FTLForOSREntryJITCode.h" 33 #include "JSStackInlines.h" 33 34 34 35 #if ENABLE(FTL_JIT) -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r159360 r159605 292 292 void Heap::lastChanceToFinalize() 293 293 { 294 RELEASE_ASSERT(!m_vm-> dynamicGlobalObject);294 RELEASE_ASSERT(!m_vm->entryScope); 295 295 RELEASE_ASSERT(m_operationInProgress == NoOperation); 296 296 … … 690 690 // If JavaScript is running, it's not safe to delete code, since we'll end 691 691 // up deleting code that is live on the stack. 692 if (m_vm-> dynamicGlobalObject)692 if (m_vm->entryScope) 693 693 return; 694 694 -
trunk/Source/JavaScriptCore/interpreter/CachedCall.h
r148696 r159605 28 28 29 29 #include "CallFrameClosure.h" 30 #include "ExceptionHelpers.h" 30 31 #include "JSFunction.h" 31 32 #include "JSGlobalObject.h" 32 33 #include "Interpreter.h" 34 #include "VMEntryScope.h" 33 35 34 36 namespace JSC { … … 39 41 : m_valid(false) 40 42 , m_interpreter(callFrame->interpreter()) 41 , m_ globalObjectScope(callFrame->vm(), function->scope()->globalObject())43 , m_entryScope(callFrame->vm(), function->scope()->globalObject()) 42 44 { 43 45 ASSERT(!function->isHostFunction()); 44 m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope()); 46 if (callFrame->vm().isSafeToRecurse()) 47 m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope()); 48 else 49 throwStackOverflowError(callFrame); 45 50 m_valid = !callFrame->hadException(); 46 51 } … … 70 75 bool m_valid; 71 76 Interpreter* m_interpreter; 72 DynamicGlobalObjectScope m_globalObjectScope;77 VMEntryScope m_entryScope; 73 78 CallFrameClosure m_closure; 74 79 }; -
trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp
r158237 r159605 31 31 #include "Interpreter.h" 32 32 #include "Operations.h" 33 #include "VMEntryScope.h" 33 34 34 35 namespace JSC { … … 123 124 } 124 125 126 JSGlobalObject* CallFrame::vmEntryGlobalObject() 127 { 128 if (this == lexicalGlobalObject()->globalExec()) 129 return lexicalGlobalObject(); 130 131 // For any ExecState that's not a globalExec, the 132 // dynamic global object must be set since code is running 133 ASSERT(vm().entryScope); 134 return vm().entryScope->globalObject(); 135 } 136 125 137 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r158586 r159605 52 52 53 53 // Global object in which execution began. 54 JS GlobalObject* dynamicGlobalObject();54 JS_EXPORT_PRIVATE JSGlobalObject* vmEntryGlobalObject(); 55 55 56 56 // Global object in which the currently executing code was defined. -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r159528 r159605 67 67 #include "StrictEvalActivation.h" 68 68 #include "StrongInlines.h" 69 #include "VM StackBounds.h"69 #include "VMEntryScope.h" 70 70 #include "VirtualRegister.h" 71 71 … … 396 396 JSScope* scope = callFrame->scope(); 397 397 398 if (Debugger* debugger = callFrame-> dynamicGlobalObject()->debugger()) {398 if (Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger()) { 399 399 if (callFrame->callee()) 400 400 debugger->returnEvent(callFrame); … … 651 651 ASSERT(!exceptionValue.isObject() || asObject(exceptionValue)->hasProperty(callFrame, callFrame->vm().propertyNames->stack)); 652 652 653 Debugger* debugger = callFrame-> dynamicGlobalObject()->debugger();653 Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger(); 654 654 if (debugger && debugger->needsExceptionCallbacks()) { 655 655 // We need to clear the exception and the exception stack here in order to see if a new exception happens. … … 740 740 return jsNull(); 741 741 742 StackStats::CheckPoint stackCheckPoint; 743 const VMStackBounds vmStackBounds(vm, wtfThreadData().stack()); 744 if (!vmStackBounds.isSafeToRecurse()) 742 VMEntryScope entryScope(vm, scope->globalObject()); 743 if (!vm.isSafeToRecurse()) 745 744 return checkedReturn(throwStackOverflowError(callFrame)); 746 745 … … 748 747 // we'll handle the JSON object here. Else, we'll handle real JS code 749 748 // below at failedJSONP. 750 DynamicGlobalObjectScope globalObjectScope(vm, scope->globalObject()); 749 751 750 Vector<JSONPData> JSONPData; 752 751 bool parseResult; … … 901 900 return jsNull(); 902 901 903 StackStats::CheckPoint stackCheckPoint;904 const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());905 if (!vmStackBounds.isSafeToRecurse())906 return checkedReturn(throwStackOverflowError(callFrame));907 908 902 bool isJSCall = (callType == CallTypeJS); 909 903 JSScope* scope; … … 917 911 scope = callFrame->scope(); 918 912 } 919 DynamicGlobalObjectScope globalObjectScope(vm, scope->globalObject()); 913 914 VMEntryScope entryScope(vm, scope->globalObject()); 915 if (!vm.isSafeToRecurse()) 916 return checkedReturn(throwStackOverflowError(callFrame)); 920 917 921 918 if (isJSCall) { … … 979 976 return checkedReturn(throwStackOverflowError(callFrame)); 980 977 981 StackStats::CheckPoint stackCheckPoint;982 const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());983 if (!vmStackBounds.isSafeToRecurse())984 return checkedReturn(throwStackOverflowError(callFrame));985 986 978 bool isJSConstruct = (constructType == ConstructTypeJS); 987 979 JSScope* scope; … … 996 988 } 997 989 998 DynamicGlobalObjectScope globalObjectScope(vm, scope->globalObject()); 990 VMEntryScope entryScope(vm, scope->globalObject()); 991 if (!vm.isSafeToRecurse()) 992 return checkedReturn(throwStackOverflowError(callFrame)); 999 993 1000 994 if (isJSConstruct) { … … 1066 1060 return CallFrameClosure(); 1067 1061 1068 StackStats::CheckPoint stackCheckPoint;1069 const VMStackBounds vmStackBounds(vm, wtfThreadData().stack());1070 if (!vmStackBounds.isSafeToRecurse()) {1071 throwStackOverflowError(callFrame);1072 return CallFrameClosure();1073 }1074 1075 1062 // Compile the callee: 1076 1063 JSObject* error = functionExecutable->prepareForExecution(callFrame, scope, CodeForCall); … … 1166 1153 return jsNull(); 1167 1154 1168 DynamicGlobalObjectScope globalObjectScope(vm, scope->globalObject()); 1169 1170 StackStats::CheckPoint stackCheckPoint; 1171 const VMStackBounds vmStackBounds(vm, wtfThreadData().stack()); 1172 if (!vmStackBounds.isSafeToRecurse()) 1173 return checkedReturn(throwStackOverflowError(callFrame)); 1155 VMEntryScope entryScope(vm, scope->globalObject()); 1156 if (!vm.isSafeToRecurse()) 1157 return checkedReturn(throwStackOverflowError(callFrame)); 1174 1158 1175 1159 unsigned numVariables = eval->numVariables(); … … 1252 1236 NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID) 1253 1237 { 1254 Debugger* debugger = callFrame-> dynamicGlobalObject()->debugger();1238 Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger(); 1255 1239 if (!debugger || !debugger->needsOpDebugCallbacks()) 1256 1240 return; -
trunk/Source/JavaScriptCore/interpreter/JSStack.cpp
r158586 r159605 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "config.h" 30 #include "JSStack.h"31 30 #include "JSStackInlines.h" 32 31 … … 45 44 46 45 JSStack::JSStack(VM& vm, size_t capacity) 47 : m_end(0) 46 : m_vm(vm) 47 , m_end(0) 48 48 , m_topCallFrame(vm.topCallFrame) 49 49 { … … 51 51 52 52 m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages); 53 m_end = highAddress();53 updateStackLimit(highAddress()); 54 54 m_commitEnd = highAddress(); 55 55 … … 72 72 // just update the end pointer and return. 73 73 if (newEnd >= m_commitEnd) { 74 m_end = newEnd;74 updateStackLimit(newEnd); 75 75 return true; 76 76 } … … 88 88 addToCommittedByteCount(delta); 89 89 m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) - delta); 90 m_end = newEnd;90 updateStackLimit(newEnd); 91 91 return true; 92 92 } -
trunk/Source/JavaScriptCore/interpreter/JSStack.h
r158315 r159605 1 1 /* 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 88 88 } 89 89 90 Register* getLimitOfStack() const { return m_end; }91 90 size_t size() const { return highAddress() - lowAddress(); } 92 91 … … 96 95 static void initializeThreading(); 97 96 98 Register* const * addressOfEnd() const99 {100 return &m_end;101 }102 103 97 Register* getTopOfFrame(CallFrame*); 104 98 Register* getStartOfFrame(CallFrame*); 105 99 Register* getTopOfStack(); 106 Register* end() const { return m_end; }107 100 108 101 CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*, … … 154 147 void addToCommittedByteCount(long); 155 148 149 void updateStackLimit(Register* newEnd); 150 151 VM& m_vm; 156 152 Register* m_end; 157 153 Register* m_commitEnd; … … 163 159 }; 164 160 165 inline void JSStack::shrink(Register* newEnd)166 {167 if (newEnd >= m_end)168 return;169 m_end = newEnd;170 if (m_end == getBaseOfStack() && (m_commitEnd - getBaseOfStack()) >= maxExcessCapacity)171 releaseExcessCapacity();172 }173 174 inline bool JSStack::grow(Register* newEnd)175 {176 if (newEnd >= m_end)177 return true;178 return growSlowCase(newEnd);179 }180 181 161 } // namespace JSC 182 162 -
trunk/Source/JavaScriptCore/interpreter/JSStackInlines.h
r158648 r159605 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "CodeBlock.h" 31 31 #include "JSStack.h" 32 #include "VM.h" 32 33 33 34 namespace JSC { … … 136 137 } 137 138 139 inline void JSStack::shrink(Register* newEnd) 140 { 141 if (newEnd >= m_end) 142 return; 143 updateStackLimit(newEnd); 144 if (m_end == getBaseOfStack() && (m_commitEnd - getBaseOfStack()) >= maxExcessCapacity) 145 releaseExcessCapacity(); 146 } 147 148 inline bool JSStack::grow(Register* newEnd) 149 { 150 if (newEnd >= m_end) 151 return true; 152 return growSlowCase(newEnd); 153 } 154 155 inline void JSStack::updateStackLimit(Register* newEnd) 156 { 157 m_end = newEnd; 158 #if USE(SEPARATE_C_AND_JS_STACK) 159 m_vm.setJSStackLimit(newEnd); 160 #endif 161 } 138 162 139 163 #if ENABLE(DEBUG_JSSTACK) -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r159091 r159605 569 569 570 570 addPtr(TrustedImm32(virtualRegisterForLocal(m_codeBlock->m_numCalleeRegisters).offset() * sizeof(Register)), callFrameRegister, regT1); 571 stackCheck = branchPtr(Above, AbsoluteAddress(m_vm-> interpreter->stack().addressOfEnd()), regT1);571 stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1); 572 572 } 573 573 -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r159091 r159605 85 85 // regT1: newCallFrame 86 86 87 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm-> interpreter->stack().addressOfEnd()), regT1));87 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1)); 88 88 89 89 // Initialize ArgumentCount. -
trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp
r158901 r159605 163 163 // regT3: newCallFrame 164 164 165 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm-> interpreter->stack().addressOfEnd()), regT3));165 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT3)); 166 166 167 167 // Initialize ArgumentCount. -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r159466 r159605 45 45 #include "JSNameScope.h" 46 46 #include "JSPropertyNameIterator.h" 47 #include "JSStackInlines.h" 47 48 #include "JSWithScope.h" 48 49 #include "ObjectConstructor.h" -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r158237 r159605 44 44 #include "JSNameScope.h" 45 45 #include "JSPropertyNameIterator.h" 46 #include "JSStackInlines.h" 46 47 #include "JSString.h" 47 48 #include "JSWithScope.h" -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r159422 r159605 384 384 addi 1, t0 # Account that local0 goes at slot -1 385 385 loadp CodeBlock::m_vm[t1], t2 386 loadp VM::interpreter[t2], t2387 386 lshiftp 3, t0 388 387 subp cfr, t0, t0 389 bpbeq Interpreter::m_stack + JSStack::m_end[t2], t0, .stackHeightOK388 bpbeq VM::m_jsStackLimit[t2], t0, .stackHeightOK 390 389 391 390 # Stack height check failed - need to call a slow_path. -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r159520 r159605 194 194 : m_vm(vm) 195 195 , m_source(&source) 196 , m_stack(*vm, wtfThreadData().stack())197 196 , m_hasStackOverflow(false) 198 197 , m_allowsIn(true) -
trunk/Source/JavaScriptCore/parser/Parser.h
r159520 r159605 36 36 #include "SourceProviderCache.h" 37 37 #include "SourceProviderCacheItem.h" 38 #include "VMStackBounds.h"39 38 #include <wtf/Forward.h> 40 39 #include <wtf/Noncopyable.h> … … 759 758 bool canRecurse() 760 759 { 761 return m_ stack.isSafeToRecurse();760 return m_vm->isSafeToRecurse(); 762 761 } 763 762 … … 828 827 OwnPtr<LexerType> m_lexer; 829 828 830 VMStackBounds m_stack;831 829 bool m_hasStackOverflow; 832 830 String m_errorMessage; -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h
r158237 r159605 30 30 #include "CodeSpecializationKind.h" 31 31 #include "ExceptionHelpers.h" 32 #include "JSStackInlines.h" 32 33 #include "NameInstance.h" 33 34 #include <wtf/Platform.h> -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r154797 r159605 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2003, 2007 Apple Inc.4 * Copyright (C) 2003, 2007, 2013 Apple Inc. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 79 79 80 80 if (!thisValue || thisValue.isUndefinedOrNull()) 81 thisValue = exec-> dynamicGlobalObject();81 thisValue = exec->vmEntryGlobalObject(); 82 82 JSObject* thisObj = jsCast<JSObject*>(thisValue.toThis(exec, NotStrictMode)); 83 83 JSValue result = exec->interpreter()->execute(program, exec, thisObj); -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r159520 r159605 1 1 /* 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 113 113 SourceCode source = makeSource(program, sourceURL, position); 114 114 JSObject* exception = 0; 115 FunctionExecutable* function = FunctionExecutable::fromGlobalCode(functionName, exec, exec-> dynamicGlobalObject()->debugger(), source, &exception);115 FunctionExecutable* function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->vmEntryGlobalObject()->debugger(), source, &exception); 116 116 if (!function) { 117 117 ASSERT(exception); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r159547 r159605 717 717 } 718 718 719 DynamicGlobalObjectScope::DynamicGlobalObjectScope(VM& vm, JSGlobalObject* dynamicGlobalObject)720 : m_dynamicGlobalObjectSlot(vm.dynamicGlobalObject)721 , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)722 {723 if (!m_dynamicGlobalObjectSlot) {724 #if ENABLE(ASSEMBLER)725 if (ExecutableAllocator::underMemoryPressure())726 vm.heap.deleteAllCompiledCode();727 #endif728 729 m_dynamicGlobalObjectSlot = dynamicGlobalObject;730 731 // Reset the date cache between JS invocations to force the VM732 // to observe time zone changes.733 vm.resetDateCache();734 }735 // Clear the exception stack between entries736 vm.clearExceptionStack();737 }738 739 719 void slowValidateCell(JSGlobalObject* globalObject) 740 720 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r159545 r159605 585 585 } 586 586 587 inline JSGlobalObject* ExecState::dynamicGlobalObject()588 {589 if (this == lexicalGlobalObject()->globalExec())590 return lexicalGlobalObject();591 592 // For any ExecState that's not a globalExec, the593 // dynamic global object must be set since code is running594 ASSERT(vm().dynamicGlobalObject);595 return vm().dynamicGlobalObject;596 }597 598 587 inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, unsigned initialLength = 0) 599 588 { … … 635 624 return constructArrayNegativeIndexed(exec, profile, exec->lexicalGlobalObject(), values, length); 636 625 } 637 638 class DynamicGlobalObjectScope {639 WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);640 public:641 JS_EXPORT_PRIVATE DynamicGlobalObjectScope(VM&, JSGlobalObject*);642 643 ~DynamicGlobalObjectScope()644 {645 m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;646 }647 648 private:649 JSGlobalObject*& m_dynamicGlobalObjectSlot;650 JSGlobalObject* m_savedDynamicGlobalObject;651 };652 626 653 627 inline JSObject* JSScope::globalThis() -
trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h
r151869 r159605 22 22 23 23 #include "Interpreter.h" 24 #include "VMStackBounds.h"25 24 #include <wtf/StackStats.h> 26 25 #include <wtf/WTFThreadData.h> … … 52 51 { 53 52 VM& vm = m_exec->vm(); 54 const VMStackBounds nativeStack(vm, wtfThreadData().stack()); 55 if (!nativeStack.isSafeToRecurse()) 53 if (!vm.isSafeToRecurse()) 56 54 return throwStackOverflowError(); 57 55 bool alreadyVisited = !vm.stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry; -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r159276 r159605 196 196 , jsFinalObjectClassInfo(JSFinalObject::info()) 197 197 , sizeOfLastScratchBuffer(0) 198 , dynamicGlobalObject(0)198 , entryScope(0) 199 199 , m_enabledProfiler(0) 200 200 , m_regExpCache(new RegExpCache(this)) … … 216 216 , m_initializingObjectClass(0) 217 217 #endif 218 , m_stackLimit(0) 219 #if USE(SEPARATE_C_AND_JS_STACK) 220 , m_jsStackLimit(0) 221 #endif 218 222 , m_inDefineOwnProperty(false) 219 223 , m_codeCache(CodeCache::create()) 220 224 { 221 225 interpreter = new Interpreter(*this); 226 StackBounds stack = wtfThreadData().stack(); 227 setStackLimit(stack.recursionLimit()); 222 228 223 229 // Need to be careful to keep everything consistent here … … 533 539 prepareToDiscardCode(); 534 540 535 if ( dynamicGlobalObject) {541 if (entryScope) { 536 542 StackPreservingRecompiler recompiler; 537 543 HeapIterationScope iterationScope(heap); … … 619 625 JSValue VM::throwException(ExecState* exec, JSValue error) 620 626 { 621 ASSERT(exec == topCallFrame || exec == exec->lexicalGlobalObject()->globalExec() || exec == exec-> dynamicGlobalObject()->globalExec());627 ASSERT(exec == topCallFrame || exec == exec->lexicalGlobalObject()->globalExec() || exec == exec->vmEntryGlobalObject()->globalExec()); 622 628 623 629 Vector<StackFrame> stackTrace; -
trunk/Source/JavaScriptCore/runtime/VM.h
r159276 r159605 55 55 #include <wtf/RefCountedArray.h> 56 56 #include <wtf/SimpleStats.h> 57 #include <wtf/StackBounds.h> 57 58 #include <wtf/ThreadSafeRefCounted.h> 58 59 #include <wtf/ThreadSpecific.h> … … 91 92 class UnlinkedFunctionExecutable; 92 93 class UnlinkedProgramCodeBlock; 94 class VMEntryScope; 93 95 94 96 #if ENABLE(DFG_JIT) … … 362 364 JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*); 363 365 366 void** addressOfJSStackLimit() { return &m_jsStackLimit; } 367 void* jsStackLimit() { return m_jsStackLimit; } 368 void setJSStackLimit(void* limit) { m_jsStackLimit = limit; } 369 370 void* stackLimit() { return m_stackLimit; } 371 void setStackLimit(void* limit) { m_stackLimit = limit; } 372 bool isSafeToRecurse() const 373 { 374 ASSERT(wtfThreadData().stack().isGrowingDownward()); 375 void* curr; 376 return &curr >= m_stackLimit; 377 } 378 364 379 const ClassInfo* const jsArrayClassInfo; 365 380 const ClassInfo* const jsFinalObjectClassInfo; … … 397 412 void gatherConservativeRoots(ConservativeRoots&); 398 413 399 JSGlobalObject* dynamicGlobalObject;414 VMEntryScope* entryScope; 400 415 401 416 HashSet<JSObject*> stringRecursionCheckVisitedObjects; … … 476 491 const ClassInfo* m_initializingObjectClass; 477 492 #endif 493 494 #if USE(SEPARATE_C_AND_JS_STACK) 495 struct { 496 void* m_stackLimit; 497 void* m_jsStackLimit; 498 }; 499 #else 500 union { 501 void* m_stackLimit; 502 void* m_jsStackLimit; 503 }; 504 #endif 478 505 JSValue m_exception; 479 506 bool m_inDefineOwnProperty; -
trunk/Source/WTF/ChangeLog
r159448 r159605 1 2013-11-20 Mark Lam <mark.lam@apple.com> 2 3 Introducing VMEntryScope to update the VM stack limit. 4 https://bugs.webkit.org/show_bug.cgi?id=124634. 5 6 Reviewed by Geoffrey Garen. 7 8 * wtf/Platform.h: 9 * wtf/StackBounds.h: 10 (WTF::StackBounds::StackBounds): 11 1 12 2013-11-18 Filip Pizlo <fpizlo@apple.com> 2 13 -
trunk/Source/WTF/wtf/Platform.h
r159360 r159605 869 869 #endif 870 870 871 /* FIXME: We currently unconditionally use spearate stacks. When we switch to using the 872 C stack for JS frames, we'll need to make the following conditional on ENABLE(LLINT_CLOOP) 873 only. 874 */ 875 #if ENABLE(LLINT_CLOOP) || 1 876 #define WTF_USE_SEPARATE_C_AND_JS_STACK 1 877 #endif 878 871 879 /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in. 872 880 On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */ -
trunk/Source/WTF/wtf/StackBounds.h
r150995 r159605 31 31 32 32 class StackBounds { 33 // isSafeToRecurse() / recursionLimit() tests (by default)34 // that we are at least this far from the end of the stack.35 //36 33 // This 64k number was picked because a sampling of stack usage differences 37 34 // between consecutive entries into one of the Interpreter::execute...() … … 50 47 } 51 48 52 bool isSafeToRecurse(size_t minAvailableDelta = s_defaultAvailabilityDelta) const53 {54 checkConsistency();55 if (isGrowingDownward())56 return current() >= recursionLimit(minAvailableDelta);57 return current() <= recursionLimit(minAvailableDelta);58 }59 60 49 void* origin() const 61 50 { … … 69 58 return static_cast<char*>(m_origin) - static_cast<char*>(m_bound); 70 59 return static_cast<char*>(m_bound) - static_cast<char*>(m_origin); 71 }72 73 private:74 StackBounds()75 : m_origin(0)76 , m_bound(0)77 {78 }79 80 WTF_EXPORT_PRIVATE void initialize();81 82 void* current() const83 {84 checkConsistency();85 void* currentPosition = ¤tPosition;86 return currentPosition;87 60 } 88 61 … … 104 77 #endif 105 78 } 79 80 private: 81 StackBounds() 82 : m_origin(0) 83 , m_bound(0) 84 { 85 } 86 87 WTF_EXPORT_PRIVATE void initialize(); 106 88 107 89 void checkConsistency() const -
trunk/Source/WebCore/ChangeLog
r159604 r159605 1 2013-11-20 Mark Lam <mark.lam@apple.com> 2 3 Introducing VMEntryScope to update the VM stack limit. 4 https://bugs.webkit.org/show_bug.cgi?id=124634. 5 6 Reviewed by Geoffrey Garen. 7 8 No new tests. 9 10 Renamed dynamicGlobalObject() to vmEntryGlobalObject(). 11 Replaced uses of DynamicGlobalObjectScope with VMEntryScope. 12 13 * ForwardingHeaders/runtime/VMEntryScope.h: Added. 14 * WebCore.vcxproj/WebCore.vcxproj: 15 * WebCore.vcxproj/WebCore.vcxproj.filters: 16 * bindings/js/JSCryptoAlgorithmBuilder.cpp: 17 (WebCore::JSCryptoAlgorithmBuilder::add): 18 * bindings/js/JSCustomXPathNSResolver.cpp: 19 (WebCore::JSCustomXPathNSResolver::create): 20 * bindings/js/JSDOMBinding.cpp: 21 (WebCore::firstDOMWindow): 22 * bindings/js/JSErrorHandler.cpp: 23 (WebCore::JSErrorHandler::handleEvent): 24 * bindings/js/JSEventListener.cpp: 25 (WebCore::JSEventListener::handleEvent): 26 * bindings/js/JavaScriptCallFrame.h: 27 (WebCore::JavaScriptCallFrame::vmEntryGlobalObject): 28 * bindings/js/PageScriptDebugServer.cpp: 29 (WebCore::PageScriptDebugServer::recompileAllJSFunctions): 30 * bindings/js/ScriptDebugServer.cpp: 31 (WebCore::ScriptDebugServer::evaluateBreakpointAction): 32 (WebCore::ScriptDebugServer::handlePause): 33 * bindings/js/WorkerScriptDebugServer.cpp: 34 (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): 35 * bindings/objc/WebScriptObject.mm: 36 (WebCore::addExceptionToConsole): 37 * bridge/c/c_utility.cpp: 38 (JSC::Bindings::convertValueToNPVariant): 39 * bridge/objc/objc_instance.mm: 40 (ObjcInstance::moveGlobalExceptionToExecState): 41 * bridge/objc/objc_runtime.mm: 42 (JSC::Bindings::convertValueToObjcObject): 43 * bridge/objc/objc_utility.mm: 44 (JSC::Bindings::convertValueToObjcValue): 45 1 46 2013-11-20 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 47 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r159587 r159605 18591 18591 <ClInclude Include="..\ForwardingHeaders\runtime\JSFunction.h" /> 18592 18592 <ClInclude Include="..\ForwardingHeaders\runtime\VM.h" /> 18593 <ClInclude Include="..\ForwardingHeaders\runtime\VMEntryScope.h" /> 18593 18594 <ClInclude Include="..\ForwardingHeaders\runtime\JSGlobalObject.h" /> 18594 18595 <ClInclude Include="..\ForwardingHeaders\runtime\JSProxy.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r159587 r159605 12656 12656 <Filter>ForwardingHeaders\runtime</Filter> 12657 12657 </ClInclude> 12658 <ClInclude Include="..\ForwardingHeaders\runtime\VMEntryScope.h"> 12659 <Filter>ForwardingHeaders\runtime</Filter> 12660 </ClInclude> 12658 12661 <ClInclude Include="..\ForwardingHeaders\runtime\JSGlobalObject.h"> 12659 12662 <Filter>ForwardingHeaders\runtime</Filter> -
trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.cpp
r159180 r159605 72 72 Identifier identifier(&vm, key); 73 73 RefPtr<Uint8Array> arrayView = Uint8Array::create(buffer.data(), buffer.size()); 74 m_dictionary->putDirect(vm, identifier, arrayView->wrap(m_exec, vm. dynamicGlobalObject));74 m_dictionary->putDirect(vm, identifier, arrayView->wrap(m_exec, vm.entryScope->globalObject())); 75 75 } 76 76 -
trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
r157215 r159605 1 1 /* 2 * Copyright (C) 2007 Alexey Proskuryakov (ap@nypop.com)2 * Copyright (C) 2007, 2013 Alexey Proskuryakov (ap@nypop.com) 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 } 54 54 55 return adoptRef(new JSCustomXPathNSResolver(exec, resolverObject, asJSDOMWindow(exec-> dynamicGlobalObject())));55 return adoptRef(new JSCustomXPathNSResolver(exec, resolverObject, asJSDOMWindow(exec->vmEntryGlobalObject()))); 56 56 } 57 57 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r158997 r159605 1 1 /* 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> 5 5 * Copyright (C) 2013 Michael Pruett <michael@68k.org> … … 495 495 DOMWindow& firstDOMWindow(ExecState* exec) 496 496 { 497 return asJSDOMWindow(exec-> dynamicGlobalObject())->impl();497 return asJSDOMWindow(exec->vmEntryGlobalObject())->impl(); 498 498 } 499 499 -
trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp
r156769 r159605 1 1 /* 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 40 41 #include "JSMainThreadExecState.h" 41 42 #include <runtime/JSLock.h> 43 #include <runtime/VMEntryScope.h> 42 44 #include <wtf/Ref.h> 43 45 … … 95 97 96 98 VM& vm = globalObject->vm(); 97 DynamicGlobalObjectScope globalObjectScope(vm, vm.dynamicGlobalObject ? vm.dynamicGlobalObject: globalObject);99 VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject); 98 100 99 101 JSValue returnValue = scriptExecutionContext->isDocument() -
trunk/Source/WebCore/bindings/js/JSEventListener.cpp
r157215 r159605 1 1 /* 2 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved.3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All Rights Reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 33 33 #include <runtime/ExceptionHelpers.h> 34 34 #include <runtime/JSLock.h> 35 #include <runtime/VMEntryScope.h> 35 36 #include <wtf/Ref.h> 36 37 #include <wtf/RefCountedLeakCounter.h> … … 124 125 125 126 VM& vm = globalObject->vm(); 126 DynamicGlobalObjectScope globalObjectScope(vm, vm.dynamicGlobalObject ? vm.dynamicGlobalObject: globalObject);127 VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject); 127 128 128 129 InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData); -
trunk/Source/WebCore/bindings/js/JavaScriptCallFrame.h
r158862 r159605 54 54 JSC::DebuggerCallFrame::Type type() const { return m_debuggerCallFrame->type(); } 55 55 JSC::JSScope* scopeChain() const { return m_debuggerCallFrame->scope(); } 56 JSC::JSGlobalObject* dynamicGlobalObject() const { return m_debuggerCallFrame->dynamicGlobalObject(); }56 JSC::JSGlobalObject* vmEntryGlobalObject() const { return m_debuggerCallFrame->vmEntryGlobalObject(); } 57 57 58 58 JSC::JSValue thisValue() const { return m_debuggerCallFrame->thisValue(); } -
trunk/Source/WebCore/bindings/js/PageScriptDebugServer.cpp
r157215 r159605 1 1 /* 2 2 * Copyright (c) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 116 117 JSLockHolder lock(JSDOMWindow::commonVM()); 117 118 // If JavaScript stack is not empty postpone recompilation. 118 if (JSDOMWindow::commonVM()-> dynamicGlobalObject)119 if (JSDOMWindow::commonVM()->entryScope) 119 120 recompileAllJSFunctionsSoon(); 120 121 else -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp
r158937 r159605 100 100 switch (breakpointAction.type) { 101 101 case ScriptBreakpointActionTypeLog: { 102 DOMWindow& window = asJSDOMWindow(debuggerCallFrame-> dynamicGlobalObject())->impl();102 DOMWindow& window = asJSDOMWindow(debuggerCallFrame->vmEntryGlobalObject())->impl(); 103 103 if (PageConsole* console = window.pageConsole()) 104 104 console->addMessage(JSMessageSource, LogMessageLevel, breakpointAction.data); … … 289 289 } 290 290 291 void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* dynamicGlobalObject)292 { 293 dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, dynamicGlobalObject);294 didPause( dynamicGlobalObject);291 void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject) 292 { 293 dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, vmEntryGlobalObject); 294 didPause(vmEntryGlobalObject); 295 295 296 296 TimerBase::fireTimersInNestedEventLoop(); … … 301 301 m_runningNestedMessageLoop = false; 302 302 303 didContinue(dynamicGlobalObject); 304 dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, dynamicGlobalObject); 305 } 303 didContinue(vmEntryGlobalObject); 304 dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject); 305 } 306 306 307 void ScriptDebugServer::recompileAllJSFunctionsSoon() 307 308 { -
trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp
r158937 r159605 68 68 JSC::JSLockHolder lock(vm); 69 69 // If JavaScript stack is not empty postpone recompilation. 70 if (vm-> dynamicGlobalObject)70 if (vm->entryScope) 71 71 recompileAllJSFunctionsSoon(); 72 72 else -
trunk/Source/WebCore/bindings/objc/WebScriptObject.mm
r158997 r159605 1 1 /* 2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 125 125 static void addExceptionToConsole(ExecState* exec) 126 126 { 127 JSDOMWindow* window = asJSDOMWindow(exec-> dynamicGlobalObject());127 JSDOMWindow* window = asJSDOMWindow(exec->vmEntryGlobalObject()); 128 128 if (!window || !exec->hadException()) 129 129 return; -
trunk/Source/WebCore/bridge/c/c_utility.cpp
r154038 r159605 1 1 /* 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2004, 2006, 2013 Apple Computer, Inc. All rights reserved. 3 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 4 4 * … … 95 95 } 96 96 } else { 97 JSGlobalObject* globalObject = exec-> dynamicGlobalObject();97 JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); 98 98 99 99 RootObject* rootObject = findRootObject(globalObject); -
trunk/Source/WebCore/bridge/objc/objc_instance.mm
r156485 r159605 1 1 /* 2 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2008, 2009, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 93 93 } 94 94 95 if (!s_exceptionEnvironment || s_exceptionEnvironment == exec-> dynamicGlobalObject()) {95 if (!s_exceptionEnvironment || s_exceptionEnvironment == exec->vmEntryGlobalObject()) { 96 96 JSLockHolder lock(exec); 97 97 throwError(exec, s_exception); -
trunk/Source/WebCore/bridge/objc/objc_runtime.mm
r154797 r159605 1 1 /* 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 114 114 static id convertValueToObjcObject(ExecState* exec, JSValue value) 115 115 { 116 RefPtr<RootObject> rootObject = findRootObject(exec-> dynamicGlobalObject());116 RefPtr<RootObject> rootObject = findRootObject(exec->vmEntryGlobalObject()); 117 117 if (!rootObject) 118 118 return nil; -
trunk/Source/WebCore/bridge/objc/objc_utility.mm
r154797 r159605 1 1 /* 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2004, 2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 89 89 JSLockHolder lock(exec); 90 90 91 JSGlobalObject *originGlobalObject = exec-> dynamicGlobalObject();91 JSGlobalObject *originGlobalObject = exec->vmEntryGlobalObject(); 92 92 RootObject* originRootObject = findRootObject(originGlobalObject); 93 93 -
trunk/Source/WebKit/mac/ChangeLog
r159550 r159605 1 2013-11-20 Mark Lam <mark.lam@apple.com> 2 3 Introducing VMEntryScope to update the VM stack limit. 4 https://bugs.webkit.org/show_bug.cgi?id=124634. 5 6 Reviewed by Geoffrey Garen. 7 8 * WebView/WebScriptDebugger.mm: 9 (WebScriptDebugger::sourceParsed): 10 1 11 2013-11-19 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm
r158937 r159605 93 93 int firstLine = sourceProvider->startPosition().m_line.oneBasedInt(); 94 94 95 WebFrame *webFrame = toWebFrame(exec-> dynamicGlobalObject());95 WebFrame *webFrame = toWebFrame(exec->vmEntryGlobalObject()); 96 96 WebView *webView = [webFrame webView]; 97 97 WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
Note: See TracChangeset
for help on using the changeset viewer.