Changeset 160890 in webkit
- Timestamp:
- Dec 19, 2013 6:38:00 PM (10 years ago)
- Location:
- branches/jsCStack/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/jsCStack/Source/JavaScriptCore/ChangeLog
r160874 r160890 1 2013-12-19 Mark Lam <mark.lam@apple.com> 2 3 CStack: The JIT does not need a slow path stack check. 4 https://bugs.webkit.org/show_bug.cgi?id=126036. 5 6 Reviewed by Geoffrey Garen. 7 8 The JIT uses the C stack which is not growable. If we fail a stack 9 check in the function header, then a stack overflow is imminent, and 10 there's no need to redo the check in the slow path helper. 11 12 Hence, renamed operationStackCheck() to operationThrowStackOverflowError() 13 and change the JIT and DFG code to use this appropriately. 14 15 * dfg/DFGJITCompiler.cpp: 16 (JSC::DFG::JITCompiler::compileFunction): 17 * jit/JIT.cpp: 18 (JSC::JIT::privateCompile): 19 * jit/JITOperations.cpp: 20 * jit/JITOperations.h: 21 1 22 2013-12-19 Michael Saboff <msaboff@apple.com> 2 23 -
branches/jsCStack/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r160835 r160890 328 328 // Plant a check that sufficient space is available in the JSStack. 329 329 addPtr(TrustedImm32(virtualRegisterForLocal(m_graph.requiredRegisterCountForExecutionAndExit() - 1).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1); 330 Jump stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), GPRInfo::regT1); 331 // Return here after stack check. 332 Label fromStackCheck = label(); 330 Jump stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), GPRInfo::regT1); 333 331 334 332 checkStackPointerAlignment(); … … 345 343 // === Function footer code generation === 346 344 // 347 // Generate code to perform the s low stack check (if the fast onein345 // Generate code to perform the stack overflow handling (if the stack check in 348 346 // the function header fails), and generate the entry point with arity check. 349 347 // 350 // Generate the stack check; if the fast check in the function head fails, 351 // we need to call out to a helper function to check whether more space is available. 352 // FIXME: change this from a cti call to a DFG style operation (normal C calling conventions). 353 stackCheck.link(this); 348 // Generate the stack overflow handling; if the stack check in the function head fails, 349 // we need to call out to a helper function to throw the StackOverflowError. 350 stackOverflow.link(this); 354 351 355 352 emitStoreCodeOrigin(CodeOrigin(0)); 356 m_speculative->callOperationWithCallFrameRollbackOnException(operationStackCheck, m_codeBlock); 357 jump(fromStackCheck); 353 m_speculative->callOperationWithCallFrameRollbackOnException(operationThrowStackOverflowError, m_codeBlock); 358 354 359 355 // The fast entry point into a function does not check the correct number of arguments -
branches/jsCStack/Source/JavaScriptCore/jit/JIT.cpp
r160835 r160890 520 520 #endif 521 521 522 Jump stack Check;522 Jump stackOverflow; 523 523 if (m_codeBlock->codeType() == FunctionCode) { 524 524 #if ENABLE(VALUE_PROFILER) … … 543 543 544 544 addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, regT1); 545 stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1); 546 } 547 548 Label functionBody = label(); 545 stackOverflow = branchPtr(Above, AbsoluteAddress(m_vm->addressOfJSStackLimit()), regT1); 546 } 549 547 550 548 checkStackPointerAlignment(); … … 561 559 Label arityCheck; 562 560 if (m_codeBlock->codeType() == FunctionCode) { 563 stack Check.link(this);561 stackOverflow.link(this); 564 562 m_bytecodeOffset = 0; 565 // FIXME: CStack - This may need to have some stack space allocated to make the call 566 callOperationWithCallFrameRollbackOnException(operationStackCheck, m_codeBlock); 567 #ifndef NDEBUG 568 m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs. 569 #endif 570 jump(functionBody); 563 callOperationWithCallFrameRollbackOnException(operationThrowStackOverflowError, m_codeBlock); 571 564 572 565 arityCheck = label(); -
branches/jsCStack/Source/JavaScriptCore/jit/JITOperations.cpp
r160874 r160890 71 71 72 72 73 void JIT_OPERATION operation StackCheck(ExecState* exec, CodeBlock* codeBlock)73 void JIT_OPERATION operationThrowStackOverflowError(ExecState* exec, CodeBlock* codeBlock) 74 74 { 75 75 // We pass in our own code block, because the callframe hasn't been populated. … … 80 80 81 81 NativeCallFrameTracer tracer(vm, callerFrame); 82 83 #if ENABLE(LLINT_CLOOP) 84 JSStack& stack = vm->interpreter->stack(); 85 86 if (UNLIKELY(!stack.grow(&exec->registers()[codeBlock->stackPointerOffset()]))) 87 vm->throwException(callerFrame, createStackOverflowError(callerFrame)); 88 #else 89 if (!exec->vm().isSafeToRecurse(codeBlock->frameRegisterCount() * sizeof(Register))) 90 vm->throwException(callerFrame, createStackOverflowError(callerFrame)); 91 #endif // ENABLE(LLINT_CLOOP) 82 vm->throwException(callerFrame, createStackOverflowError(callerFrame)); 92 83 } 93 84 -
branches/jsCStack/Source/JavaScriptCore/jit/JITOperations.h
r160867 r160890 188 188 void JIT_OPERATION operationVMHandleException(ExecState*) WTF_INTERNAL; 189 189 190 void JIT_OPERATION operation StackCheck(ExecState*, CodeBlock*) WTF_INTERNAL;190 void JIT_OPERATION operationThrowStackOverflowError(ExecState*, CodeBlock*) WTF_INTERNAL; 191 191 int32_t JIT_OPERATION operationCallArityCheck(ExecState*) WTF_INTERNAL; 192 192 int32_t JIT_OPERATION operationConstructArityCheck(ExecState*) WTF_INTERNAL;
Note: See TracChangeset
for help on using the changeset viewer.