Changeset 114317 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Apr 16, 2012, 4:37:40 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r114309 r114317 1 2012-04-16 Sheriff Bot <[email protected]> 2 3 Unreviewed, rolling out r114309. 4 http://trac.webkit.org/changeset/114309 5 https://bugs.webkit.org/show_bug.cgi?id=84097 6 7 it broke everything (Requested by olliej on #webkit). 8 9 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 10 * bytecode/CodeBlock.h: 11 * dfg/DFGOperations.cpp: 12 * interpreter/Interpreter.cpp: 13 (JSC::Interpreter::getStackTrace): 14 (JSC::Interpreter::throwException): 15 * interpreter/Interpreter.h: 16 (Interpreter): 17 * jit/JITStubs.cpp: 18 (JSC::DEFINE_STUB_FUNCTION): 19 * jsc.cpp: 20 (functionJSCStack): 21 * llint/LLIntSlowPaths.cpp: 22 (JSC::LLInt::handleHostCall): 23 * parser/Parser.h: 24 (JSC::::parse): 25 * runtime/Error.cpp: 26 (JSC::addErrorInfo): 27 (JSC::throwError): 28 * runtime/Error.h: 29 (JSC): 30 1 31 2012-04-16 Oliver Hunt <[email protected]> 2 32 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r114309 r114317 213 213 ?getPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z 214 214 ?getSlice@ArgList@JSC@@QBEXHAAV12@@Z 215 ?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@ AAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z215 ?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@HAAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z 216 216 ?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z 217 217 ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r114309 r114317 711 711 } 712 712 713 int codeOriginIndexForReturn(ReturnAddressPtr returnAddress)714 {715 ASSERT(hasCodeOrigins());716 unsigned offset = getJITCode().offsetOf(returnAddress.value());717 CodeOriginAtCallReturnOffset* entry = binarySearch<CodeOriginAtCallReturnOffset, unsigned, getCallReturnOffsetForCodeOrigin>(codeOrigins().begin(), codeOrigins().size(), offset, WTF::KeyMustNotBePresentInArray);718 return entry - codeOrigins().begin();719 }720 721 713 CodeOrigin codeOrigin(unsigned index) 722 714 { -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r114309 r114317 793 793 794 794 if (callType == CallTypeHost) { 795 execCallee->setCallee(asObject(callee));796 795 globalData->hostCallReturnValue = JSValue::decode(callData.native.function(execCallee)); 797 796 if (globalData->exception) … … 814 813 815 814 if (constructType == ConstructTypeHost) { 816 execCallee->setCallee(asObject(callee));817 815 globalData->hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee)); 818 816 if (globalData->exception) -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r114309 r114317 66 66 #include <stdio.h> 67 67 #include <wtf/Threading.h> 68 #include <wtf/text/StringBuilder.h>69 68 70 69 #if ENABLE(JIT) … … 954 953 } 955 954 956 void Interpreter::getStackTrace(JSGlobalData* globalData, Vector<StackFrame>& results)955 void Interpreter::getStackTrace(JSGlobalData* globalData, int line, Vector<StackFrame>& results) 957 956 { 958 CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag() ;957 CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag()->trueCallFrameFromVMCode(); 959 958 if (!callFrame || callFrame == CallFrame::noCaller()) 960 959 return; 961 int line = getLineNumberForCallFrame(globalData, callFrame); 962 963 callFrame = callFrame->trueCallFrameFromVMCode();960 961 if (line == -1) 962 line = getLineNumberForCallFrame(globalData, callFrame); 964 963 965 964 while (callFrame && callFrame != CallFrame::noCaller()) { … … 977 976 } 978 977 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 else995 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 1006 978 NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset) 1007 979 { … … 1019 991 if (codeBlock->hasExpressionInfo() && !hasErrorInfo(callFrame, exception)) { 1020 992 ASSERT(codeBlock->hasLineInfo()); 993 1021 994 // FIXME: should only really be adding these properties to VM generated exceptions, 1022 995 // 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); 1024 999 } 1025 1000 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r114309 r114317 223 223 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine); 224 224 static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int); 225 JS_EXPORT_PRIVATE static void getStackTrace(JSGlobalData*, Vector<StackFrame>& results); 226 static void addStackTraceIfNecessary(CallFrame*, JSObject* error); 225 JS_EXPORT_PRIVATE static void getStackTrace(JSGlobalData*, int line, Vector<StackFrame>& results); 227 226 228 227 void dumpSampleData(ExecState* exec); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r114309 r114317 3519 3519 STUB_INIT_STACK_FRAME(stackFrame); 3520 3520 JSGlobalData* globalData = stackFrame.globalData; 3521 // It's possible for us to reach this point with incorrect origin metadata3522 // if a native function throws an exception after being planted in certain3523 // code paths as the native thunk doesn't can't unwind itself as if it were3524 // a JS function. So we redetermine the correct data here just to be safe.3525 if (CodeBlock* codeBlock = stackFrame.callFrame->codeBlock()) {3526 #if ENABLE(DFG_JIT)3527 if (codeBlock->hasCodeOrigins())3528 stackFrame.callFrame->setBytecodeOffsetForNonDFGCode(codeBlock->codeOriginIndexForReturn(globalData->exceptionLocation));3529 else3530 #endif3531 if (codeBlock->getJITType() == JITCode::BaselineJIT)3532 stackFrame.callFrame->setBytecodeOffsetForNonDFGCode(codeBlock->bytecodeOffset(stackFrame.callFrame, globalData->exceptionLocation));3533 }3534 3521 ExceptionHandler handler = jitThrow(globalData, stackFrame.callFrame, globalData->exception, globalData->exceptionLocation); 3535 3522 STUB_SET_RETURN_ADDRESS(handler.catchRoutine); -
trunk/Source/JavaScriptCore/jsc.cpp
r114309 r114317 278 278 String trace = "--> Stack trace:\n"; 279 279 Vector<StackFrame> stackTrace; 280 Interpreter::getStackTrace(&exec->globalData(), stackTrace);280 Interpreter::getStackTrace(&exec->globalData(), -1, stackTrace); 281 281 int i = 0; 282 282 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r114309 r114317 1242 1242 1243 1243 if (callType == CallTypeHost) { 1244 execCallee->setCallee(asObject(callee));1245 1244 globalData.hostCallReturnValue = JSValue::decode(callData.native.function(execCallee)); 1246 1245 … … 1264 1263 1265 1264 if (constructType == ConstructTypeHost) { 1266 execCallee->setCallee(asObject(callee));1267 1265 globalData.hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee)); 1268 1266 -
trunk/Source/JavaScriptCore/parser/Parser.h
r114309 r114317 994 994 *exception = createSyntaxError(lexicalGlobalObject, errMsg); 995 995 else 996 *exception = addErrorInfo( lexicalGlobalObject->globalExec(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, *m_source);996 *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, *m_source, Vector<StackFrame>()); 997 997 } 998 998 -
trunk/Source/JavaScriptCore/runtime/Error.cpp
r114309 r114317 121 121 } 122 122 123 JSObject* addErrorInfo( CallFrame* callFrame, JSObject* error, int line, const SourceCode& source)123 JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace) 124 124 { 125 JSGlobalData* globalData = &callFrame->globalData();126 125 const UString& sourceURL = source.provider()->url(); 127 126 … … 130 129 if (!sourceURL.isNull()) 131 130 error->putDirect(*globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete); 131 if (!stackTrace.isEmpty()) { 132 JSGlobalObject* globalObject = 0; 133 if (isTerminatedExecutionException(error) || isInterruptedExecutionException(error)) 134 globalObject = globalData->dynamicGlobalObject; 135 else 136 globalObject = error->globalObject(); 137 StringBuilder builder; 138 for (unsigned i = 0; i < stackTrace.size(); i++) { 139 builder.append(String(stackTrace[i].toString(globalObject->globalExec()).impl())); 140 if (i != stackTrace.size() - 1) 141 builder.append('\n'); 142 } 132 143 133 globalData->interpreter->addStackTraceIfNecessary(callFrame, error); 144 error->putDirect(*globalData, globalData->propertyNames->stack, jsString(globalData, UString(builder.toString().impl())), ReadOnly | DontDelete); 145 } 134 146 135 147 return error; 136 148 } 137 149 150 JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace) 151 { 152 return addErrorInfo(&exec->globalData(), error, line, source, stackTrace); 153 } 138 154 139 155 bool hasErrorInfo(ExecState* exec, JSObject* error) … … 145 161 JSValue throwError(ExecState* exec, JSValue error) 146 162 { 147 if (error.isObject())148 return throwError(exec, asObject(error));149 163 exec->globalData().exception = error; 150 164 return error; … … 153 167 JSObject* throwError(ExecState* exec, JSObject* error) 154 168 { 155 Interpreter::addStackTraceIfNecessary(exec, error);156 169 exec->globalData().exception = error; 157 170 return error; -
trunk/Source/JavaScriptCore/runtime/Error.h
r114309 r114317 58 58 // Methods to add 59 59 bool hasErrorInfo(ExecState*, JSObject* error); 60 JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&); 60 61 // ExecState wrappers. 61 JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode& );62 JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&); 62 63 63 64 // Methods to throw Errors.
Note:
See TracChangeset
for help on using the changeset viewer.