Changeset 203130 in webkit
- Timestamp:
- Jul 12, 2016, 3:06:20 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/API/tests/PingPongStackOverflowTest.cpp ¶
r189454 r203130 121 121 Options::initialize(); // Ensure options is initialized first. 122 122 123 auto origSoftReservedZoneSize = Options::softReservedZoneSize(); 123 124 auto origReservedZoneSize = Options::reservedZoneSize(); 124 auto origErrorModeReservedZoneSize = Options::errorModeReservedZoneSize();125 125 auto origUseLLInt = Options::useLLInt(); 126 126 auto origMaxPerThreadStackUsage = Options::maxPerThreadStackUsage(); 127 127 128 Options:: reservedZoneSize() = 128 * KB;129 Options:: errorModeReservedZoneSize() = 64 * KB;128 Options::softReservedZoneSize() = 128 * KB; 129 Options::reservedZoneSize() = 64 * KB; 130 130 #if ENABLE(JIT) 131 131 // Normally, we want to disable the LLINT to force the use of JITted code which is necessary for … … 159 159 160 160 unsigned stackSize = 32 * KB; 161 Options::maxPerThreadStackUsage() = stackSize + Options:: reservedZoneSize();161 Options::maxPerThreadStackUsage() = stackSize + Options::softReservedZoneSize(); 162 162 163 163 exception = nullptr; … … 174 174 } 175 175 176 Options::softReservedZoneSize() = origSoftReservedZoneSize; 176 177 Options::reservedZoneSize() = origReservedZoneSize; 177 Options::errorModeReservedZoneSize() = origErrorModeReservedZoneSize;178 178 Options::useLLInt() = origUseLLInt; 179 179 Options::maxPerThreadStackUsage() = origMaxPerThreadStackUsage; -
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r203115 r203130 1 2016-07-12 Mark Lam <mark.lam@apple.com> 2 3 More stack limit and reserved zone renaming. 4 https://bugs.webkit.org/show_bug.cgi?id=159690 5 6 Rubber-stamped by Geoffrey Garen. 7 8 We should rename the following: 9 osStackLimitWithReserve => softStackLimit 10 reservedZoneSize => softReservedZoneSize 11 errorModeReservedZoneSize => reservedZoneSize 12 13 * API/tests/PingPongStackOverflowTest.cpp: 14 (testPingPongStackOverflow): 15 * dfg/DFGJITCompiler.cpp: 16 (JSC::DFG::JITCompiler::compile): 17 (JSC::DFG::JITCompiler::compileFunction): 18 * ftl/FTLLowerDFGToB3.cpp: 19 (JSC::FTL::DFG::LowerDFGToB3::lower): 20 * interpreter/CLoopStack.cpp: 21 (JSC::CLoopStack::CLoopStack): 22 (JSC::CLoopStack::grow): 23 (JSC::CLoopStack::releaseExcessCapacity): 24 (JSC::CLoopStack::addToCommittedByteCount): 25 (JSC::CLoopStack::setSoftReservedZoneSize): 26 (JSC::CLoopStack::setReservedZoneSize): Deleted. 27 * interpreter/CLoopStack.h: 28 (JSC::CLoopStack::size): 29 * interpreter/CLoopStackInlines.h: 30 (JSC::CLoopStack::shrink): 31 * jit/JIT.cpp: 32 (JSC::JIT::compileWithoutLinking): 33 * jit/SetupVarargsFrame.cpp: 34 (JSC::emitSetupVarargsFrameFastCase): 35 * llint/LLIntSlowPaths.cpp: 36 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 37 * llint/LowLevelInterpreter.asm: 38 * llint/LowLevelInterpreter32_64.asm: 39 * llint/LowLevelInterpreter64.asm: 40 * runtime/ErrorHandlingScope.cpp: 41 (JSC::ErrorHandlingScope::ErrorHandlingScope): 42 (JSC::ErrorHandlingScope::~ErrorHandlingScope): 43 * runtime/ErrorHandlingScope.h: 44 * runtime/Options.h: 45 * runtime/RegExp.cpp: 46 (JSC::RegExp::finishCreation): 47 (JSC::RegExp::compile): 48 (JSC::RegExp::compileMatchOnly): 49 * runtime/VM.cpp: 50 (JSC::VM::VM): 51 (JSC::VM::setStackPointerAtVMEntry): 52 (JSC::VM::updateSoftReservedZoneSize): 53 (JSC::VM::updateStackLimit): 54 (JSC::VM::updateReservedZoneSize): Deleted. 55 * runtime/VM.h: 56 (JSC::VM::stackPointerAtVMEntry): 57 (JSC::VM::softReservedZoneSize): 58 (JSC::VM::softStackLimit): 59 (JSC::VM::addressOfSoftStackLimit): 60 (JSC::VM::cloopStackLimit): 61 (JSC::VM::setCLoopStackLimit): 62 (JSC::VM::isSafeToRecurse): 63 (JSC::VM::reservedZoneSize): Deleted. 64 (JSC::VM::osStackLimitWithReserve): Deleted. 65 (JSC::VM::addressOfOSStackLimitWithReserve): Deleted. 66 * runtime/VMInlines.h: 67 (JSC::VM::ensureStackCapacityFor): 68 * wasm/WASMFunctionCompiler.h: 69 (JSC::WASMFunctionCompiler::startFunction): 70 1 71 2016-07-12 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 72 -
TabularUnified trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp ¶
r203006 r203130 343 343 // Plant a check that sufficient space is available in the JSStack. 344 344 addPtr(TrustedImm32(virtualRegisterForLocal(m_graph.requiredRegisterCountForExecutionAndExit() - 1).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1); 345 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOf OSStackLimitWithReserve()), GPRInfo::regT1);345 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfSoftStackLimit()), GPRInfo::regT1); 346 346 347 347 addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister); … … 406 406 // Plant a check that sufficient space is available in the JSStack. 407 407 addPtr(TrustedImm32(virtualRegisterForLocal(m_graph.requiredRegisterCountForExecutionAndExit() - 1).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1); 408 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOf OSStackLimitWithReserve()), GPRInfo::regT1);408 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfSoftStackLimit()), GPRInfo::regT1); 409 409 410 410 // Move the stack pointer down to accommodate locals -
TabularUnified trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp ¶
r203006 r203130 190 190 // Stack Overflow Check. 191 191 unsigned exitFrameSize = m_graph.requiredRegisterCountForExit() * sizeof(Register); 192 MacroAssembler::AbsoluteAddress addressOfStackLimit(vm().addressOf OSStackLimitWithReserve());192 MacroAssembler::AbsoluteAddress addressOfStackLimit(vm().addressOfSoftStackLimit()); 193 193 PatchpointValue* stackOverflowHandler = m_out.patchpoint(Void); 194 194 CallSiteIndex callSiteIndex = callSiteIndexForCodeOrigin(m_ftlState, CodeOrigin(0)); -
TabularUnified trunk/Source/JavaScriptCore/interpreter/CLoopStack.cpp ¶
r203081 r203130 55 55 , m_topCallFrame(vm.topCallFrame) 56 56 , m_end(0) 57 , m_ reservedZoneSizeInRegisters(0)57 , m_softReservedZoneSizeInRegisters(0) 58 58 { 59 59 size_t capacity = Options::maxPerThreadStackUsage(); … … 79 79 bool CLoopStack::grow(Register* newTopOfStack) 80 80 { 81 Register* newTopOfStackWithReservedZone = newTopOfStack - m_ reservedZoneSizeInRegisters;81 Register* newTopOfStackWithReservedZone = newTopOfStack - m_softReservedZoneSizeInRegisters; 82 82 83 83 // If we have already committed enough memory to satisfy this request, … … 127 127 void CLoopStack::releaseExcessCapacity() 128 128 { 129 Register* highAddressWithReservedZone = highAddress() - m_ reservedZoneSizeInRegisters;129 Register* highAddressWithReservedZone = highAddress() - m_softReservedZoneSizeInRegisters; 130 130 ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithReservedZone) - reinterpret_cast<char*>(m_commitTop); 131 131 m_reservation.decommit(m_commitTop, delta); … … 141 141 } 142 142 143 void CLoopStack::set ReservedZoneSize(size_t reservedZoneSize)143 void CLoopStack::setSoftReservedZoneSize(size_t reservedZoneSize) 144 144 { 145 m_ reservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register);146 if (m_commitTop >= (m_end + 1) - m_ reservedZoneSizeInRegisters)145 m_softReservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register); 146 if (m_commitTop >= (m_end + 1) - m_softReservedZoneSizeInRegisters) 147 147 grow(m_end + 1); 148 148 } -
TabularUnified trunk/Source/JavaScriptCore/interpreter/CLoopStack.h ¶
r203081 r203130 68 68 size_t size() const { return highAddress() - lowAddress(); } 69 69 70 void set ReservedZoneSize(size_t);70 void setSoftReservedZoneSize(size_t); 71 71 72 72 inline Register* topOfStack(); … … 105 105 PageReservation m_reservation; 106 106 Register* m_lastStackTop; 107 ptrdiff_t m_ reservedZoneSizeInRegisters;107 ptrdiff_t m_softReservedZoneSizeInRegisters; 108 108 109 109 friend class LLIntOffsetsExtractor; -
TabularUnified trunk/Source/JavaScriptCore/interpreter/CLoopStackInlines.h ¶
r203081 r203130 65 65 // assign the constant to a local variable, and use the local instead. 66 66 ptrdiff_t maxExcessCapacity = CLoopStack::maxExcessCapacity; 67 ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_ reservedZoneSizeInRegisters);67 ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_softReservedZoneSizeInRegisters); 68 68 if (m_end == baseOfStack() && (highAddress() - m_commitTop) >= maxExcessInRegisters) 69 69 releaseExcessCapacity(); -
TabularUnified trunk/Source/JavaScriptCore/jit/JIT.cpp ¶
r203006 r203130 600 600 601 601 addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, regT1); 602 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOf OSStackLimitWithReserve()), regT1);602 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfSoftStackLimit()), regT1); 603 603 604 604 move(regT1, stackPointerRegister); -
TabularUnified trunk/Source/JavaScriptCore/jit/SetupVarargsFrame.cpp ¶
r203053 r203130 83 83 emitSetVarargsFrame(jit, scratchGPR1, true, numUsedSlotsGPR, scratchGPR2); 84 84 85 slowCase.append(jit.branchPtr(CCallHelpers::Above, CCallHelpers::AbsoluteAddress(jit.vm()->addressOf OSStackLimitWithReserve()), scratchGPR2));85 slowCase.append(jit.branchPtr(CCallHelpers::Above, CCallHelpers::AbsoluteAddress(jit.vm()->addressOfSoftStackLimit()), scratchGPR2)); 86 86 87 87 // Initialize ArgumentCount. -
TabularUnified trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp ¶
r203081 r203130 484 484 485 485 #if ENABLE(JIT) 486 dataLogF("Current end is at %p.\n", exec->vm(). osStackLimitWithReserve());486 dataLogF("Current end is at %p.\n", exec->vm().softStackLimit()); 487 487 #else 488 488 dataLogF("Current end is at %p.\n", exec->vm().cloopStackLimit()); -
TabularUnified trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm ¶
r202992 r203130 955 955 bpbeq VM::m_cloopStackLimit[t2], t0, .stackHeightOK 956 956 else 957 bpbeq VM::m_ osStackLimitWithReserve[t2], t0, .stackHeightOK957 bpbeq VM::m_softStackLimit[t2], t0, .stackHeightOK 958 958 end 959 959 -
TabularUnified trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm ¶
r202992 r203130 156 156 bpaeq t3, VM::m_cloopStackLimit[vm], .stackHeightOK 157 157 else 158 bpaeq t3, VM::m_ osStackLimitWithReserve[vm], .stackHeightOK158 bpaeq t3, VM::m_softStackLimit[vm], .stackHeightOK 159 159 end 160 160 -
TabularUnified trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm ¶
r202992 r203130 144 144 bpaeq t3, VM::m_cloopStackLimit[vm], .stackHeightOK 145 145 else 146 bpaeq t3, VM::m_ osStackLimitWithReserve[vm], .stackHeightOK146 bpaeq t3, VM::m_softStackLimit[vm], .stackHeightOK 147 147 end 148 148 -
TabularUnified trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp ¶
r203081 r203130 36 36 { 37 37 RELEASE_ASSERT(m_vm.stackPointerAtVMEntry()); 38 size_t new ReservedZoneSize = Options::errorModeReservedZoneSize();39 m_saved ReservedZoneSize = m_vm.updateReservedZoneSize(newReservedZoneSize);38 size_t newSoftReservedZoneSize = Options::reservedZoneSize(); 39 m_savedSoftReservedZoneSize = m_vm.updateSoftReservedZoneSize(newSoftReservedZoneSize); 40 40 } 41 41 … … 43 43 { 44 44 RELEASE_ASSERT(m_vm.stackPointerAtVMEntry()); 45 m_vm.update ReservedZoneSize(m_savedReservedZoneSize);45 m_vm.updateSoftReservedZoneSize(m_savedSoftReservedZoneSize); 46 46 } 47 47 -
TabularUnified trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.h ¶
r163027 r203130 37 37 private: 38 38 VM& m_vm; 39 size_t m_saved ReservedZoneSize;39 size_t m_savedSoftReservedZoneSize; 40 40 }; 41 41 -
TabularUnified trunk/Source/JavaScriptCore/runtime/Options.h ¶
r202650 r203130 113 113 v(bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \ 114 114 \ 115 v(unsigned, maxPerThreadStackUsage, 4 * MB, Normal, nullptr) \116 v(unsigned, reservedZoneSize, 128 * KB, Normal, nullptr) \117 v(unsigned, errorModeReservedZoneSize, 64 * KB, Normal, nullptr) \115 v(unsigned, maxPerThreadStackUsage, 4 * MB, Normal, "Max allowed stack usage by the VM") \ 116 v(unsigned, softReservedZoneSize, 128 * KB, Normal, "The amount of stack JSC usually reserves for host code.") \ 117 v(unsigned, reservedZoneSize, 64 * KB, Normal, "This is the amount of stack JSC guarantees for client and VM code.") \ 118 118 \ 119 119 v(bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \ -
TabularUnified trunk/Source/JavaScriptCore/runtime/RegExp.cpp ¶
r202992 r203130 223 223 { 224 224 Base::finishCreation(vm); 225 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm. osStackLimitWithReserve());225 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm.softStackLimit()); 226 226 if (m_constructionError) 227 227 m_state = ParseError; … … 265 265 ConcurrentJITLocker locker(m_lock); 266 266 267 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm-> osStackLimitWithReserve());267 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->softStackLimit()); 268 268 if (m_constructionError) { 269 269 RELEASE_ASSERT_NOT_REACHED(); … … 318 318 ConcurrentJITLocker locker(m_lock); 319 319 320 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm-> osStackLimitWithReserve());320 Yarr::YarrPattern pattern(m_patternString, m_flags, &m_constructionError, vm->softStackLimit()); 321 321 if (m_constructionError) { 322 322 RELEASE_ASSERT_NOT_REACHED(); -
TabularUnified trunk/Source/JavaScriptCore/runtime/VM.cpp ¶
r203081 r203130 198 198 interpreter = new Interpreter(*this); 199 199 StackBounds stack = wtfThreadData().stack(); 200 update ReservedZoneSize(Options::reservedZoneSize());200 updateSoftReservedZoneSize(Options::softReservedZoneSize()); 201 201 setLastStackTop(stack.origin()); 202 202 … … 614 614 } 615 615 616 size_t VM::update ReservedZoneSize(size_t reservedZoneSize)617 { 618 size_t old ReservedZoneSize = m_reservedZoneSize;619 m_ reservedZoneSize = reservedZoneSize;616 size_t VM::updateSoftReservedZoneSize(size_t softReservedZoneSize) 617 { 618 size_t oldSoftReservedZoneSize = m_currentSoftReservedZoneSize; 619 m_currentSoftReservedZoneSize = softReservedZoneSize; 620 620 #if !ENABLE(JIT) 621 interpreter->cloopStack().set ReservedZoneSize(reservedZoneSize);621 interpreter->cloopStack().setSoftReservedZoneSize(softReservedZoneSize); 622 622 #endif 623 623 624 624 updateStackLimit(); 625 625 626 return old ReservedZoneSize;626 return oldSoftReservedZoneSize; 627 627 } 628 628 … … 655 655 { 656 656 #if PLATFORM(WIN) 657 void* last OSStackLimitWithReserve = m_osStackLimitWithReserve;657 void* lastSoftStackLimit = m_softStackLimit; 658 658 #endif 659 659 … … 661 661 ASSERT(wtfThreadData().stack().isGrowingDownward()); 662 662 char* startOfStack = reinterpret_cast<char*>(m_stackPointerAtVMEntry); 663 m_ osStackLimitWithReserve = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_reservedZoneSize);663 m_softStackLimit = wtfThreadData().stack().recursionLimit(startOfStack, Options::maxPerThreadStackUsage(), m_currentSoftReservedZoneSize); 664 664 } else { 665 m_ osStackLimitWithReserve = wtfThreadData().stack().recursionLimit(m_reservedZoneSize);665 m_softStackLimit = wtfThreadData().stack().recursionLimit(m_currentSoftReservedZoneSize); 666 666 } 667 667 668 668 #if PLATFORM(WIN) 669 if (last OSStackLimitWithReserve != m_osStackLimitWithReserve)670 preCommitStackMemory(m_ osStackLimitWithReserve);669 if (lastSoftStackLimit != m_softStackLimit) 670 preCommitStackMemory(m_softStackLimit); 671 671 #endif 672 672 } -
TabularUnified trunk/Source/JavaScriptCore/runtime/VM.h ¶
r203081 r203130 460 460 void setStackPointerAtVMEntry(void*); 461 461 462 size_t reservedZoneSize() const { return m_reservedZoneSize; }463 size_t update ReservedZoneSize(size_t reservedZoneSize);462 size_t softReservedZoneSize() const { return m_currentSoftReservedZoneSize; } 463 size_t updateSoftReservedZoneSize(size_t softReservedZoneSize); 464 464 465 465 static size_t committedStackByteCount(); 466 466 inline bool ensureStackCapacityFor(Register* newTopOfStack); 467 467 468 void* osStackLimitWithReserve() { return m_osStackLimitWithReserve; }469 void** addressOf OSStackLimitWithReserve() { return &m_osStackLimitWithReserve; }468 void* softStackLimit() { return m_softStackLimit; } 469 void** addressOfSoftStackLimit() { return &m_softStackLimit; } 470 470 #if !ENABLE(JIT) 471 471 void* cloopStackLimit() { return m_cloopStackLimit; } … … 477 477 ASSERT(wtfThreadData().stack().isGrowingDownward()); 478 478 int8_t* curr = reinterpret_cast<int8_t*>(&curr); 479 int8_t* limit = reinterpret_cast<int8_t*>(m_ osStackLimitWithReserve);479 int8_t* limit = reinterpret_cast<int8_t*>(m_softStackLimit); 480 480 return curr >= limit && static_cast<size_t>(curr - limit) >= neededStackInBytes; 481 481 } … … 649 649 650 650 void* m_stackPointerAtVMEntry; 651 size_t m_ reservedZoneSize;652 void* m_ osStackLimitWithReserve{ nullptr };651 size_t m_currentSoftReservedZoneSize; 652 void* m_softStackLimit { nullptr }; 653 653 #if !ENABLE(JIT) 654 654 void* m_cloopStackLimit { nullptr }; -
TabularUnified trunk/Source/JavaScriptCore/runtime/VMInlines.h ¶
r203081 r203130 41 41 #if ENABLE(JIT) 42 42 ASSERT(wtfThreadData().stack().isGrowingDownward()); 43 return newTopOfStack >= m_ osStackLimitWithReserve;43 return newTopOfStack >= m_softStackLimit; 44 44 #else 45 45 return interpreter->cloopStack().ensureCapacityFor(newTopOfStack); -
TabularUnified trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h ¶
r203006 r203130 136 136 137 137 addPtr(TrustedImm32(-m_calleeSaveSpace - WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_stackHeight) * sizeof(StackSlot) - maxFrameExtentForSlowPathCall), GPRInfo::callFrameRegister, GPRInfo::regT1); 138 m_stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOf OSStackLimitWithReserve()), GPRInfo::regT1);138 m_stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfSoftStackLimit()), GPRInfo::regT1); 139 139 140 140 move(GPRInfo::regT1, stackPointerRegister);
Note:
See TracChangeset
for help on using the changeset viewer.