From 54fc571caf61b81442449f5586276cf782488cdd Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 7 Sep 2009 14:26:48 +0200 Subject: Fix QScriptEngineAgent::functionExit (JIT enabled) Event functionExit was fixed, now returnValue is correctly passed as an argument to debugger. Few QEXCEPT_FAIL were removed from autotest. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp | 1 + src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 4 +++- tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 16 ---------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index dc192f0..da541c5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -287,6 +287,7 @@ void JIT::emit_op_ret(Instruction* currentInstruction) { #ifdef QT_BUILD_SCRIPT_LIB JITStubCall stubCall(this, JITStubs::cti_op_debug_return); + stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.call(); #endif // We could JIT generate the deref, only calling out to C when the refcount hits zero. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index c84d115..0a5eb07 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2758,7 +2758,9 @@ DEFINE_STUB_FUNCTION(void, op_debug_return) STUB_INIT_STACK_FRAME(stackFrame); CallFrame* callFrame = stackFrame.callFrame; if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { - debugger->functionExit(JSValue(), callFrame->codeBlock()->ownerNode()->sourceID()); + JSValue returnValue = callFrame->r(stackFrame.args[0].int32()).jsValue(); + intptr_t sourceID = callFrame->codeBlock()->ownerNode()->sourceID(); + debugger->functionExit(returnValue, sourceID); } } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 96277b3..75f7a12 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -589,11 +589,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() // anonymous function exit QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(2).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(2).value.toNumber(), qsreal(123)); // evaluate() exit @@ -670,11 +666,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() // foo() exit QCOMPARE(spy->at(4).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(4).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(4).value.toNumber(), qsreal(456)); // evaluate() exit @@ -1059,11 +1051,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() // exit QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(1).value.isNumber()); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(1).value.toNumber(), qsreal(123)); } delete spy; @@ -1812,16 +1800,12 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(15).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(15).scriptId, spy->at(3).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(15).value.isNumber()); // restore context QCOMPARE(spy->at(16).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(17).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(17).scriptId, spy->at(0).scriptId); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(17).value.isNumber()); // restore context QCOMPARE(spy->at(18).type, ScriptEngineEvent::ContextPop); -- cgit v0.12