Changeset 235419 in webkit
- Timestamp:
- Aug 27, 2018, 10:01:05 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r235356 r235419 1 2018-08-27 Mark Lam <mark.lam@apple.com> 2 3 Fix exception throwing code so that topCallFrame and topEntryFrame stay true to their names. 4 https://bugs.webkit.org/show_bug.cgi?id=188577 5 <rdar://problem/42985684> 6 7 Reviewed by Saam Barati. 8 9 * stress/regress-188577.js: Added. 10 1 11 2018-08-24 Yusuke Suzuki <yusukesuzuki@slowstart.org> 2 12 -
trunk/LayoutTests/ChangeLog
r235417 r235419 1 2018-08-27 Mark Lam <mark.lam@apple.com> 2 3 Fix exception throwing code so that topCallFrame and topEntryFrame stay true to their names. 4 https://bugs.webkit.org/show_bug.cgi?id=188577 5 <rdar://problem/42985684> 6 7 Reviewed by Saam Barati. 8 9 * http/tests/misc/large-js-program-expected.txt: 10 1 11 2018-08-27 Justin Fan <justin_fan@apple.com> 2 12 -
trunk/LayoutTests/http/tests/misc/large-js-program-expected.txt
r231717 r235419 1 CONSOLE MESSAGE: line 27:RangeError: Maximum call stack size exceeded.1 CONSOLE MESSAGE: RangeError: Maximum call stack size exceeded. 2 2 This tests verifies that a large program doesn't crash JavaScript. 3 3 -
trunk/Source/JavaScriptCore/CMakeLists.txt
r235271 r235419 613 613 interpreter/AbstractPC.h 614 614 interpreter/CallFrame.h 615 interpreter/CallFrameInlines.h 615 616 interpreter/CalleeBits.h 617 interpreter/EntryFrame.h 616 618 interpreter/FrameTracers.h 617 619 interpreter/Register.h -
trunk/Source/JavaScriptCore/ChangeLog
r235412 r235419 1 2018-08-27 Mark Lam <mark.lam@apple.com> 2 3 Fix exception throwing code so that topCallFrame and topEntryFrame stay true to their names. 4 https://bugs.webkit.org/show_bug.cgi?id=188577 5 <rdar://problem/42985684> 6 7 Reviewed by Saam Barati. 8 9 1. Introduced CallFrame::convertToStackOverflowFrame() which converts the current 10 (top) CallFrame (which may not have a valid callee) into a StackOverflowFrame. 11 12 The StackOverflowFrame is a sentinel frame that the low level code (exception 13 throwing code, stack visitor, and stack unwinding code) will know to skip 14 over. The StackOverflowFrame will also have a valid JSCallee so that client 15 code can compute the globalObject or VM from this frame. 16 17 As a result, client code that throws StackOverflowErrors no longer need to 18 compute the caller frame to throw from: it just converts the top frame into 19 a StackOverflowFrame and everything should *Just Work*. 20 21 2. NativeCallFrameTracerWithRestore is now obsolete. 22 23 Instead, client code should always call convertToStackOverflowFrame() on the 24 frame before instantiating a NativeCallFrameTracer with it. 25 26 This means that topCallFrame will always point to the top CallFrame (which 27 may be a StackOverflowFrame), and topEntryFrame will always point to the top 28 EntryFrame. We'll never temporarily point them to the previous EntryFrame 29 (which we used to do with NativeCallFrameTracerWithRestore). 30 31 3. genericUnwind() and Interpreter::unwind() will now always unwind from the top 32 CallFrame, and will know how to handle a StackOverflowFrame if they see one. 33 34 This obsoletes the UnwindStart flag. 35 36 * CMakeLists.txt: 37 * JavaScriptCore.xcodeproj/project.pbxproj: 38 * Sources.txt: 39 * debugger/Debugger.cpp: 40 (JSC::Debugger::pauseIfNeeded): 41 * interpreter/CallFrame.cpp: 42 (JSC::CallFrame::callerFrame const): 43 (JSC::CallFrame::unsafeCallerFrame const): 44 (JSC::CallFrame::convertToStackOverflowFrame): 45 (JSC::CallFrame::callerFrame): Deleted. 46 (JSC::CallFrame::unsafeCallerFrame): Deleted. 47 * interpreter/CallFrame.h: 48 (JSC::ExecState::iterate): 49 * interpreter/CallFrameInlines.h: Added. 50 (JSC::CallFrame::isStackOverflowFrame const): 51 (JSC::CallFrame::isWasmFrame const): 52 * interpreter/EntryFrame.h: Added. 53 (JSC::EntryFrame::vmEntryRecordOffset): 54 (JSC::EntryFrame::calleeSaveRegistersBufferOffset): 55 * interpreter/FrameTracers.h: 56 (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): Deleted. 57 (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): Deleted. 58 * interpreter/Interpreter.cpp: 59 (JSC::Interpreter::unwind): 60 * interpreter/Interpreter.h: 61 * interpreter/StackVisitor.cpp: 62 (JSC::StackVisitor::StackVisitor): 63 * interpreter/StackVisitor.h: 64 (JSC::StackVisitor::visit): 65 (JSC::StackVisitor::topEntryFrameIsEmpty const): 66 * interpreter/VMEntryRecord.h: 67 (JSC::VMEntryRecord::callee const): 68 (JSC::EntryFrame::vmEntryRecordOffset): Deleted. 69 (JSC::EntryFrame::calleeSaveRegistersBufferOffset): Deleted. 70 * jit/AssemblyHelpers.h: 71 * jit/JITExceptions.cpp: 72 (JSC::genericUnwind): 73 * jit/JITExceptions.h: 74 * jit/JITOperations.cpp: 75 * llint/LLIntOffsetsExtractor.cpp: 76 * llint/LLIntSlowPaths.cpp: 77 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 78 * llint/LowLevelInterpreter.asm: 79 * llint/LowLevelInterpreter32_64.asm: 80 * llint/LowLevelInterpreter64.asm: 81 * runtime/CallData.cpp: 82 * runtime/CommonSlowPaths.cpp: 83 (JSC::throwArityCheckStackOverflowError): 84 (JSC::SLOW_PATH_DECL): 85 * runtime/CommonSlowPathsExceptions.cpp: Removed. 86 * runtime/CommonSlowPathsExceptions.h: Removed. 87 * runtime/Completion.cpp: 88 (JSC::evaluateWithScopeExtension): 89 * runtime/JSGeneratorFunction.h: 90 * runtime/JSGlobalObject.cpp: 91 (JSC::JSGlobalObject::init): 92 (JSC::JSGlobalObject::visitChildren): 93 * runtime/JSGlobalObject.h: 94 (JSC::JSGlobalObject::stackOverflowFrameCallee const): 95 * runtime/VM.cpp: 96 (JSC::VM::throwException): 97 * runtime/VM.h: 98 * runtime/VMInlines.h: 99 (JSC::VM::topJSCallFrame const): 100 1 101 2018-08-27 Keith Rollin <krollin@apple.com> 2 102 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r235177 r235419 1077 1077 6514F21918B3E1670098FF8B /* Bytecodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6514F21718B3E1670098FF8B /* Bytecodes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1078 1078 65303D641447B9E100D3F904 /* ParserTokens.h in Headers */ = {isa = PBXBuildFile; fileRef = 65303D631447B9E100D3F904 /* ParserTokens.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1079 6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553A33017A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h */; };1080 1079 65570F5A1AA4C3EA009B3C23 /* Regress141275.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65570F591AA4C00A009B3C23 /* Regress141275.mm */; }; 1081 1080 657CF45919BF6662004ACBF2 /* JSCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = 657CF45719BF6662004ACBF2 /* JSCallee.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1750 1749 E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */ = {isa = PBXBuildFile; fileRef = E49DC14912EF261A00184A1F /* SourceProviderCacheItem.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1751 1750 FE05FAFD1FE4CEDA00093230 /* DeprecatedInspectorValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 992D6A111FBD491D000245F4 /* DeprecatedInspectorValues.cpp */; }; 1751 FE086BCA2123DEFB003F2929 /* EntryFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = FE086BC92123DEFA003F2929 /* EntryFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1752 1752 FE0D4A061AB8DD0A002F54BF /* ExecutionTimeLimitTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE0D4A041AB8DD0A002F54BF /* ExecutionTimeLimitTest.cpp */; }; 1753 1753 FE0D4A091ABA2437002F54BF /* GlobalContextWithFinalizerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE0D4A071ABA2437002F54BF /* GlobalContextWithFinalizerTest.cpp */; }; … … 1801 1801 FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1802 1802 FEA0C4031CDD7D1D00481991 /* FunctionWhitelist.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0C4011CDD7D0E00481991 /* FunctionWhitelist.h */; }; 1803 FEA3BBA8212B655900E93AD1 /* CallFrameInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1803 1804 FEA3BBAC212C97CB00E93AD1 /* DFGCFG.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA3BBAB212C97CB00E93AD1 /* DFGCFG.h */; }; 1804 1805 FEB51F6C1A97B688001F921C /* Regress141809.mm in Sources */ = {isa = PBXBuildFile; fileRef = FEB51F6B1A97B688001F921C /* Regress141809.mm */; }; … … 3565 3566 65525FC31A6DD3B3007B5495 /* NullSetterFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NullSetterFunction.cpp; sourceTree = "<group>"; }; 3566 3567 65525FC41A6DD3B3007B5495 /* NullSetterFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullSetterFunction.h; sourceTree = "<group>"; }; 3567 6553A32F17A1F1EE008CF6F3 /* CommonSlowPathsExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommonSlowPathsExceptions.cpp; sourceTree = "<group>"; };3568 6553A33017A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonSlowPathsExceptions.h; sourceTree = "<group>"; };3569 3568 65570F581AA4C00A009B3C23 /* Regress141275.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Regress141275.h; path = API/tests/Regress141275.h; sourceTree = "<group>"; }; 3570 3569 65570F591AA4C00A009B3C23 /* Regress141275.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Regress141275.mm; path = API/tests/Regress141275.mm; sourceTree = "<group>"; }; … … 4679 4678 F692A8870255597D01FF60F7 /* JSCJSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCJSValue.cpp; sourceTree = "<group>"; tabWidth = 8; }; 4680 4679 F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSourceCode.cpp; sourceTree = "<group>"; }; 4680 FE086BC92123DEFA003F2929 /* EntryFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntryFrame.h; sourceTree = "<group>"; }; 4681 4681 FE0D4A041AB8DD0A002F54BF /* ExecutionTimeLimitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExecutionTimeLimitTest.cpp; path = API/tests/ExecutionTimeLimitTest.cpp; sourceTree = "<group>"; }; 4682 4682 FE0D4A051AB8DD0A002F54BF /* ExecutionTimeLimitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExecutionTimeLimitTest.h; path = API/tests/ExecutionTimeLimitTest.h; sourceTree = "<group>"; }; … … 4767 4767 FEA0C4001CDD7D0E00481991 /* FunctionWhitelist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionWhitelist.cpp; sourceTree = "<group>"; }; 4768 4768 FEA0C4011CDD7D0E00481991 /* FunctionWhitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionWhitelist.h; sourceTree = "<group>"; }; 4769 FEA3BBAB212C97CB00E93AD1 /* DFGCFG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCFG.h; path = dfg/DFGCFG.h; sourceTree = "<group>"; }; 4769 FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameInlines.h; sourceTree = "<group>"; }; 4770 FEA3BBAB212C97CB00E93AD1 /* DFGCFG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGCFG.h; sourceTree = "<group>"; }; 4770 4771 FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerARM64.cpp; sourceTree = "<group>"; }; 4771 4772 FEB41CCB1F73284200C5481E /* ProbeFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProbeFrame.h; sourceTree = "<group>"; }; … … 5502 5503 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */, 5503 5504 1429D8DC0ED2205B00B89619 /* CallFrame.h */, 5505 FEA3BBA7212B655800E93AD1 /* CallFrameInlines.h */, 5504 5506 A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */, 5505 5507 1429D85B0ED218E900B89619 /* CLoopStack.cpp */, 5506 5508 14D792640DAA03FB001A9F05 /* CLoopStack.h */, 5507 5509 A7C1EAEB17987AB600299DB2 /* CLoopStackInlines.h */, 5510 FE086BC92123DEFA003F2929 /* EntryFrame.h */, 5508 5511 E34EDBF61DB5FFC100DC87A5 /* FrameTracers.h */, 5509 5512 1429D7D30ED2128200B89619 /* Interpreter.cpp */, … … 6500 6503 A709F2F117A0AC2A00512E98 /* CommonSlowPaths.cpp */, 6501 6504 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */, 6502 6553A32F17A1F1EE008CF6F3 /* CommonSlowPathsExceptions.cpp */,6503 6553A33017A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h */,6504 6505 A7E5A3A51797432D00E893C0 /* CompilationResult.cpp */, 6505 6506 A7E5A3A61797432D00E893C0 /* CompilationResult.h */, … … 8434 8435 99DA00A41BD5993100F4575C /* builtins_model.py in Headers */, 8435 8436 99DA00A51BD5993100F4575C /* builtins_templates.py in Headers */, 8437 FEA3BBA8212B655900E93AD1 /* CallFrameInlines.h in Headers */, 8436 8438 41DEA1321B9F3163006D65DD /* BuiltinUtils.h in Headers */, 8437 8439 9E72940B190F0514001A91B5 /* BundlePath.h in Headers */, … … 8495 8497 BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */, 8496 8498 0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */, 8497 6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */,8498 8499 A7E5A3A81797432D00E893C0 /* CompilationResult.h in Headers */, 8499 8500 0F4F11E8209BCDAB00709654 /* CompilerTimingScope.h in Headers */, … … 9085 9086 C2A7F688160432D400F76B98 /* JSDestructibleObject.h in Headers */, 9086 9087 0F7DF13C1E2971130095951B /* JSDestructibleObjectHeapCellType.h in Headers */, 9088 FE086BCA2123DEFB003F2929 /* EntryFrame.h in Headers */, 9087 9089 FE384EE61ADDB7AD0055DE2C /* JSDollarVM.h in Headers */, 9088 9090 86E3C614167BABD7006D760A /* JSExport.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r234713 r235419 716 716 runtime/CommonIdentifiers.cpp 717 717 runtime/CommonSlowPaths.cpp 718 runtime/CommonSlowPathsExceptions.cpp719 718 runtime/CompilationResult.cpp 720 719 tools/CompilerTimingScope.cpp -
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r235254 r235419 1 1 /* 2 * Copyright (C) 2008-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2008-2018 Apple Inc. All rights reserved. 3 3 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 4 4 * Copyright (C) 2001 Peter Kelly (pmk@post.com) … … 687 687 VM& vm = m_vm; 688 688 auto scope = DECLARE_THROW_SCOPE(vm); 689 ASSERT(callFrame); 689 690 690 691 if (m_isPaused) -
trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp
r235254 r235419 1 1 /* 2 * Copyright (C) 2008-201 7Apple Inc. All Rights Reserved.2 * Copyright (C) 2008-2018 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 214 214 } 215 215 216 CallFrame* CallFrame::callerFrame(EntryFrame*& currEntryFrame) 216 CallFrame* CallFrame::callerFrame(EntryFrame*& currEntryFrame) const 217 217 { 218 218 if (callerFrameOrEntryFrame() == currEntryFrame) { … … 224 224 } 225 225 226 SUPPRESS_ASAN CallFrame* CallFrame::unsafeCallerFrame(EntryFrame*& currEntryFrame) 226 SUPPRESS_ASAN CallFrame* CallFrame::unsafeCallerFrame(EntryFrame*& currEntryFrame) const 227 227 { 228 228 if (unsafeCallerFrameOrEntryFrame() == currEntryFrame) { … … 338 338 } 339 339 340 void CallFrame::convertToStackOverflowFrame(VM& vm) 341 { 342 ASSERT(!isGlobalExec()); 343 344 EntryFrame* entryFrame = vm.topEntryFrame; 345 CallFrame* throwOriginFrame = this; 346 do { 347 throwOriginFrame = throwOriginFrame->callerFrame(entryFrame); 348 } while (throwOriginFrame && throwOriginFrame->callee().isWasm()); 349 350 JSObject* originCallee = throwOriginFrame ? throwOriginFrame->jsCallee() : vmEntryRecord(vm.topEntryFrame)->callee(); 351 JSObject* stackOverflowCallee = originCallee->globalObject()->stackOverflowFrameCallee(); 352 353 setCodeBlock(nullptr); 354 setCallee(stackOverflowCallee); 355 setArgumentCountIncludingThis(0); 356 } 357 340 358 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r235254 r235419 141 141 SUPPRESS_ASAN void* unsafeCallerFrameOrEntryFrame() const { return unsafeCallerFrameAndPC().callerFrame; } 142 142 143 CallFrame* unsafeCallerFrame(EntryFrame*&) ;144 JS_EXPORT_PRIVATE CallFrame* callerFrame(EntryFrame*&) ;143 CallFrame* unsafeCallerFrame(EntryFrame*&) const; 144 JS_EXPORT_PRIVATE CallFrame* callerFrame(EntryFrame*&) const; 145 145 146 146 JS_EXPORT_PRIVATE SourceOrigin callerSourceOrigin(); … … 257 257 } 258 258 259 void convertToStackOverflowFrame(VM&); 260 inline bool isStackOverflowFrame() const; 261 inline bool isWasmFrame() const; 262 259 263 void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[CallFrameSlot::argumentCount].payload() = count; } 260 264 void setCallee(JSObject* callee) { static_cast<Register*>(this)[CallFrameSlot::callee] = callee; } … … 269 273 // receiver. We should always be using StackVisitor directly. 270 274 // It's only valid to call this from a non-wasm top frame. 271 template < typename Functor> void iterate(const Functor& functor)275 template <StackVisitor::EmptyEntryFrameAction action = StackVisitor::ContinueIfTopEntryFrameIsEmpty, typename Functor> void iterate(const Functor& functor) 272 276 { 273 277 VM* vm; … … 278 282 } else 279 283 vm = nullptr; 280 StackVisitor::visit< Functor>(this, vm, functor);284 StackVisitor::visit<action, Functor>(this, vm, functor); 281 285 } 282 286 -
trunk/Source/JavaScriptCore/interpreter/FrameTracers.h
r227165 r235419 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 94 94 }; 95 95 96 class NativeCallFrameTracerWithRestore { 97 public: 98 ALWAYS_INLINE NativeCallFrameTracerWithRestore(VM* vm, EntryFrame* EntryFrame, CallFrame* callFrame) 99 : m_vm(vm) 100 { 101 ASSERT(vm); 102 ASSERT(callFrame); 103 assertStackPointerIsAligned(); 104 m_savedTopEntryFrame = vm->topEntryFrame; 105 m_savedTopCallFrame = vm->topCallFrame; 106 vm->topEntryFrame = EntryFrame; 107 vm->topCallFrame = callFrame; 108 } 109 110 ALWAYS_INLINE ~NativeCallFrameTracerWithRestore() 111 { 112 m_vm->topEntryFrame = m_savedTopEntryFrame; 113 m_vm->topCallFrame = m_savedTopCallFrame; 114 } 115 116 private: 117 VM* m_vm; 118 EntryFrame* m_savedTopEntryFrame; 119 CallFrame* m_savedTopCallFrame; 120 }; 121 122 } 96 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r235254 r235419 719 719 }; 720 720 721 NEVER_INLINE HandlerInfo* Interpreter::unwind(VM& vm, CallFrame*& callFrame, Exception* exception , UnwindStart unwindStart)721 NEVER_INLINE HandlerInfo* Interpreter::unwind(VM& vm, CallFrame*& callFrame, Exception* exception) 722 722 { 723 723 auto scope = DECLARE_CATCH_SCOPE(vm); 724 724 725 if (unwindStart == UnwindFromCallerFrame) { 726 if (callFrame->callerFrameOrEntryFrame() == vm.topEntryFrame) 727 return nullptr; 728 729 callFrame = callFrame->callerFrame(); 730 vm.topCallFrame = callFrame; 731 } 732 725 ASSERT(reinterpret_cast<void*>(callFrame) != vm.topEntryFrame); 733 726 CodeBlock* codeBlock = callFrame->codeBlock(); 734 727 … … 741 734 exceptionValue = jsNull(); 742 735 743 EXCEPTION_ASSERT_UNUSED(scope, scope.exception() && (!Options::exceptionStackTraceLimit() || scope.exception()->stack().size()));736 EXCEPTION_ASSERT_UNUSED(scope, scope.exception()); 744 737 745 738 // Calculate an exception handler vPC, unwinding call frames as necessary. 746 739 HandlerInfo* handler = nullptr; 747 740 UnwindFunctor functor(vm, callFrame, isTerminatedExecutionException(vm, exception), codeBlock, handler); 748 StackVisitor::visit (callFrame, &vm, functor);741 StackVisitor::visit<StackVisitor::TerminateIfTopEntryFrameIsEmpty>(callFrame, &vm, functor); 749 742 if (!handler) 750 743 return nullptr; -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r232314 r235419 65 65 struct UnlinkedInstruction; 66 66 67 enum UnwindStart : uint8_t { UnwindFromCurrentFrame, UnwindFromCallerFrame };68 69 67 enum DebugHookType { 70 68 WillExecuteProgram, … … 117 115 118 116 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); 119 120 NEVER_INLINE HandlerInfo* unwind(VM&, CallFrame*&, Exception* , UnwindStart);117 118 NEVER_INLINE HandlerInfo* unwind(VM&, CallFrame*&, Exception*); 121 119 void notifyDebuggerOfExceptionToBeThrown(VM&, CallFrame*, Exception*); 122 120 NEVER_INLINE void debug(CallFrame*, DebugHookType); -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp
r234082 r235419 1 1 /* 2 * Copyright (C) 2013 , 2015-2017Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 if (startFrame) { 46 46 ASSERT(vm); 47 ASSERT(!vm->topCallFrame || reinterpret_cast<void*>(vm->topCallFrame) != vm->topEntryFrame); 48 47 49 m_frame.m_entryFrame = vm->topEntryFrame; 48 50 topFrame = vm->topCallFrame; 49 50 if (topFrame && static_cast<void*>(m_frame.m_entryFrame) == static_cast<void*>(topFrame)) { 51 topFrame = vmEntryRecord(m_frame.m_entryFrame)->m_prevTopCallFrame; 52 m_frame.m_entryFrame = vmEntryRecord(m_frame.m_entryFrame)->m_prevTopEntryFrame; 51 52 if (topFrame && topFrame->isStackOverflowFrame()) { 53 topFrame = topFrame->callerFrame(m_frame.m_entryFrame); 54 m_topEntryFrameIsEmpty = (m_frame.m_entryFrame != vm->topEntryFrame); 55 if (startFrame == vm->topCallFrame) 56 startFrame = topFrame; 53 57 } 58 54 59 } else { 55 60 m_frame.m_entryFrame = 0; -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.h
r234082 r235419 1 1 /* 2 * Copyright (C) 2013-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #include "CalleeBits.h" 29 #include "VMEntryRecord.h"30 29 #include "WasmIndexOrName.h" 31 30 #include <wtf/Function.h> … … 36 35 37 36 struct CodeOrigin; 37 struct EntryFrame; 38 38 struct InlineCallFrame; 39 39 … … 137 137 // Status operator()(StackVisitor&) const; 138 138 139 template <typename Functor> 139 enum EmptyEntryFrameAction { 140 ContinueIfTopEntryFrameIsEmpty, 141 TerminateIfTopEntryFrameIsEmpty, 142 }; 143 144 template <EmptyEntryFrameAction action = ContinueIfTopEntryFrameIsEmpty, typename Functor> 140 145 static void visit(CallFrame* startFrame, VM* vm, const Functor& functor) 141 146 { 142 147 StackVisitor visitor(startFrame, vm); 148 if (action == TerminateIfTopEntryFrameIsEmpty && visitor.topEntryFrameIsEmpty()) 149 return; 143 150 while (visitor->callFrame()) { 144 151 Status status = functor(visitor); … … 153 160 void unwindToMachineCodeBlockFrame(); 154 161 162 bool topEntryFrameIsEmpty() const { return m_topEntryFrameIsEmpty; } 163 155 164 private: 156 165 JS_EXPORT_PRIVATE StackVisitor(CallFrame* startFrame, VM*); … … 165 174 166 175 Frame m_frame; 176 bool m_topEntryFrameIsEmpty { false }; 167 177 }; 168 178 -
trunk/Source/JavaScriptCore/interpreter/VMEntryRecord.h
r223738 r235419 1 1 /* 2 * Copyright (C) 2014-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 struct EntryFrame; 33 33 class ExecState; 34 class JSObject; 34 35 class VM; 35 36 … … 42 43 ExecState* m_prevTopCallFrame; 43 44 EntryFrame* m_prevTopEntryFrame; 45 JSObject* m_callee; 46 47 JSObject* callee() const { return m_callee; } 44 48 45 49 #if ENABLE(JIT) && NUMBER_OF_CALLEE_SAVES_REGISTERS > 0 … … 56 60 extern "C" VMEntryRecord* vmEntryRecord(EntryFrame*); 57 61 58 struct EntryFrame {59 #if ENABLE(JIT) && NUMBER_OF_CALLEE_SAVES_REGISTERS > 060 static ptrdiff_t vmEntryRecordOffset()61 {62 EntryFrame* fakeEntryFrame = reinterpret_cast<EntryFrame*>(0x1000);63 VMEntryRecord* record = vmEntryRecord(fakeEntryFrame);64 return static_cast<ptrdiff_t>(65 reinterpret_cast<char*>(record) - reinterpret_cast<char*>(fakeEntryFrame));66 }67 68 static ptrdiff_t calleeSaveRegistersBufferOffset()69 {70 return vmEntryRecordOffset() + OBJECT_OFFSETOF(VMEntryRecord, calleeSaveRegistersBuffer);71 }72 #endif73 };74 75 62 } // namespace JSC -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h
r232444 r235419 29 29 30 30 #include "CodeBlock.h" 31 #include "EntryFrame.h" 31 32 #include "FPRInfo.h" 32 33 #include "GPRInfo.h" -
trunk/Source/JavaScriptCore/jit/JITExceptions.cpp
r230865 r235419 31 31 #include "CodeBlock.h" 32 32 #include "Disassembler.h" 33 #include "EntryFrame.h" 33 34 #include "Interpreter.h" 34 35 #include "JSCInlines.h" … … 39 40 #include "Opcode.h" 40 41 #include "ShadowChicken.h" 41 #include "VM .h"42 #include "VMInlines.h" 42 43 43 44 namespace JSC { 44 45 45 void genericUnwind(VM* vm, ExecState* callFrame , UnwindStart unwindStart)46 void genericUnwind(VM* vm, ExecState* callFrame) 46 47 { 47 48 auto scope = DECLARE_CATCH_SCOPE(*vm); 49 CallFrame* topJSCallFrame = vm->topJSCallFrame(); 48 50 if (Options::breakOnThrow()) { 49 CodeBlock* codeBlock = callFrame->codeBlock(); 50 if (codeBlock) 51 dataLog("In call frame ", RawPointer(callFrame), " for code block ", *codeBlock, "\n"); 52 else 53 dataLog("In call frame ", RawPointer(callFrame), " with null CodeBlock\n"); 51 CodeBlock* codeBlock = topJSCallFrame->codeBlock(); 52 dataLog("In call frame ", RawPointer(topJSCallFrame), " for code block ", codeBlock, "\n"); 54 53 CRASH(); 55 54 } 56 55 57 ExecState* shadowChickenTopFrame = callFrame; 58 if (unwindStart == UnwindFromCallerFrame) { 59 EntryFrame* topEntryFrame = vm->topEntryFrame; 60 shadowChickenTopFrame = callFrame->callerFrame(topEntryFrame); 61 } 62 vm->shadowChicken().log(*vm, shadowChickenTopFrame, ShadowChicken::Packet::throwPacket()); 63 56 vm->shadowChicken().log(*vm, topJSCallFrame, ShadowChicken::Packet::throwPacket()); 57 64 58 Exception* exception = scope.exception(); 65 59 RELEASE_ASSERT(exception); 66 HandlerInfo* handler = vm->interpreter->unwind(*vm, callFrame, exception , unwindStart); // This may update callFrame.60 HandlerInfo* handler = vm->interpreter->unwind(*vm, callFrame, exception); // This may update callFrame. 67 61 68 62 void* catchRoutine; … … 84 78 } else 85 79 catchRoutine = LLInt::getCodePtr<ExceptionHandlerPtrTag>(handleUncaughtException).executableAddress(); 86 80 87 81 ASSERT(bitwise_cast<uintptr_t>(callFrame) < bitwise_cast<uintptr_t>(vm->topEntryFrame)); 88 82 … … 95 89 } 96 90 97 void genericUnwind(VM* vm, ExecState* callFrame)98 {99 genericUnwind(vm, callFrame, UnwindFromCurrentFrame);100 }101 102 91 } // namespace JSC -
trunk/Source/JavaScriptCore/jit/JITExceptions.h
r206525 r235419 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 namespace JSC { 29 29 30 enum UnwindStart : uint8_t;31 32 30 class ExecState; 33 31 class VM; 34 32 35 void genericUnwind(VM*, ExecState*, UnwindStart);36 33 void genericUnwind(VM*, ExecState*); 37 34 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r235198 r235419 103 103 VM* vm = codeBlock->vm(); 104 104 auto scope = DECLARE_THROW_SCOPE(*vm); 105 106 EntryFrame* entryFrame = vm->topEntryFrame; 107 CallFrame* callerFrame = exec->callerFrame(entryFrame); 108 if (!callerFrame) { 109 callerFrame = exec; 110 entryFrame = vm->topEntryFrame; 111 } 112 113 NativeCallFrameTracerWithRestore tracer(vm, entryFrame, callerFrame); 114 throwStackOverflowError(callerFrame, scope); 105 exec->convertToStackOverflowFrame(*vm); 106 NativeCallFrameTracer tracer(vm, exec); 107 throwStackOverflowError(exec, scope); 115 108 } 116 109 … … 122 115 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, *vm, CodeForCall); 123 116 if (missingArgCount < 0) { 124 EntryFrame* entryFrame = vm->topEntryFrame; 125 CallFrame* callerFrame = exec->callerFrame(entryFrame); 126 NativeCallFrameTracerWithRestore tracer(vm, entryFrame, callerFrame); 127 throwStackOverflowError(callerFrame, scope); 117 exec->convertToStackOverflowFrame(*vm); 118 NativeCallFrameTracer tracer(vm, exec); 119 throwStackOverflowError(vm->topCallFrame, scope); 128 120 } 129 121 … … 138 130 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, *vm, CodeForConstruct); 139 131 if (missingArgCount < 0) { 140 EntryFrame* entryFrame = vm->topEntryFrame; 141 CallFrame* callerFrame = exec->callerFrame(entryFrame); 142 NativeCallFrameTracerWithRestore tracer(vm, entryFrame, callerFrame); 143 throwStackOverflowError(callerFrame, scope); 132 exec->convertToStackOverflowFrame(*vm); 133 NativeCallFrameTracer tracer(vm, exec); 134 throwStackOverflowError(vm->topCallFrame, scope); 144 135 } 145 136 … … 2450 2441 void JIT_OPERATION lookupExceptionHandlerFromCallerFrame(VM* vm, ExecState* exec) 2451 2442 { 2452 vm->topCallFrame = exec->callerFrame(); 2453 genericUnwind(vm, exec, UnwindFromCallerFrame); 2454 ASSERT(vm->targetMachinePCForThrow); 2443 exec->convertToStackOverflowFrame(*vm); 2444 lookupExceptionHandler(vm, exec); 2455 2445 } 2456 2446 -
trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
r231027 r235419 59 59 #include "TypeProfilerLog.h" 60 60 #include "VM.h" 61 #include "VMEntryRecord.h"62 61 #include "ValueProfile.h" 63 62 #include "Watchdog.h" -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r233658 r235419 30 30 #include "CallFrame.h" 31 31 #include "CommonSlowPaths.h" 32 #include "CommonSlowPathsExceptions.h"33 32 #include "Error.h" 34 33 #include "ErrorHandlingScope.h" … … 526 525 auto throwScope = DECLARE_THROW_SCOPE(vm); 527 526 528 EntryFrame* topEntryFrame = vm.topEntryFrame; 529 CallFrame* callerFrame = exec->callerFrame(topEntryFrame); 530 if (!callerFrame) { 531 callerFrame = exec; 532 topEntryFrame = vm.topEntryFrame; 533 } 534 NativeCallFrameTracerWithRestore tracer(&vm, topEntryFrame, callerFrame); 527 // It's ok to create the NativeCallFrameTracer here before we 528 // convertToStackOverflowFrame() because this function is always called 529 // after the frame has been propulated with a proper CodeBlock and callee. 530 NativeCallFrameTracer tracer(&vm, exec); 535 531 536 532 LLINT_SET_PC_FOR_STUBS(); … … 564 560 #endif 565 561 562 exec->convertToStackOverflowFrame(vm); 566 563 ErrorHandlingScope errorScope(vm); 567 throwStackOverflowError( callerFrame, throwScope);568 pc = returnToThrow( callerFrame);564 throwStackOverflowError(exec, throwScope); 565 pc = returnToThrow(exec); 569 566 LLINT_RETURN_TWO(pc, exec); 570 567 } -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r235102 r235419 1077 1077 callSlowPath(_llint_stack_check) 1078 1078 bpeq r1, 0, .stackHeightOKGetCodeBlock 1079 1080 # We're throwing before the frame is fully set up. This frame will be 1081 # ignored by the unwinder. So, let's restore the callee saves before we 1082 # start unwinding. We need to do this before we change the cfr. 1083 restoreCalleeSavesUsedByLLInt() 1084 1079 1085 move r1, cfr 1080 dispatch(0) # Go to exception handler in PC1086 jmp _llint_throw_from_slow_path_trampoline 1081 1087 1082 1088 .stackHeightOKGetCodeBlock: -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r234184 r235419 128 128 loadp VM::topEntryFrame[vm], t4 129 129 storep t4, VMEntryRecord::m_prevTopEntryFrame[sp] 130 loadp ProtoCallFrame::calleeValue[protoCallFrame], t4 131 storep t4, VMEntryRecord::m_callee[sp] 130 132 131 133 # Align stack pointer … … 310 312 loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[t3], t3 311 313 restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0) 312 loadp VM::callFrameForCatch[t3], cfr313 314 storep 0, VM::callFrameForCatch[t3] 314 315 315 loadp CallerFrame[cfr], cfr 316 316 loadp VM::topEntryFrame[t3], cfr 317 317 if ARMv7 318 318 vmEntryRecord(cfr, t3) … … 576 576 cCall2(slowPath) # This slowPath has a simple protocol: t0 = 0 => no error, t0 != 0 => error 577 577 btiz r0, .noError 578 579 # We're throwing before the frame is fully set up. This frame will be 580 # ignored by the unwinder. So, let's restore the callee saves before we 581 # start unwinding. We need to do this before we change the cfr. 582 restoreCalleeSavesUsedByLLInt() 583 578 584 move r1, cfr # r1 contains caller frame 579 585 jmp _llint_throw_from_slow_path_trampoline -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r234184 r235419 133 133 loadp VM::topEntryFrame[vm], t4 134 134 storep t4, VMEntryRecord::m_prevTopEntryFrame[sp] 135 loadp ProtoCallFrame::calleeValue[protoCallFrame], t4 136 storep t4, VMEntryRecord::m_callee[sp] 135 137 136 138 loadi ProtoCallFrame::paddedArgCount[protoCallFrame], t4 … … 245 247 popCalleeSaves() 246 248 functionEpilogue() 247 248 249 ret 249 250 end … … 283 284 loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[t3], t3 284 285 restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0) 285 loadp VM::callFrameForCatch[t3], cfr286 286 storep 0, VM::callFrameForCatch[t3] 287 287 288 loadp CallerFrame[cfr], cfr288 loadp VM::topEntryFrame[t3], cfr 289 289 vmEntryRecord(cfr, t2) 290 290 … … 509 509 cCall2(slowPath) # This slowPath has the protocol: r0 = 0 => no error, r0 != 0 => error 510 510 btiz r0, .noError 511 512 # We're throwing before the frame is fully set up. This frame will be 513 # ignored by the unwinder. So, let's restore the callee saves before we 514 # start unwinding. We need to do this before we change the cfr. 515 restoreCalleeSavesUsedByLLInt() 516 511 517 move r1, cfr # r1 contains caller frame 512 518 jmp _llint_throw_from_slow_path_trampoline -
trunk/Source/JavaScriptCore/runtime/CallData.cpp
r235254 r235419 1 1 /* 2 * Copyright (C) 2008 , 2016Apple Inc. All Rights Reserved.2 * Copyright (C) 2008-2018 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r233122 r235419 34 34 #include "ClonedArguments.h" 35 35 #include "CodeProfiling.h" 36 #include "CommonSlowPathsExceptions.h"37 36 #include "DefinePropertyAttributes.h" 38 37 #include "DirectArguments.h" … … 164 163 } while (false) 165 164 165 static void throwArityCheckStackOverflowError(ExecState* exec, ThrowScope& scope) 166 { 167 JSObject* error = createStackOverflowError(exec); 168 throwException(exec, scope, error); 169 #if LLINT_TRACING 170 if (UNLIKELY(Options::traceLLIntSlowPath())) 171 dataLog("Throwing exception ", JSValue(scope.exception()), ".\n"); 172 #endif 173 } 174 166 175 SLOW_PATH_DECL(slow_path_call_arityCheck) 167 176 { … … 169 178 int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, vm, CodeForCall); 170 179 if (slotsToAdd < 0) { 171 exec = exec->callerFrame();172 vm.topCallFrame = exec;180 exec->convertToStackOverflowFrame(vm); 181 NativeCallFrameTracer tracer(&vm, exec); 173 182 ErrorHandlingScope errorScope(vm); 174 183 throwScope.release(); 175 CommonSlowPaths::interpreterThrowInCaller(exec, createStackOverflowError(exec));184 throwArityCheckStackOverflowError(exec, throwScope); 176 185 RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec); 177 186 } … … 184 193 int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, vm, CodeForConstruct); 185 194 if (slotsToAdd < 0) { 186 exec = exec->callerFrame();187 vm.topCallFrame = exec;195 exec->convertToStackOverflowFrame(vm); 196 NativeCallFrameTracer tracer(&vm, exec); 188 197 ErrorHandlingScope errorScope(vm); 189 CommonSlowPaths::interpreterThrowInCaller(exec, createStackOverflowError(exec));198 throwArityCheckStackOverflowError(exec, throwScope); 190 199 RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec); 191 200 } -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r235254 r235419 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-201 7Apple Inc.4 * Copyright (C) 2003-2018 Apple Inc. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 127 127 if (scopeExtensionObject) { 128 128 JSScope* ignoredPreviousScope = globalObject->globalScope(); 129 globalObject->setGlobalScopeExtension(JSWithScope::create( exec->vm(), globalObject, ignoredPreviousScope, scopeExtensionObject));129 globalObject->setGlobalScopeExtension(JSWithScope::create(vm, globalObject, ignoredPreviousScope, scopeExtensionObject)); 130 130 } 131 131 -
trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.h
r229413 r235419 33 33 class JSGlobalObject; 34 34 class LLIntOffsetsExtractor; 35 class LLIntDesiredOffsets;36 35 37 36 class JSGeneratorFunction final : public JSFunction { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r234491 r235419 417 417 ExecState* exec = JSGlobalObject::globalExec(); 418 418 419 JSCallee* stackOverflowFrameCallee = JSCallee::create(vm, this, globalScope()); 420 m_stackOverflowFrameCallee.set(vm, this, stackOverflowFrameCallee); 421 419 422 m_hostFunctionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get())); 420 423 … … 1328 1331 visitor.append(thisObject->m_globalScopeExtension); 1329 1332 visitor.append(thisObject->m_globalCallee); 1333 visitor.append(thisObject->m_stackOverflowFrameCallee); 1330 1334 visitor.append(thisObject->m_regExpConstructor); 1331 1335 visitor.append(thisObject->m_errorConstructor); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r233426 r235419 84 84 class JSArrayBufferConstructor; 85 85 class JSArrayBufferPrototype; 86 class JSCallee; 86 87 class JSGlobalObjectDebuggable; 87 88 class JSInternalPromise; … … 257 258 WriteBarrier<JSGlobalLexicalEnvironment> m_globalLexicalEnvironment; 258 259 WriteBarrier<JSScope> m_globalScopeExtension; 259 WriteBarrier<JSObject> m_globalCallee; 260 WriteBarrier<JSCallee> m_globalCallee; 261 WriteBarrier<JSCallee> m_stackOverflowFrameCallee; 260 262 WriteBarrier<RegExpConstructor> m_regExpConstructor; 261 263 WriteBarrier<ErrorConstructor> m_errorConstructor; … … 442 444 443 445 WeakRandom m_weakRandom; 446 447 JSCallee* stackOverflowFrameCallee() const { return m_stackOverflowFrameCallee.get(); } 444 448 445 449 InlineWatchpointSet& arrayIteratorProtocolWatchpoint() { return m_arrayIteratorProtocolWatchpoint; } -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r235261 r235419 144 144 #include "UnlinkedCodeBlock.h" 145 145 #include "VMEntryScope.h" 146 #include "VMInlines.h" 146 147 #include "VMInspector.h" 147 148 #include "VariableEnvironment.h" … … 831 832 void VM::throwException(ExecState* exec, Exception* exception) 832 833 { 834 ASSERT(exec == topCallFrame || exec->isGlobalExec()); 835 CallFrame* throwOriginFrame = exec->isGlobalExec() ? exec : topJSCallFrame(); 836 833 837 if (Options::breakOnThrow()) { 834 CodeBlock* codeBlock = exec->codeBlock();835 dataLog("Throwing exception in call frame ", RawPointer( exec), " for code block ", codeBlock, "\n");838 CodeBlock* codeBlock = throwOriginFrame ? throwOriginFrame->codeBlock() : nullptr; 839 dataLog("Throwing exception in call frame ", RawPointer(throwOriginFrame), " for code block ", codeBlock, "\n"); 836 840 CRASH(); 837 841 } 838 842 839 ASSERT(exec == topCallFrame || exec->isGlobalExec()); 840 841 interpreter->notifyDebuggerOfExceptionToBeThrown(*this, exec, exception); 843 interpreter->notifyDebuggerOfExceptionToBeThrown(*this, throwOriginFrame, exception); 842 844 843 845 setException(exception); -
trunk/Source/JavaScriptCore/runtime/VM.h
r235261 r235419 52 52 #include "Strong.h" 53 53 #include "StructureCache.h" 54 #include "VMEntryRecord.h"55 54 #include "VMTraps.h" 56 55 #include "WasmContext.h" … … 169 168 } 170 169 170 struct EntryFrame; 171 171 struct HashTable; 172 172 struct Instruction; … … 295 295 unsigned id() const { return m_id; } 296 296 bool isEntered() const { return !!entryScope; } 297 298 inline CallFrame* topJSCallFrame() const; 297 299 298 300 // Global object in which execution began. -
trunk/Source/JavaScriptCore/runtime/VMInlines.h
r220186 r235419 1 1 /* 2 * Copyright (C) 2015-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "CallFrameInlines.h" 29 #include "EntryFrame.h" 28 30 #include "ProfilerDatabase.h" 29 31 #include "VM.h" … … 61 63 } 62 64 65 inline CallFrame* VM::topJSCallFrame() const 66 { 67 CallFrame* frame = topCallFrame; 68 if (UNLIKELY(!frame)) 69 return frame; 70 if (LIKELY(!frame->isWasmFrame() && !frame->isStackOverflowFrame())) 71 return frame; 72 EntryFrame* entryFrame = topEntryFrame; 73 do { 74 frame = frame->callerFrame(entryFrame); 75 ASSERT(!frame || !frame->isStackOverflowFrame()); 76 } while (frame && frame->isWasmFrame()); 77 return frame; 78 } 79 63 80 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.