Changeset 188555 in webkit
- Timestamp:
- Aug 17, 2015, 4:58:00 PM (10 years ago)
- Location:
- branches/jsc-tailcall/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/jsc-tailcall/Source/JavaScriptCore/ChangeLog
r188318 r188555 1 2015-08-17 Michael Saboff <msaboff@apple.com> 2 3 jsc-tailcall: Handling exception in caller frame cannot unwind past VMEntry frame 4 https://bugs.webkit.org/show_bug.cgi?id=148076 5 6 Reviewed by Basile Clement. 7 8 When we are unwinding from our caller, we need to check if we are the top JavaScript entry frame. 9 If so, we don't need to unwind any further, we just process as an unhandled exception. 10 Moved the processing of "unwind from caller frame" into genericUnwind(). Added an enum parameter 11 to indicate whether or not we start unwinding from the current frame or caller's frame. 12 In the case of the LLInt, we now handle a stack overflow exception from the current frame and not 13 the caller's frame. This is needed because the unwind code needs to restore the callee saves 14 that the LLInt has saved, namely the PC register which is needed to make slow path calls. 15 16 * interpreter/CallFrame.cpp: 17 (JSC::CallFrame::callerFrameIsVMEntryFrame): 18 * interpreter/CallFrame.h: 19 (JSC::CallFrame::callerFrameIsVMEntryFrame): 20 New helper function to determine if we are the top JavaScript frame. 21 22 * jit/JITExceptions.cpp: 23 (JSC::genericUnwind): 24 * jit/JITExceptions.h: 25 Added enum parameter to genericUnwind() to indicate if we are unwinding from the current or 26 caller frame. 27 28 * jit/JITOperations.cpp: 29 (JSC:lookupExceptionHandlerFromCallerFrame): Moved the caller frame processing to genericUnwind(). 30 31 * llint/LLIntSlowPaths.cpp: 32 (JSC::LLInt::llint_stack_check): Changed to process the exception in the current frame. 33 34 * llint/LowLevelInterpreter.asm: 35 Made sure to account for calle save register space when making a call to llint_stack_check. 36 1 37 2015-08-11 Basile Clement <basile_clement@apple.com> 2 38 -
branches/jsc-tailcall/Source/JavaScriptCore/interpreter/CallFrame.cpp
r187791 r188555 147 147 } 148 148 149 bool CallFrame::callerFrameIsVMEntryFrame(VMEntryFrame* vmEntryFrame) 150 { 151 return callerFrameOrVMEntryFrame() == vmEntryFrame; 152 } 153 149 154 JSLexicalEnvironment* CallFrame::lexicalEnvironment() const 150 155 { -
branches/jsc-tailcall/Source/JavaScriptCore/interpreter/CallFrame.h
r185487 r188555 100 100 JS_EXPORT_PRIVATE CallFrame* callerFrame(VMEntryFrame*&); 101 101 102 bool callerFrameIsVMEntryFrame(VMEntryFrame*); 103 102 104 static ptrdiff_t callerFrameOffset() { return OBJECT_OFFSETOF(CallerFrameAndPC, callerFrame); } 103 105 -
branches/jsc-tailcall/Source/JavaScriptCore/jit/JITExceptions.cpp
r185259 r188555 41 41 namespace JSC { 42 42 43 void genericUnwind(VM* vm, ExecState* callFrame )43 void genericUnwind(VM* vm, ExecState* callFrame, UnwindStart unwindStart) 44 44 { 45 45 if (Options::breakOnThrow()) { … … 51 51 RELEASE_ASSERT(exception); 52 52 VMEntryFrame* vmEntryFrame = vm->topVMEntryFrame; 53 54 if (unwindStart == UnwindFromCallerFrame) { 55 if (callFrame->callerFrameIsVMEntryFrame(vmEntryFrame)) { 56 // If we are unwinding from our caller and our caller is a VMEntryFrame, we don't need to unwind. 57 // We can go straight to handleUncaughtException. 58 vm->vmEntryFrameForThrow = vmEntryFrame; 59 vm->callFrameForThrow = callFrame; 60 vm->targetMachinePCForThrow = LLInt::getCodePtr(handleUncaughtException); 61 vm->targetInterpreterPCForThrow = nullptr; 62 63 return; 64 } 65 66 // Start unwinding from our caller's frame. 67 callFrame = callFrame->callerFrame(); 68 vm->topCallFrame = callFrame; 69 } 53 70 HandlerInfo* handler = vm->interpreter->unwind(vmEntryFrame, callFrame, exception); // This may update vmEntryFrame and callFrame. 54 71 -
branches/jsc-tailcall/Source/JavaScriptCore/jit/JITExceptions.h
r185259 r188555 34 34 class VM; 35 35 36 void genericUnwind(VM*, ExecState*); 36 enum UnwindStart { UnwindFromCurrentFrame, UnwindFromCallerFrame }; 37 38 void genericUnwind(VM*, ExecState*, UnwindStart unwindStart = UnwindFromCurrentFrame); 37 39 38 40 } // namespace JSC -
branches/jsc-tailcall/Source/JavaScriptCore/jit/JITOperations.cpp
r187639 r188555 1937 1937 void JIT_OPERATION lookupExceptionHandlerFromCallerFrame(VM* vm, ExecState* exec) 1938 1938 { 1939 VMEntryFrame* vmEntryFrame = vm->topVMEntryFrame; 1940 CallFrame* callerFrame = exec->callerFrame(vmEntryFrame); 1941 ASSERT(callerFrame); 1942 1943 NativeCallFrameTracerWithRestore tracer(vm, vmEntryFrame, callerFrame); 1944 genericUnwind(vm, callerFrame); 1939 NativeCallFrameTracer tracer(vm, exec); 1940 genericUnwind(vm, exec, UnwindFromCallerFrame); 1945 1941 ASSERT(vm->targetMachinePCForThrow); 1946 1942 } -
branches/jsc-tailcall/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r186606 r188555 484 484 vm.topCallFrame = exec; 485 485 ErrorHandlingScope errorScope(vm); 486 CommonSlowPaths::interpreterThrowInCaller(exec, createStackOverflowError(exec));487 pc = returnToThrow ForThrownException(exec);486 vm.throwException(exec, createStackOverflowError(exec)); 487 pc = returnToThrow(exec); 488 488 LLINT_RETURN_TWO(pc, exec); 489 489 } -
branches/jsc-tailcall/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r188318 r188555 227 227 const CalleeSaveSpaceAsVirtualRegisters = 0 228 228 end 229 230 const CalleeSaveSpaceStackAligned = (CalleeSaveSpaceAsVirtualRegisters * SlotSize + StackAlignment - 1) & ~StackAlignmentMask 231 229 232 230 233 # Watchpoint states … … 917 920 918 921 # Stack height check failed - need to call a slow_path. 919 subp maxFrameExtentForSlowPathCall, sp # Set up temporary stack pointer for call 922 # Set up temporary stack pointer for call including callee saves 923 subp maxFrameExtentForSlowPathCall + CalleeSaveSpaceStackAligned, sp 920 924 callSlowPath(_llint_stack_check) 921 925 bpeq r1, 0, .stackHeightOKGetCodeBlock
Note:
See TracChangeset
for help on using the changeset viewer.