Ignore:
Timestamp:
Oct 23, 2012, 12:12:29 AM (13 years ago)
Author:
[email protected]
Message:

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.
  • bytecode/SamplingTool.h:

(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):

  • interpreter/CallFrame.h:

(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):

  • interpreter/JSStack.cpp:

(JSC::JSStack::JSStack):
(JSC::JSStack::gatherConservativeRoots):
(JSC::JSStack::disableErrorStackReserve):

  • interpreter/JSStack.h:

(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):

  • jit/JITStubs.cpp:

(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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r130726 r132182  
    257257        CodeBlock* someCodeBlockForPossiblyInlinedCode() { return codeBlock(); }
    258258#endif
     259        CallFrame* callerFrameNoFlags() { return callerFrame()->removeHostCallFrameFlag(); }
    259260       
    260261        // Call this to get the true call frame (accounted for inlining and any
     
    282283        ~ExecState();
    283284
     285        // The following are for internal use in debugging and verification
     286        // code only and not meant as an API for general usage:
     287
     288        size_t argIndexForRegister(Register* reg)
     289        {
     290            // The register at 'offset' number of slots from the frame pointer
     291            // i.e.
     292            //       reg = frame[offset];
     293            //   ==> reg = frame + offset;
     294            //   ==> offset = reg - frame;
     295            int offset = reg - this->registers();
     296
     297            // The offset is defined (based on argumentOffset()) to be:
     298            //       offset = s_firstArgumentOffset - argIndex;
     299            // Hence:
     300            //       argIndex = s_firstArgumentOffset - offset;
     301            size_t argIndex = s_firstArgumentOffset - offset;
     302            return argIndex;
     303        }
     304
     305        JSValue getArgumentUnsafe(size_t argIndex)
     306        {
     307            // User beware! This method does not verify that there is a valid
     308            // argument at the specified argIndex. This is used for debugging
     309            // and verification code only. The caller is expected to know what
     310            // he/she is doing when calling this method.
     311            return this[argumentOffset(argIndex)].jsValue();
     312        }
     313
     314        friend class JSStack;
    284315        friend class VMInspector;
    285316    };
Note: See TracChangeset for help on using the changeset viewer.