Make topCallFrame reliable.
https://bugs.webkit.org/show_bug.cgi?id=98928.
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
- VM entry points and the GC now uses topCallFrame.
- The callerFrame value in CallFrames are now always the previous
frame on the stack, except for the first frame which has a
callerFrame of 0 (not counting the HostCallFrameFlag).
Hence, we can now traverse every frame on the stack all the way
back to the first frame.
- GlobalExec's will no longer be used as the callerFrame values in
call frames.
- Added fences and traps for debugging the JSStack in debug builds.
(SamplingTool):
(JSC::SamplingTool::CallRecord::CallRecord):
- dfg/DFGOperations.cpp:
- Fixed 2 DFG helper functions to flush topCallFrame as expected.
- dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::prepareForExternalCall):
(JSC::ExecState::callerFrameNoFlags):
(ExecState):
(JSC::ExecState::argIndexForRegister):
(JSC::ExecState::getArgumentUnsafe):
- interpreter/CallFrameClosure.h:
(CallFrameClosure):
- interpreter/Interpreter.cpp:
(JSC):
(JSC::eval):
(JSC::Interpreter::Interpreter):
(JSC::Interpreter::throwException):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::endRepeatCall):
- interpreter/Interpreter.h:
(JSC):
(Interpreter):
(JSC::JSStack::JSStack):
(JSC::JSStack::gatherConservativeRoots):
(JSC::JSStack::disableErrorStackReserve):
(JSC):
(JSStack):
(JSC::JSStack::installFence):
(JSC::JSStack::validateFence):
(JSC::JSStack::installTrapsAfterFrame):
- interpreter/JSStackInlines.h: Added.
(JSC):
(JSC::JSStack::getTopOfFrame):
(JSC::JSStack::getTopOfStack):
(JSC::JSStack::getStartOfFrame):
(JSC::JSStack::pushFrame):
(JSC::JSStack::popFrame):
(JSC::JSStack::generateFenceValue):
(JSC::JSStack::installFence):
(JSC::JSStack::validateFence):
(JSC::JSStack::installTrapsAfterFrame):
(JSC::jitCompileFor):
(JSC::lazyLinkFor):
- Set frame->codeBlock to 0 for both the above because they are called
with partially intitialized frames (cb uninitialized), but may
trigger a GC.
(JSC::DEFINE_STUB_FUNCTION):
- runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
LayoutTests:
- Re-baseline some tests to match the new stack dump results.
- http/tests/inspector/console-resource-errors-expected.txt:
- http/tests/inspector/stacktraces/csp-injected-content-warning-contains-stacktrace-expected.txt:
- http/tests/inspector/stacktraces/csp-inline-warning-contains-stacktrace-expected.txt: