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 <webkit.review.bot@gmail.com> on 2011-09-27

Source/JavaScriptCore:

* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* interpreter/Interpreter.cpp:
(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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e0804487
2011-09-27 Sheriff Bot <webkit.review.bot@gmail.com>
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).
* 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:
2011-06-28 Robert Hogan <robert@webkit.org>
Reviewed by David Hyatt.
......@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS enumerableProperties(error) is []
PASS enumerableProperties(nativeError) is ["line", "sourceId", "sourceURL", "jscStack"]
PASS enumerableProperties(nativeError) is ["line", "sourceId", "sourceURL"]
PASS Object.getPrototypeOf(nativeError).name is "RangeError"
PASS Object.getPrototypeOf(nativeError).message is ""
PASS successfullyParsed is true
......
......@@ -16,7 +16,7 @@ try {
var error = new Error("message");
shouldBe('enumerableProperties(error)', '[]');
shouldBe('enumerableProperties(nativeError)', '["line", "sourceId", "sourceURL", "jscStack"]');
shouldBe('enumerableProperties(nativeError)', '["line", "sourceId", "sourceURL"]');
shouldBe('Object.getPrototypeOf(nativeError).name', '"RangeError"');
shouldBe('Object.getPrototypeOf(nativeError).message', '""');
......
description(
'This test checks stack trace corectness in special cases.'
);
function printStack(stackTrace) {
debug("--> Stack Trace:")
var i = 0;
for (var level in stackTrace) {
debug(" " + i + " " + stackTrace[level].substring(0, stackTrace[level].indexOf('file:')) + stackTrace[level].substring(stackTrace[level].lastIndexOf('/')+1));
i++;
}
debug('');
}
function hostThrower() { Element.prototype.appendChild.call({ }, [{ }]); }
function callbacker(f) { [0].map(f); }
function outer(errorName) { inner(errorName); }
function inner(errorName) { throw new Error("Error in " + errorName); }
function evaler(code) { eval(code); }
function normalOuter() { normalInner(); }
function normalInner() { if(thisVarDoesntExist) failIfTrue("shouldFailBeforeThis") };
function scripterInner() { htmlInner(); }
function scripterOuter() { htmlOuter(); }
// Expected functions in stack trace
// Normal Case
try { normalOuter() } catch (e) { printStack(e.jscStack) } // normalOuter -> normalInner
// Eval Case
try { evaler("inner('inner eval');"); } catch (e) { printStack(e.jscStack) } // evaler -> eval -> inner
try { evaler("outer('outer eval');"); } catch (e) { printStack(e.jscStack) } // evaler -> eval -> outer -> inner
// Function Callback Case
try { callbacker(inner('inner map')); } catch (e) { printStack(e.jscStack); } // callbacker -> map -> inner
try { callbacker(outer('outer map')); } catch (e) { printStack(e.jscStack); } // callbacker -> map -> outer -> inner
// Host Code Case
try { hostThrower(); } catch (e) { printStack(e.jscStack); } // hostThrower
try { scripterInner(); } catch (e) { printStack(e.jscStack) } // program -> scripter -> inner
try { scripterOuter(); } catch (e) { printStack(e.jscStack) } // program -> scripter -> outer -> inner
successfullyParsed = true;
This test checks stack trace corectness in special cases.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
--> Stack Trace:
0 normalInner at stack-trace.js:21
1 normalOuter at stack-trace.js:20
2 at stack-trace.js:26
--> Stack Trace:
0 inner at stack-trace.js:18
1 eval
2 evaler at stack-trace.js
3 at stack-trace.js:29
--> Stack Trace:
0 inner at stack-trace.js:18
1 outer at stack-trace.js:17
2 eval
3 evaler at stack-trace.js
4 at stack-trace.js:30
--> Stack Trace:
0 inner at stack-trace.js:18
1 at stack-trace.js:33
--> Stack Trace:
0 inner at stack-trace.js:18
1 outer at stack-trace.js:17
2 at stack-trace.js:34
--> Stack Trace:
0 hostThrower at stack-trace.js:15
1 at stack-trace.js:37
--> Stack Trace:
0 htmlInner at stack-trace.html:10
1 scripterInner at stack-trace.js:22
2 at stack-trace.js:39
--> Stack Trace:
0 htmlInner at stack-trace.html:10
1 htmlOuter at stack-trace.html:11
2 scripterOuter at stack-trace.js:23
3 at stack-trace.js:40
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="resources/js-test-style.css">
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<p id="console"></p>
<script>function htmlInner() { throw new Error("Error in HTML"); }</script>
<script>function htmlOuter() { htmlInner(); }</script>
<script src="script-tests/stack-trace.js"></script>
</body>
</html>
......@@ -489,10 +489,6 @@ WONTFIX SKIP : fast/frames/cross-site-this.html = FAIL
// throw. V8 follows the spec.
WONTFIX SKIP : fast/js/reparsing-semicolon-insertion.html = FAIL
// This tests stack-traces that are generated by JSC. This test should
// fail since it is specific to jsc.
WONTFIX SKIP : fast/js/stack-trace.html = FAIL
// Rubber-banding is currently a CG only feature.
WONTFIX CPU GPU : platform/chromium/rubberbanding = FAIL
WONTFIX CPU GPU : platform/chromium-gpu/compositing/rubberbanding = IMAGE
......
2011-09-27 Sheriff Bot <webkit.review.bot@gmail.com>
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).
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* interpreter/Interpreter.cpp:
(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:
2011-09-27 Mark Hahnenberg <mhahnenberg@apple.com>
De-virtualize JSCell::getPrimitiveNumber
......@@ -114,7 +114,6 @@ __ZN3JSC10JSFunction6s_infoE
__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
__ZN3JSC11Interpreter13getStackTraceEPNS_12JSGlobalDataEiRN3WTF6VectorINS_10StackFrameELm0EEE
__ZN3JSC11JSByteArray13s_defaultInfoE
__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueEPKNS_9ClassInfoE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE
......
......@@ -208,7 +208,6 @@ EXPORTS
?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@HAAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z
?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z
?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
......
......@@ -45,6 +45,7 @@
#include "JSActivation.h"
#include "JSArray.h"
#include "JSByteArray.h"
#include "JSFunction.h"
#include "JSNotAnObject.h"
#include "JSPropertyNameIterator.h"
#include "LiteralParser.h"
......@@ -686,88 +687,6 @@ static void appendSourceToError(CallFrame* callFrame, ErrorInstance* exception,
exception->putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
}
static void getCallerLine(JSGlobalData* globalData, CallFrame* callFrame, int& lineNumber)
{
(void)globalData;
unsigned bytecodeOffset;
lineNumber = -1;
callFrame = callFrame->removeHostCallFrameFlag();
if (callFrame->callerFrame() == CallFrame::noCaller() || callFrame->callerFrame()->hasHostCallFrameFlag())
return;
CodeBlock* callerCodeBlock = callFrame->callerFrame()->removeHostCallFrameFlag()->codeBlock();
#if ENABLE(INTERPRETER)
if (!globalData->canUseJIT())
bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnVPC());
#if ENABLE(JIT)
else
bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
#endif
#else
bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
#endif
lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(bytecodeOffset - 1);
}
static ALWAYS_INLINE const UString getSourceURLFromCallFrame(CallFrame* callFrame)
{
if (callFrame->hasHostCallFrameFlag())
return UString();
#if ENABLE(INTERPRETER)
if (!callFrame->globalData().canUseJIT())
return callFrame->codeBlock()->source()->url();
#if ENABLE(JIT)
return callFrame->codeBlock()->ownerExecutable()->sourceURL();
#endif
#else
return callFrame->codeBlock()->ownerExecutable()->sourceURL();
#endif
}
static StackFrameCodeType getStackFrameCodeType(CallFrame* callFrame)
{
if (callFrame->hasHostCallFrameFlag())
return StackFrameNativeCode;
switch (callFrame->codeBlock()->codeType()) {
case EvalCode:
return StackFrameEvalCode;
case FunctionCode:
return StackFrameFunctionCode;
case GlobalCode:
return StackFrameGlobalCode;
}
ASSERT_NOT_REACHED();
return StackFrameGlobalCode;
}
void Interpreter::getStackTrace(JSGlobalData* globalData, int line, Vector<StackFrame>& results)
{
int stackLimit = 15;
CallFrame* callFrame = globalData->topCallFrame->removeHostCallFrameFlag();
if (!callFrame || callFrame == CallFrame::noCaller() || !callFrame->codeBlock())
return;
UString sourceURL;
UString traceLevel;
for (int i = 0; i < stackLimit; ++i) {
if (!callFrame || callFrame == CallFrame::noCaller())
break;
if (callFrame->codeBlock()) {
sourceURL = getSourceURLFromCallFrame(callFrame);
StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), Strong<CallFrame>(*globalData, callFrame), getStackFrameCodeType(callFrame), Strong<ExecutableBase>(*globalData, callFrame->codeBlock()->ownerExecutable()), line, sourceURL};
results.append(s);
}
getCallerLine(globalData, callFrame, line);
callFrame = callFrame->callerFrame()->removeHostCallFrameFlag();
}
}
NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
{
CodeBlock* codeBlock = callFrame->codeBlock();
......@@ -786,9 +705,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
// FIXME: should only really be adding these properties to VM generated exceptions,
// but the inspector currently requires these for all thrown objects.
Vector<StackFrame> stackTrace;
getStackTrace(&callFrame->globalData(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), stackTrace);
addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source(), stackTrace);
addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source());
}
isInterrupt = isInterruptedExecutionException(exception) || isTerminatedExecutionException(exception);
......
......@@ -31,7 +31,6 @@
#include "ArgList.h"
#include "JSCell.h"
#include "JSFunction.h"
#include "JSValue.h"
#include "JSObject.h"
#include "Opcode.h"
......@@ -43,8 +42,8 @@ namespace JSC {
class CodeBlock;
class EvalExecutable;
class ExecutableBase;
class FunctionExecutable;
class JSFunction;
class JSGlobalObject;
class ProgramExecutable;
class Register;
......@@ -63,56 +62,6 @@ namespace JSC {
WillExecuteStatement
};
enum StackFrameCodeType {
StackFrameGlobalCode,
StackFrameEvalCode,
StackFrameFunctionCode,
StackFrameNativeCode
};
struct StackFrame {
Strong<JSObject> callee;
Strong<CallFrame> callFrame;
StackFrameCodeType codeType;
Strong<ExecutableBase> executable;
int line;
UString sourceURL;
UString toString() const
{
bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty();
bool hasLineInfo = line > -1;
String traceLine;
JSObject* stackFrameCallee = callee.get();
switch (codeType) {
case StackFrameEvalCode:
if (hasSourceURLInfo)
traceLine = hasLineInfo ? String::format("eval at %s:%d", sourceURL.ascii().data(), line)
: String::format("eval at %s", sourceURL.ascii().data());
else
traceLine = String::format("eval");
break;
case StackFrameNativeCode:
traceLine = "Native code";
break;
case StackFrameFunctionCode:
if (stackFrameCallee && stackFrameCallee->inherits(&JSFunction::s_info)) {
UString functionName = asFunction(stackFrameCallee)->name(callFrame.get());
if (hasSourceURLInfo)
traceLine = hasLineInfo ? String::format("%s at %s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line)
: String::format("%s at %s", functionName.ascii().data(), sourceURL.ascii().data());
else
traceLine = String::format("%s\n", functionName.ascii().data());
break;
}
case StackFrameGlobalCode:
traceLine = hasLineInfo ? String::format("at %s:%d", sourceURL.ascii().data(), line)
: String::format("at %s", sourceURL.ascii().data());
}
return traceLine.impl();
}
};
class TopCallFrameSetter {
public:
TopCallFrameSetter(JSGlobalData& global, CallFrame* callFrame)
......@@ -179,8 +128,6 @@ namespace JSC {
NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset);
NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset);
NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int);
static void getStackTrace(JSGlobalData*, int line, Vector<StackFrame>& results);
void dumpSampleData(ExecState* exec);
void startSampling();
......
......@@ -27,7 +27,6 @@
#include "CurrentTime.h"
#include "ExceptionHelpers.h"
#include "InitializeThreading.h"
#include "Interpreter.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSLock.h"
......@@ -74,7 +73,6 @@ static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>&
static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
#ifndef NDEBUG
static EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState*);
......@@ -176,7 +174,6 @@ protected:
addFunction(globalData, "run", functionRun, 1);
addFunction(globalData, "load", functionLoad, 1);
addFunction(globalData, "checkSyntax", functionCheckSyntax, 1);
addFunction(globalData, "jscStack", functionJSCStack, 1);
addFunction(globalData, "readline", functionReadline, 0);
addFunction(globalData, "preciseTime", functionPreciseTime, 0);
#if ENABLE(SAMPLING_FLAGS)
......@@ -224,22 +221,6 @@ EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState* exec)
{
String trace = "--> Stack trace:\n";
Vector<StackFrame> stackTrace;
Interpreter::getStackTrace(&exec->globalData(), -1, stackTrace);
int i = 0;
for (Vector<StackFrame>::iterator iter = stackTrace.begin(); iter < stackTrace.end(); iter++) {
StackFrame level = *iter;
trace += String::format(" %i %s\n", i, level.toString().utf8().data());
i++;
}
fprintf(stderr, "%s", trace.utf8().data());
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
{
JSLock lock(SilenceAssertionsOnly);
......
......@@ -114,7 +114,7 @@ namespace JSC {
else if (isEvalNode<ParsedNode>())
*exception = createSyntaxError(lexicalGlobalObject, errMsg);
else
*exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source, Vector<StackFrame>());
*exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source);
}
m_arena.reset();
......
......@@ -52,7 +52,6 @@
macro(input) \
macro(isArray) \
macro(isPrototypeOf) \
macro(jscStack) \
macro(length) \
macro(message) \
macro(multiline) \
......
......@@ -26,7 +26,6 @@
#include "ConstructData.h"
#include "ErrorConstructor.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "JSObject.h"
......@@ -117,7 +116,7 @@ JSObject* createURIError(ExecState* exec, const UString& message)
return createURIError(exec->lexicalGlobalObject(), message);
}
JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace)
JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source)
{
intptr_t sourceID = source.provider()->asID();
const UString& sourceURL = source.provider()->url();
......@@ -128,21 +127,13 @@ JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, cons
error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber((double)sourceID), ReadOnly | DontDelete);
if (!sourceURL.isNull())
error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete);
if (!stackTrace.isEmpty()) {
JSArray* stackTraceArray = JSArray::create(*globalData, globalData->dynamicGlobalObject->arrayStructure());
for (unsigned i = 0; i < stackTrace.size(); i++) {
UString stackLevel = stackTrace[i].toString();
stackTraceArray->push(globalData->topCallFrame, jsString(globalData, stackLevel));
}
error->putWithAttributes(globalData, globalData->propertyNames->jscStack, stackTraceArray, ReadOnly | DontDelete);
}
return error;
}
JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source, const Vector<StackFrame>& stackTrace)
JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source)
{
return addErrorInfo(&exec->globalData(), error, line, source, stackTrace);
return addErrorInfo(&exec->globalData(), error, line, source);
}
bool hasErrorInfo(ExecState* exec, JSObject* error)
......
......@@ -23,7 +23,6 @@
#ifndef Error_h
#define Error_h
#include "Interpreter.h"
#include "JSObject.h"
#include <stdint.h>
......@@ -56,9 +55,9 @@ namespace JSC {
// Methods to add
bool hasErrorInfo(ExecState*, JSObject* error);
JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&);
JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&);
// ExecState wrappers.
JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&, const Vector<StackFrame>&);
JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
// Methods to throw Errors.
JSValue throwError(ExecState*, JSValue);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment