Ignore:
Timestamp:
Apr 16, 2012, 4:37:40 PM (13 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r114309.
http://trac.webkit.org/changeset/114309
https://bugs.webkit.org/show_bug.cgi?id=84097

it broke everything (Requested by olliej on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-04-16

Source/JavaScriptCore:

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • bytecode/CodeBlock.h:
  • dfg/DFGOperations.cpp:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::getStackTrace):
(JSC::Interpreter::throwException):

  • interpreter/Interpreter.h:

(Interpreter):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jsc.cpp:

(functionJSCStack):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::handleHostCall):

  • parser/Parser.h:

(JSC::::parse):

  • runtime/Error.cpp:

(JSC::addErrorInfo):
(JSC::throwError):

  • runtime/Error.h:

(JSC):

LayoutTests:

  • fast/js/exception-properties-expected.txt:
  • fast/js/script-tests/exception-properties.js:
  • fast/js/script-tests/stack-trace.js:

(selfRecursive1):

  • fast/js/stack-trace-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r114309 r114317  
    6666#include <stdio.h>
    6767#include <wtf/Threading.h>
    68 #include <wtf/text/StringBuilder.h>
    6968
    7069#if ENABLE(JIT)
     
    954953}
    955954
    956 void Interpreter::getStackTrace(JSGlobalData* globalData, Vector<StackFrame>& results)
     955void Interpreter::getStackTrace(JSGlobalData* globalData, int line, Vector<StackFrame>& results)
    957956{
    958     CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag();
     957    CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag()->trueCallFrameFromVMCode();
    959958    if (!callFrame || callFrame == CallFrame::noCaller())
    960959        return;
    961     int line = getLineNumberForCallFrame(globalData, callFrame);
    962 
    963     callFrame = callFrame->trueCallFrameFromVMCode();
     960
     961    if (line == -1)
     962        line = getLineNumberForCallFrame(globalData, callFrame);
    964963
    965964    while (callFrame && callFrame != CallFrame::noCaller()) {
     
    977976}
    978977
    979 void Interpreter::addStackTraceIfNecessary(CallFrame* callFrame, JSObject* error)
    980 {
    981     JSGlobalData* globalData = &callFrame->globalData();
    982     if (error->hasProperty(callFrame, globalData->propertyNames->stack))
    983         return;
    984 
    985     Vector<StackFrame> stackTrace;
    986     getStackTrace(&callFrame->globalData(), stackTrace);
    987    
    988     if (stackTrace.isEmpty())
    989         return;
    990    
    991     JSGlobalObject* globalObject = 0;
    992     if (isTerminatedExecutionException(error) || isInterruptedExecutionException(error))
    993         globalObject = globalData->dynamicGlobalObject;
    994     else
    995         globalObject = error->globalObject();
    996     StringBuilder builder;
    997     for (unsigned i = 0; i < stackTrace.size(); i++) {
    998         builder.append(String(stackTrace[i].toString(globalObject->globalExec()).impl()));
    999         if (i != stackTrace.size() - 1)
    1000             builder.append('\n');
    1001     }
    1002    
    1003     error->putDirect(*globalData, globalData->propertyNames->stack, jsString(globalData, UString(builder.toString().impl())), ReadOnly | DontDelete);
    1004 }
    1005 
    1006978NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
    1007979{
     
    1019991        if (codeBlock->hasExpressionInfo() && !hasErrorInfo(callFrame, exception)) {
    1020992            ASSERT(codeBlock->hasLineInfo());
     993
    1021994            // FIXME: should only really be adding these properties to VM generated exceptions,
    1022995            // but the inspector currently requires these for all thrown objects.
    1023             addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source());
     996            Vector<StackFrame> stackTrace;
     997            getStackTrace(&callFrame->globalData(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), stackTrace);
     998            addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source(), stackTrace);
    1024999        }
    10251000
Note: See TracChangeset for help on using the changeset viewer.