diff options
-rw-r--r-- | moth/qv4instr_moth_p.h | 1 | ||||
-rw-r--r-- | moth/qv4isel_moth.cpp | 7 | ||||
-rw-r--r-- | moth/qv4isel_moth_p.h | 1 | ||||
-rw-r--r-- | moth/qv4vme_moth.cpp | 3 | ||||
-rw-r--r-- | qmljs_runtime.cpp | 6 | ||||
-rw-r--r-- | qv4codegen.cpp | 21 | ||||
-rw-r--r-- | qv4ir.cpp | 2 | ||||
-rw-r--r-- | qv4ir_p.h | 1 | ||||
-rw-r--r-- | qv4isel_llvm_p.h | 1 | ||||
-rw-r--r-- | qv4isel_masm.cpp | 5 | ||||
-rw-r--r-- | qv4isel_masm_p.h | 1 | ||||
-rw-r--r-- | qv4isel_p.cpp | 4 | ||||
-rw-r--r-- | qv4isel_p.h | 1 | ||||
-rw-r--r-- | tests/TestExpectations | 5 |
14 files changed, 13 insertions, 46 deletions
diff --git a/moth/qv4instr_moth_p.h b/moth/qv4instr_moth_p.h index d20b84e5a8..07016cca00 100644 --- a/moth/qv4instr_moth_p.h +++ b/moth/qv4instr_moth_p.h @@ -164,7 +164,6 @@ union Instr MOTH_INSTR_HEADER enum { builtin_throw, - builtin_rethrow, builtin_create_exception_handler, builtin_delete_exception_handler, builtin_get_exception, diff --git a/moth/qv4isel_moth.cpp b/moth/qv4isel_moth.cpp index 2acdb88709..2626955cfc 100644 --- a/moth/qv4isel_moth.cpp +++ b/moth/qv4isel_moth.cpp @@ -766,13 +766,6 @@ void InstructionSelection::callBuiltinThrow(IR::Temp *arg) addInstruction(call); } -void InstructionSelection::callBuiltinRethrow() -{ - Instruction::CallBuiltin call; - call.builtin = Instruction::CallBuiltin::builtin_rethrow; - addInstruction(call); -} - void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result) { Instruction::CallBuiltin call; diff --git a/moth/qv4isel_moth_p.h b/moth/qv4isel_moth_p.h index 6cac936534..8225721190 100644 --- a/moth/qv4isel_moth_p.h +++ b/moth/qv4isel_moth_p.h @@ -34,7 +34,6 @@ protected: virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result); virtual void callBuiltinDeleteValue(IR::Temp *result); virtual void callBuiltinThrow(IR::Temp *arg); - virtual void callBuiltinRethrow(); virtual void callBuiltinCreateExceptionHandler(IR::Temp *result); virtual void callBuiltinDeleteExceptionHandler(); virtual void callBuiltinGetException(IR::Temp *result); diff --git a/moth/qv4vme_moth.cpp b/moth/qv4vme_moth.cpp index dff4db68a8..fab02c4dc8 100644 --- a/moth/qv4vme_moth.cpp +++ b/moth/qv4vme_moth.cpp @@ -249,9 +249,6 @@ VM::Value VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *co TRACE(builtin_throw, "Throwing now...%s", ""); __qmljs_builtin_throw(TEMP(instr.argTemp), context); break; - case Instr::instr_callBuiltin::builtin_rethrow: - __qmljs_builtin_rethrow(context); - break; case Instr::instr_callBuiltin::builtin_create_exception_handler: { TRACE(builtin_create_exception_handler, "%s", ""); void *buf = __qmljs_create_exception_handler(context); diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp index f23a93e73a..1accdea488 100644 --- a/qmljs_runtime.cpp +++ b/qmljs_runtime.cpp @@ -900,12 +900,6 @@ void __qmljs_builtin_throw(Value val, ExecutionContext *context) __qmljs_throw(val, context); } -void __qmljs_builtin_rethrow(ExecutionContext *context) -{ - __qmljs_throw(context->engine->exception, context); -} - - void __qmljs_builtin_push_with(Value o, ExecutionContext *ctx) { Object *obj = __qmljs_to_object(o, ctx).asObject(); diff --git a/qv4codegen.cpp b/qv4codegen.cpp index 3bc545d994..07d874f490 100644 --- a/qv4codegen.cpp +++ b/qv4codegen.cpp @@ -2347,6 +2347,10 @@ bool Codegen::visit(ThrowStatement *ast) bool Codegen::visit(TryStatement *ast) { + if (_function->isStrict && ast->catchExpression && + (ast->catchExpression->name == QLatin1String("eval") || ast->catchExpression->name == QLatin1String("arguments"))) + throwSyntaxError(ast->catchExpression->identifierToken, QCoreApplication::translate("qv4codegen", "Catch variable name may not be eval or arguments in strict mode")); + IR::BasicBlock *tryBody = _function->newBasicBlock(); IR::BasicBlock *catchBody = ast->catchExpression ? _function->newBasicBlock() : 0; // We always need a finally body to clean up the exception handler @@ -2421,17 +2425,18 @@ bool Codegen::visit(TryStatement *ast) _block = finallyBody; _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_delete_exception_handler, 0, 0), deleteExceptionArgs)); + int exception_to_rethrow = _block->newTemp(); + move(_block->TEMP(exception_to_rethrow), _block->CALL(_block->NAME(IR::Name::builtin_get_exception, 0, 0), 0)); + if (ast->finallyExpression && ast->finallyExpression->statement) statement(ast->finallyExpression->statement); - if (!catchBody) { - IR::BasicBlock *rethrowBlock = _function->newBasicBlock(); - _block->CJUMP(_block->TEMP(hasException), rethrowBlock, after); - _block = rethrowBlock; - _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_rethrow, 0, 0), 0)); - } else { - _block->CJUMP(_block->TEMP(hasException), _throwBlock, after); - } + IR::BasicBlock *rethrowBlock = _function->newBasicBlock(); + _block->CJUMP(_block->TEMP(hasException), rethrowBlock, after); + _block = rethrowBlock; + move(_block->TEMP(_returnAddress), _block->TEMP(exception_to_rethrow)); + _block->JUMP(_throwBlock); + _block = after; return false; @@ -226,8 +226,6 @@ static const char *builtin_to_string(Name::Builtin b) return "builtin_delete"; case Name::builtin_throw: return "builtin_throw"; - case Name::builtin_rethrow: - return "builtin_rethrow"; case Name::builtin_create_exception_handler: return "builtin_create_exception_handler"; case Name::builtin_delete_exception_handler: @@ -276,7 +276,6 @@ struct Name: Expr { builtin_typeof, builtin_delete, builtin_throw, - builtin_rethrow, builtin_create_exception_handler, builtin_delete_exception_handler, builtin_get_exception, diff --git a/qv4isel_llvm_p.h b/qv4isel_llvm_p.h index 78e54b680b..dbd6084033 100644 --- a/qv4isel_llvm_p.h +++ b/qv4isel_llvm_p.h @@ -80,7 +80,6 @@ public: // methods from InstructionSelection: virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result); virtual void callBuiltinDeleteValue(IR::Temp *result); virtual void callBuiltinThrow(IR::Temp *arg); - virtual void callBuiltinRethrow(); virtual void callBuiltinCreateExceptionHandler(IR::Temp *result); virtual void callBuiltinDeleteExceptionHandler(); virtual void callBuiltinGetException(IR::Temp *result); diff --git a/qv4isel_masm.cpp b/qv4isel_masm.cpp index 2e60f720aa..844f7864ae 100644 --- a/qv4isel_masm.cpp +++ b/qv4isel_masm.cpp @@ -483,11 +483,6 @@ void InstructionSelection::callBuiltinThrow(IR::Temp *arg) generateFunctionCall(Assembler::Void, __qmljs_builtin_throw, arg, Assembler::ContextRegister); } -void InstructionSelection::callBuiltinRethrow() -{ - generateFunctionCall(Assembler::Void, __qmljs_builtin_rethrow, Assembler::ContextRegister); -} - void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result) { generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_create_exception_handler, Assembler::ContextRegister); diff --git a/qv4isel_masm_p.h b/qv4isel_masm_p.h index 2300377c65..c0fdabf61c 100644 --- a/qv4isel_masm_p.h +++ b/qv4isel_masm_p.h @@ -662,7 +662,6 @@ protected: virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result); virtual void callBuiltinDeleteValue(IR::Temp *result); virtual void callBuiltinThrow(IR::Temp *arg); - virtual void callBuiltinRethrow(); virtual void callBuiltinCreateExceptionHandler(IR::Temp *result); virtual void callBuiltinDeleteExceptionHandler(); virtual void callBuiltinGetException(IR::Temp *result); diff --git a/qv4isel_p.cpp b/qv4isel_p.cpp index 9a694ae9a1..c4df10a2ef 100644 --- a/qv4isel_p.cpp +++ b/qv4isel_p.cpp @@ -268,10 +268,6 @@ void InstructionSelection::callBuiltin(IR::Call *call, IR::Temp *result) callBuiltinThrow(arg); } return; - case IR::Name::builtin_rethrow: - callBuiltinRethrow(); - return; - case IR::Name::builtin_create_exception_handler: callBuiltinCreateExceptionHandler(result); return; diff --git a/qv4isel_p.h b/qv4isel_p.h index 8181853bd6..1d71055136 100644 --- a/qv4isel_p.h +++ b/qv4isel_p.h @@ -90,7 +90,6 @@ public: // to implement by subclasses: virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result) = 0; virtual void callBuiltinDeleteValue(IR::Temp *result) = 0; virtual void callBuiltinThrow(IR::Temp *arg) = 0; - virtual void callBuiltinRethrow() = 0; virtual void callBuiltinCreateExceptionHandler(IR::Temp *result) = 0; virtual void callBuiltinDeleteExceptionHandler() = 0; virtual void callBuiltinGetException(IR::Temp *result) = 0; diff --git a/tests/TestExpectations b/tests/TestExpectations index fc90235157..427e158a2d 100644 --- a/tests/TestExpectations +++ b/tests/TestExpectations @@ -119,11 +119,6 @@ S11.9.4_A2.4_T1 failing S11.9.4_A2.4_T3 failing S11.9.5_A2.4_T1 failing S11.9.5_A2.4_T3 failing -S12.14_A7_T1 failing -S12.14_A7_T3 failing -12.14.1-1-s failing -12.14.1-2-s failing -12.14.1-3-s failing S12.10_A3.11_T1 failing S12.10_A3.11_T2 failing S12.10_A3.11_T3 failing |