Changeset 161582 in webkit
- Timestamp:
- Jan 9, 2014, 2:07:31 PM (13 years ago)
- Location:
- branches/jsCStack/Source/JavaScriptCore
- Files:
-
- 15 edited
-
ChangeLog (modified) (1 diff)
-
interpreter/JSStack.cpp (modified) (5 diffs)
-
interpreter/JSStack.h (modified) (2 diffs)
-
interpreter/JSStackInlines.h (modified) (1 diff)
-
llint/LowLevelInterpreter32_64.asm (modified) (1 diff)
-
llint/LowLevelInterpreter64.asm (modified) (1 diff)
-
runtime/ErrorHandlingScope.cpp (modified) (2 diffs)
-
runtime/ErrorHandlingScope.h (modified) (1 diff)
-
runtime/JSLock.cpp (modified) (3 diffs)
-
runtime/JSLock.h (modified) (1 diff)
-
runtime/Options.h (modified) (1 diff)
-
runtime/VM.cpp (modified) (3 diffs)
-
runtime/VM.h (modified) (2 diffs)
-
runtime/VMEntryScope.cpp (modified) (2 diffs)
-
runtime/VMEntryScope.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/jsCStack/Source/JavaScriptCore/ChangeLog
r161575 r161582 1 2014-01-09 Mark Lam <mark.lam@apple.com> 2 3 CStack: Rename "host zone" to "reserved zone". 4 https://bugs.webkit.org/show_bug.cgi?id=126716. 5 6 Reviewed by Michael Saboff. 7 8 The "zone" is used as a reserve of stack memory for: 9 1. nominal host code stack usage. 10 2. stack space for error handling. 11 3. initial stack space for pushing VMEntrySentinel frames. 12 13 The "zone" may reside on the C stack and on the C loop JSStack depending 14 on context. Hence, the name "host zone" is not quite accurate, and we'll 15 rename it to "reserved zone". 16 17 * interpreter/JSStack.cpp: 18 (JSC::JSStack::JSStack): 19 (JSC::JSStack::growSlowCase): 20 (JSC::JSStack::releaseExcessCapacity): 21 (JSC::JSStack::setReservedZoneSize): 22 * interpreter/JSStack.h: 23 * interpreter/JSStackInlines.h: 24 (JSC::JSStack::shrink): 25 * runtime/ErrorHandlingScope.cpp: 26 (JSC::ErrorHandlingScope::ErrorHandlingScope): 27 (JSC::ErrorHandlingScope::~ErrorHandlingScope): 28 * runtime/ErrorHandlingScope.h: 29 * runtime/JSLock.cpp: 30 (JSC::JSLock::DropAllLocks::DropAllLocks): 31 (JSC::JSLock::DropAllLocks::~DropAllLocks): 32 * runtime/JSLock.h: 33 * runtime/Options.h: 34 * runtime/VM.cpp: 35 (JSC::VM::VM): 36 (JSC::VM::updateStackLimitWithReservedZoneSize): 37 * runtime/VM.h: 38 (JSC::VM::reservedZoneSize): 39 * runtime/VMEntryScope.cpp: 40 (JSC::VMEntryScope::VMEntryScope): 41 (JSC::VMEntryScope::~VMEntryScope): 42 * runtime/VMEntryScope.h: 43 1 44 2014-01-09 Mark Lam <mark.lam@apple.com> 2 45 -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.cpp
r161575 r161582 51 51 #if ENABLE(LLINT_C_LOOP) 52 52 , m_end(0) 53 , m_ hostZoneSizeInRegisters(0)53 , m_reservedZoneSizeInRegisters(0) 54 54 #endif 55 55 { … … 79 79 bool JSStack::growSlowCase(Register* newTopOfStack) 80 80 { 81 Register* newTopOfStackWith HostZone = newTopOfStack - m_hostZoneSizeInRegisters;81 Register* newTopOfStackWithReservedZone = newTopOfStack - m_reservedZoneSizeInRegisters; 82 82 83 83 // If we have already committed enough memory to satisfy this request, 84 84 // just update the end pointer and return. 85 if (newTopOfStackWith HostZone >= m_commitTop) {85 if (newTopOfStackWithReservedZone >= m_commitTop) { 86 86 setStackLimit(newTopOfStack); 87 87 return true; … … 91 91 // have it is still within our budget. If not, we'll fail to grow and 92 92 // return false. 93 ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWith HostZone);93 ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithReservedZone); 94 94 delta = WTF::roundUpToMultipleOf(commitSize, delta); 95 95 Register* newCommitTop = m_commitTop - (delta / sizeof(Register)); … … 131 131 void JSStack::releaseExcessCapacity() 132 132 { 133 Register* highAddressWith HostZone = highAddress() - m_hostZoneSizeInRegisters;134 ptrdiff_t delta = reinterpret_cast<char*>(highAddressWith HostZone) - reinterpret_cast<char*>(m_commitTop);133 Register* highAddressWithReservedZone = highAddress() - m_reservedZoneSizeInRegisters; 134 ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithReservedZone) - reinterpret_cast<char*>(m_commitTop); 135 135 m_reservation.decommit(m_commitTop, delta); 136 136 addToCommittedByteCount(-delta); 137 m_commitTop = highAddressWith HostZone;137 m_commitTop = highAddressWithReservedZone; 138 138 } 139 139 … … 150 150 } 151 151 152 void JSStack::set HostZoneSize(size_t hostZoneSize)152 void JSStack::setReservedZoneSize(size_t reservedZoneSize) 153 153 { 154 m_ hostZoneSizeInRegisters = hostZoneSize / sizeof(Register);155 if (m_commitTop >= (m_end + 1) - m_ hostZoneSizeInRegisters)154 m_reservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register); 155 if (m_commitTop >= (m_end + 1) - m_reservedZoneSizeInRegisters) 156 156 growSlowCase(m_end + 1); 157 157 } -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStack.h
r161575 r161582 108 108 static void initializeThreading(); 109 109 110 void set HostZoneSize(size_t);110 void setReservedZoneSize(size_t); 111 111 112 112 CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee); … … 175 175 PageReservation m_reservation; 176 176 Register* m_lastStackTop; 177 ptrdiff_t m_ hostZoneSizeInRegisters;177 ptrdiff_t m_reservedZoneSizeInRegisters; 178 178 #endif // ENABLE(LLINT_C_LOOP) 179 179 -
branches/jsCStack/Source/JavaScriptCore/interpreter/JSStackInlines.h
r161575 r161582 162 162 // assign the constant to a local variable, and use the local instead. 163 163 ptrdiff_t maxExcessCapacity = JSStack::maxExcessCapacity; 164 ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_ hostZoneSizeInRegisters);164 ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_reservedZoneSizeInRegisters); 165 165 if (m_end == baseOfStack() && (highAddress() - m_commitTop) >= maxExcessInRegisters) 166 166 releaseExcessCapacity(); -
branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r161409 r161582 231 231 storep sp, VM::stackPointerAtVMEntry[vm] 232 232 233 # The stack hostzone ensures that we have adequate space for the233 # The stack reserved zone ensures that we have adequate space for the 234 234 # VMEntrySentinelFrame. Proceed with allocating and initializing the 235 235 # sentinel frame. -
branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r161575 r161582 122 122 checkStackPointerAlignment(temp2, 0xbad0dc01) 123 123 124 # The stack hostzone ensures that we have adequate space for the124 # The stack reserved zone ensures that we have adequate space for the 125 125 # VMEntrySentinelFrame. Proceed with allocating and initializing the 126 126 # sentinel frame. -
branches/jsCStack/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp
r161575 r161582 38 38 if (!m_vm.stackPointerAtVMEntry) 39 39 m_vm.stackPointerAtVMEntry = this; 40 size_t new HostZoneSize = Options::errorModeHostZoneSize();41 m_saved HostZoneSize = m_vm.updateStackLimitWithHostZoneSize(newHostZoneSize);40 size_t newReservedZoneSize = Options::errorModeReservedZoneSize(); 41 m_savedReservedZoneSize = m_vm.updateStackLimitWithReservedZoneSize(newReservedZoneSize); 42 42 #if ENABLE(LLINT_C_LOOP) 43 m_vm.interpreter->stack().set HostZoneSize(newHostZoneSize);43 m_vm.interpreter->stack().setReservedZoneSize(newReservedZoneSize); 44 44 #endif 45 45 } … … 49 49 if (m_vm.stackPointerAtVMEntry == this) 50 50 m_vm.stackPointerAtVMEntry = nullptr; 51 m_vm.updateStackLimitWith HostZoneSize(m_savedHostZoneSize);51 m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize); 52 52 #if ENABLE(LLINT_C_LOOP) 53 m_vm.interpreter->stack().set HostZoneSize(m_savedHostZoneSize);53 m_vm.interpreter->stack().setReservedZoneSize(m_savedReservedZoneSize); 54 54 #endif 55 55 } -
branches/jsCStack/Source/JavaScriptCore/runtime/ErrorHandlingScope.h
r161575 r161582 37 37 private: 38 38 VM& m_vm; 39 size_t m_saved HostZoneSize;39 size_t m_savedReservedZoneSize; 40 40 }; 41 41 -
branches/jsCStack/Source/JavaScriptCore/runtime/JSLock.cpp
r161575 r161582 291 291 SpinLockHolder holder(&spinLock); 292 292 #endif 293 m_saved HostZoneSize = m_vm->hostZoneSize();293 m_savedReservedZoneSize = m_vm->reservedZoneSize(); 294 294 m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry; 295 295 m_vm->stackPointerAtVMEntry = nullptr; … … 311 311 SpinLockHolder holder(&spinLock); 312 312 #endif 313 m_saved HostZoneSize = m_vm->hostZoneSize();313 m_savedReservedZoneSize = m_vm->reservedZoneSize(); 314 314 m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry; 315 315 m_vm->stackPointerAtVMEntry = nullptr; … … 332 332 333 333 m_vm->stackPointerAtVMEntry = m_savedStackPointerAtVMEntry; 334 m_vm->updateStackLimitWith HostZoneSize(m_savedHostZoneSize);334 m_vm->updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize); 335 335 } 336 336 -
branches/jsCStack/Source/JavaScriptCore/runtime/JSLock.h
r161575 r161582 111 111 intptr_t m_lockCount; 112 112 RefPtr<VM> m_vm; 113 size_t m_saved HostZoneSize;113 size_t m_savedReservedZoneSize; 114 114 void* m_savedStackPointerAtVMEntry; 115 115 }; -
branches/jsCStack/Source/JavaScriptCore/runtime/Options.h
r161575 r161582 97 97 \ 98 98 v(unsigned, maxPerThreadStackUsage, 4 * MB) \ 99 v(unsigned, hostZoneSize, 128 * KB) \100 v(unsigned, errorMode HostZoneSize, 64 * KB) \99 v(unsigned, reservedZoneSize, 128 * KB) \ 100 v(unsigned, errorModeReservedZoneSize, 64 * KB) \ 101 101 \ 102 102 v(bool, crashIfCantAllocateJITMemory, false) \ -
branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp
r161575 r161582 230 230 interpreter = new Interpreter(*this); 231 231 StackBounds stack = wtfThreadData().stack(); 232 updateStackLimitWith HostZoneSize(Options::hostZoneSize());232 updateStackLimitWithReservedZoneSize(Options::reservedZoneSize()); 233 233 #if ENABLE(LLINT_C_LOOP) 234 interpreter->stack().set HostZoneSize(Options::hostZoneSize());234 interpreter->stack().setReservedZoneSize(Options::reservedZoneSize()); 235 235 #endif 236 236 setLastStackTop(stack.origin()); … … 716 716 } 717 717 718 size_t VM::updateStackLimitWith HostZoneSize(size_t hostZoneSize)719 { 720 size_t old HostZoneSize = m_hostZoneSize;721 m_ hostZoneSize = hostZoneSize;718 size_t VM::updateStackLimitWithReservedZoneSize(size_t reservedZoneSize) 719 { 720 size_t oldReservedZoneSize = m_reservedZoneSize; 721 m_reservedZoneSize = reservedZoneSize; 722 722 723 723 void* stackLimit; … … 725 725 ASSERT(wtfThreadData().stack().isGrowingDownward()); 726 726 char* startOfStack = reinterpret_cast<char*>(stackPointerAtVMEntry); 727 char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + hostZoneSize;728 stackLimit = wtfThreadData().stack().recursionLimit( hostZoneSize, desiredStackLimit);727 char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + reservedZoneSize; 728 stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize, desiredStackLimit); 729 729 } else 730 stackLimit = wtfThreadData().stack().recursionLimit( hostZoneSize);730 stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize); 731 731 732 732 setStackLimit(stackLimit); 733 return old HostZoneSize;733 return oldReservedZoneSize; 734 734 } 735 735 -
branches/jsCStack/Source/JavaScriptCore/runtime/VM.h
r161575 r161582 376 376 JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*); 377 377 378 size_t hostZoneSize() const { return m_hostZoneSize; }379 size_t updateStackLimitWith HostZoneSize(size_t hostZoneSize);378 size_t reservedZoneSize() const { return m_reservedZoneSize; } 379 size_t updateStackLimitWithReservedZoneSize(size_t reservedZoneSize); 380 380 381 381 void** addressOfJSStackLimit() { return &m_jsStackLimit; } … … 514 514 const ClassInfo* m_initializingObjectClass; 515 515 #endif 516 size_t m_ hostZoneSize;516 size_t m_reservedZoneSize; 517 517 #if ENABLE(LLINT_C_LOOP) 518 518 struct { -
branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp
r161575 r161582 52 52 if (!vm.stackPointerAtVMEntry) { 53 53 vm.stackPointerAtVMEntry = this; 54 m_saved HostZoneSize = vm.updateStackLimitWithHostZoneSize(Options::hostZoneSize());54 m_savedReservedZoneSize = vm.updateStackLimitWithReservedZoneSize(Options::reservedZoneSize()); 55 55 } 56 56 … … 65 65 if (m_vm.stackPointerAtVMEntry == this) { 66 66 m_vm.stackPointerAtVMEntry = nullptr; 67 m_vm.updateStackLimitWith HostZoneSize(m_savedHostZoneSize);67 m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize); 68 68 } 69 69 } -
branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.h
r161575 r161582 47 47 StackStats::CheckPoint m_stackCheckPoint; 48 48 JSGlobalObject* m_globalObject; 49 size_t m_saved HostZoneSize;49 size_t m_savedReservedZoneSize; 50 50 }; 51 51
Note:
See TracChangeset
for help on using the changeset viewer.