Changeset 96146 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Sep 27, 2011, 1:16:37 PM (14 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r96131.
http://trac.webkit.org/changeset/96131
https://bugs.webkit.org/show_bug.cgi?id=68927

It made 18+ tests crash on all platform (Requested by
Ossy_night on #webkit).

Patch by Sheriff Bot <[email protected]> on 2011-09-27

Source/JavaScriptCore:

(JSC::Interpreter::throwException):

  • interpreter/Interpreter.h:
  • jsc.cpp:

(GlobalObject::finishCreation):

  • parser/Parser.h:

(JSC::Parser::parse):

  • runtime/CommonIdentifiers.h:
  • runtime/Error.cpp:

(JSC::addErrorInfo):

  • runtime/Error.h:

LayoutTests:

  • fast/js/exception-properties-expected.txt:
  • fast/js/script-tests/exception-properties.js:
  • fast/js/script-tests/stack-trace.js: Removed.
  • fast/js/stack-trace-expected.txt: Removed.
  • fast/js/stack-trace.html: Removed.
  • platform/chromium/test_expectations.txt:
Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96143 r96146  
     12011-09-27  Sheriff Bot  <[email protected]>
     2
     3        Unreviewed, rolling out r96131.
     4        http://trac.webkit.org/changeset/96131
     5        https://bugs.webkit.org/show_bug.cgi?id=68927
     6
     7        It made 18+ tests crash on all platform (Requested by
     8        Ossy_night on #webkit).
     9
     10        * JavaScriptCore.exp:
     11        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
     12        * interpreter/Interpreter.cpp:
     13        (JSC::Interpreter::throwException):
     14        * interpreter/Interpreter.h:
     15        * jsc.cpp:
     16        (GlobalObject::finishCreation):
     17        * parser/Parser.h:
     18        (JSC::Parser::parse):
     19        * runtime/CommonIdentifiers.h:
     20        * runtime/Error.cpp:
     21        (JSC::addErrorInfo):
     22        * runtime/Error.h:
     23
    1242011-09-27  Mark Hahnenberg  <[email protected]>
    225
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r96143 r96146  
    115115__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
    116116__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
    117 __ZN3JSC11Interpreter13getStackTraceEPNS_12JSGlobalDataEiRN3WTF6VectorINS_10StackFrameELm0EEE
    118117__ZN3JSC11JSByteArray13s_defaultInfoE
    119118__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueEPKNS_9ClassInfoE
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r96143 r96146  
    209209    ?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
    210210    ?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
    211     ?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@HAAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z
    212211    ?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
    213212    ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r96131 r96146  
    4646#include "JSArray.h"
    4747#include "JSByteArray.h"
     48#include "JSFunction.h"
    4849#include "JSNotAnObject.h"
    4950#include "JSPropertyNameIterator.h"
     
    687688}
    688689
    689 static void getCallerLine(JSGlobalData* globalData, CallFrame* callFrame, int& lineNumber)
    690 {
    691     (void)globalData;
    692     unsigned bytecodeOffset;
    693     lineNumber = -1;
    694     callFrame = callFrame->removeHostCallFrameFlag();
    695 
    696     if (callFrame->callerFrame() == CallFrame::noCaller() || callFrame->callerFrame()->hasHostCallFrameFlag())
    697         return;
    698 
    699     CodeBlock* callerCodeBlock = callFrame->callerFrame()->removeHostCallFrameFlag()->codeBlock();
    700 
    701 #if ENABLE(INTERPRETER)
    702     if (!globalData->canUseJIT())
    703         bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnVPC());
    704 #if ENABLE(JIT)
    705     else
    706         bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
    707 #endif
    708 #else
    709     bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
    710 #endif
    711 
    712     lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(bytecodeOffset - 1);
    713 }
    714 
    715 static ALWAYS_INLINE const UString getSourceURLFromCallFrame(CallFrame* callFrame)
    716 {
    717     if (callFrame->hasHostCallFrameFlag())
    718         return UString();
    719 #if ENABLE(INTERPRETER)
    720     if (!callFrame->globalData().canUseJIT())
    721         return callFrame->codeBlock()->source()->url();
    722 #if ENABLE(JIT)
    723     return callFrame->codeBlock()->ownerExecutable()->sourceURL();
    724 #endif
    725 #else
    726     return callFrame->codeBlock()->ownerExecutable()->sourceURL();
    727 #endif
    728 }
    729 
    730 static StackFrameCodeType getStackFrameCodeType(CallFrame* callFrame)
    731 {
    732     if (callFrame->hasHostCallFrameFlag())
    733         return StackFrameNativeCode;
    734 
    735     switch (callFrame->codeBlock()->codeType()) {
    736     case EvalCode:
    737         return StackFrameEvalCode;
    738     case FunctionCode:
    739         return StackFrameFunctionCode;
    740     case GlobalCode:
    741         return StackFrameGlobalCode;
    742     }
    743     ASSERT_NOT_REACHED();
    744     return StackFrameGlobalCode;
    745 }
    746 
    747 void Interpreter::getStackTrace(JSGlobalData* globalData, int line, Vector<StackFrame>& results)
    748 {
    749     int stackLimit = 15;
    750     CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag();
    751     if (!callFrame || callFrame == CallFrame::noCaller() || !callFrame->codeBlock())
    752         return;
    753     UString sourceURL;
    754     UString traceLevel;
    755 
    756     for (int i = 0; i < stackLimit; ++i) {
    757         if (!callFrame || callFrame == CallFrame::noCaller())
    758             break;
    759         if (callFrame->codeBlock()) {
    760             sourceURL = getSourceURLFromCallFrame(callFrame);
    761 
    762             StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), Strong<CallFrame>(*globalData, callFrame), getStackFrameCodeType(callFrame), Strong<ExecutableBase>(*globalData, callFrame->codeBlock()->ownerExecutable()), line, sourceURL};
    763 
    764             results.append(s);
    765         }
    766         getCallerLine(globalData, callFrame, line);
    767         callFrame = callFrame->callerFrame()->removeHostCallFrameFlag();
    768     }
    769 }
    770 
    771690NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
    772691{
     
    787706            // FIXME: should only really be adding these properties to VM generated exceptions,
    788707            // but the inspector currently requires these for all thrown objects.
    789             Vector<StackFrame> stackTrace;
    790             getStackTrace(&callFrame->globalData(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), stackTrace);
    791             addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source(), stackTrace);
     708            addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source());
    792709        }
    793710
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r96131 r96146  
    3232#include "ArgList.h"
    3333#include "JSCell.h"
    34 #include "JSFunction.h"
    3534#include "JSValue.h"
    3635#include "JSObject.h"
     
    4443    class CodeBlock;
    4544    class EvalExecutable;
    46     class ExecutableBase;
    4745    class FunctionExecutable;
     46    class JSFunction;
    4847    class JSGlobalObject;
    4948    class ProgramExecutable;
     
    6261        WillLeaveCallFrame,
    6362        WillExecuteStatement
    64     };
    65 
    66     enum StackFrameCodeType {
    67         StackFrameGlobalCode,
    68         StackFrameEvalCode,
    69         StackFrameFunctionCode,
    70         StackFrameNativeCode
    71     };
    72 
    73     struct StackFrame {
    74         Strong<JSObject> callee;
    75         Strong<CallFrame> callFrame;
    76         StackFrameCodeType codeType;
    77         Strong<ExecutableBase> executable;
    78         int line;
    79         UString sourceURL;
    80         UString toString() const
    81         {
    82             bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty();
    83             bool hasLineInfo = line > -1;
    84             String traceLine;
    85             JSObject* stackFrameCallee = callee.get();
    86 
    87             switch (codeType) {
    88             case StackFrameEvalCode:
    89                 if (hasSourceURLInfo)
    90                     traceLine = hasLineInfo ? String::format("eval at %s:%d", sourceURL.ascii().data(), line)
    91                                             : String::format("eval at %s", sourceURL.ascii().data());
    92                 else
    93                     traceLine = String::format("eval");
    94                 break;
    95             case StackFrameNativeCode:
    96                 traceLine = "Native code";
    97                 break;
    98             case StackFrameFunctionCode:
    99                 if (stackFrameCallee && stackFrameCallee->inherits(&JSFunction::s_info)) {
    100                     UString functionName = asFunction(stackFrameCallee)->name(callFrame.get());
    101                     if (hasSourceURLInfo)
    102                         traceLine = hasLineInfo ? String::format("%s at %s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line)
    103                                                 : String::format("%s at %s", functionName.ascii().data(), sourceURL.ascii().data());
    104                     else
    105                         traceLine = String::format("%s\n", functionName.ascii().data());
    106                     break;
    107                 }
    108             case StackFrameGlobalCode:
    109                 traceLine = hasLineInfo ? String::format("at %s:%d", sourceURL.ascii().data(), line)
    110                                         : String::format("at %s", sourceURL.ascii().data());
    111             }
    112             return traceLine.impl();
    113         }
    11463    };
    11564
     
    180129        NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset);
    181130        NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
    182         static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int);
    183         static void getStackTrace(JSGlobalData*, int line, Vector<StackFrame>& results);
    184131
    185132        void dumpSampleData(ExecState* exec);
  • trunk/Source/JavaScriptCore/jsc.cpp

    r96131 r96146  
    2828#include "ExceptionHelpers.h"
    2929#include "InitializeThreading.h"
    30 #include "Interpreter.h"
    3130#include "JSArray.h"
    3231#include "JSFunction.h"
     
    7574static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
    7675static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
    77 static EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState*);
    7876static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
    7977#ifndef NDEBUG
     
    177175        addFunction(globalData, "load", functionLoad, 1);
    178176        addFunction(globalData, "checkSyntax", functionCheckSyntax, 1);
    179         addFunction(globalData, "jscStack", functionJSCStack, 1);
    180177        addFunction(globalData, "readline", functionReadline, 0);
    181178        addFunction(globalData, "preciseTime", functionPreciseTime, 0);
     
    222219{
    223220    fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).utf8().data());
    224     return JSValue::encode(jsUndefined());
    225 }
    226 
    227 EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState* exec)
    228 {
    229     String trace = "--> Stack trace:\n";
    230     Vector<StackFrame> stackTrace;
    231     Interpreter::getStackTrace(&exec->globalData(), -1, stackTrace);
    232     int i = 0;
    233 
    234     for (Vector<StackFrame>::iterator iter = stackTrace.begin(); iter < stackTrace.end(); iter++) {
    235         StackFrame level = *iter;
    236         trace += String::format("    %i   %s\n", i, level.toString().utf8().data());
    237         i++;
    238     }
    239     fprintf(stderr, "%s", trace.utf8().data());
    240221    return JSValue::encode(jsUndefined());
    241222}
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r96131 r96146  
    115115                *exception = createSyntaxError(lexicalGlobalObject, errMsg);
    116116            else
    117                 *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source, Vector<StackFrame>());
     117                *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source);
    118118        }
    119119
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r96131 r96146  
    5353    macro(isArray) \
    5454    macro(isPrototypeOf) \
    55     macro(jscStack) \
    5655    macro(length) \
    5756    macro(message) \
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r96131 r96146  
    2727#include "ConstructData.h"
    2828#include "ErrorConstructor.h"
    29 #include "JSArray.h"
    3029#include "JSFunction.h"
    3130#include "JSGlobalObject.h"
     
    118117}
    119118
    120 JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace)
     119JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source)
    121120{
    122121    intptr_t sourceID = source.provider()->asID();
     
    129128    if (!sourceURL.isNull())
    130129        error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete);
    131     if (!stackTrace.isEmpty()) {
    132         JSArray* stackTraceArray = JSArray::create(*globalData, globalData->dynamicGlobalObject->arrayStructure());
    133         for (unsigned i = 0; i < stackTrace.size(); i++) {
    134             UString stackLevel =  stackTrace[i].toString();
    135             stackTraceArray->push(globalData->topCallFrame, jsString(globalData, stackLevel));
    136         }
    137         error->putWithAttributes(globalData, globalData->propertyNames->jscStack, stackTraceArray, ReadOnly | DontDelete);
    138     }
    139130
    140131    return error;
    141132}
    142133
    143 JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace)
    144 {
    145     return addErrorInfo(&exec->globalData(), error, line, source, stackTrace);
     134JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source)
     135{
     136    return addErrorInfo(&exec->globalData(), error, line, source);
    146137}
    147138
  • trunk/Source/JavaScriptCore/runtime/Error.h

    r96131 r96146  
    2424#define Error_h
    2525
    26 #include "Interpreter.h"
    2726#include "JSObject.h"
    2827#include <stdint.h>
     
    5756    // Methods to add
    5857    bool hasErrorInfo(ExecState*, JSObject* error);
    59     JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&);
     58    JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&);
    6059    // ExecState wrappers.
    61     JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&);
     60    JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
    6261
    6362    // Methods to throw Errors.
Note: See TracChangeset for help on using the changeset viewer.