diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index ee1a170074..4ab7571f1c 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1752,13 +1752,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { } -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { - LOperand* context = UseFixed(instr->context(), cp); - LOperand* value = UseFixed(instr->value(), r0); - return MarkAsCall(new(zone()) LThrow(context, value), instr); -} - - LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { return NULL; } diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 53471cf952..1a9262d025 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -167,7 +167,6 @@ class LCodeGen; V(RSubI) \ V(TaggedToI) \ V(ThisFunction) \ - V(Throw) \ V(ToFastProperties) \ V(TransitionElementsKind) \ V(TrapAllocationMemento) \ @@ -1348,20 +1347,6 @@ class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> { }; -class LThrow V8_FINAL : public LTemplateInstruction<0, 2, 0> { - public: - LThrow(LOperand* context, LOperand* value) { - inputs_[0] = context; - inputs_[1] = value; - } - - LOperand* context() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } - - DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") -}; - - class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> { public: LAddI(LOperand* left, LOperand* right) { diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 0ca7db4c26..bc73e6ee84 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -1979,17 +1979,6 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { } -void LCodeGen::DoThrow(LThrow* instr) { - __ push(ToRegister(instr->value())); - ASSERT(ToRegister(instr->context()).is(cp)); - CallRuntime(Runtime::kThrow, 1, instr); - - if (FLAG_debug_code) { - __ stop("Unreachable code."); - } -} - - void LCodeGen::DoAddI(LAddI* instr) { LOperand* left = instr->left(); LOperand* right = instr->right(); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 8c8b6c535d..93e49082bf 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -171,7 +171,6 @@ class LChunkBuilder; V(StringCompareAndBranch) \ V(Sub) \ V(ThisFunction) \ - V(Throw) \ V(ToFastProperties) \ V(TransitionElementsKind) \ V(TrapAllocationMemento) \ @@ -1640,28 +1639,6 @@ class HUnaryOperation : public HTemplateInstruction<1> { }; -class HThrow V8_FINAL : public HTemplateInstruction<2> { - public: - DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HThrow, HValue*); - - virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { - return Representation::Tagged(); - } - - HValue* context() { return OperandAt(0); } - HValue* value() { return OperandAt(1); } - - DECLARE_CONCRETE_INSTRUCTION(Throw) - - private: - HThrow(HValue* context, HValue* value) { - SetOperandAt(0, context); - SetOperandAt(1, value); - SetAllSideEffects(); - } -}; - - class HUseConst V8_FINAL : public HUnaryOperation { public: DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index e38d9f3b92..74262b965c 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -6254,7 +6254,9 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) { HValue* value = environment()->Pop(); if (!FLAG_emit_opt_code_positions) SetSourcePosition(expr->position()); - Add(value); + Add(value); + Add(isolate()->factory()->empty_string(), + Runtime::FunctionForId(Runtime::kThrow), 1); Add(expr->id()); // If the throw definitely exits the function, we can finish with a dummy diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index b7cd7bb8ab..417ed8834b 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -2089,18 +2089,6 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { } -void LCodeGen::DoThrow(LThrow* instr) { - __ push(ToOperand(instr->value())); - ASSERT(ToRegister(instr->context()).is(esi)); - CallRuntime(Runtime::kThrow, 1, instr); - - if (FLAG_debug_code) { - Comment("Unreachable code."); - __ int3(); - } -} - - void LCodeGen::DoAddI(LAddI* instr) { LOperand* left = instr->left(); LOperand* right = instr->right(); diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index c5e29726ca..e6773a9fe3 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1766,13 +1766,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { } -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { - LOperand* context = UseFixed(instr->context(), esi); - LOperand* value = UseFixed(instr->value(), eax); - return MarkAsCall(new(zone()) LThrow(context, value), instr); -} - - LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { return NULL; } diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 1f70291538..8ec520321e 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -166,7 +166,6 @@ class LCodeGen; V(SubI) \ V(TaggedToI) \ V(ThisFunction) \ - V(Throw) \ V(ToFastProperties) \ V(TransitionElementsKind) \ V(TrapAllocationMemento) \ @@ -1323,20 +1322,6 @@ class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> { }; -class LThrow V8_FINAL : public LTemplateInstruction<0, 2, 0> { - public: - LThrow(LOperand* context, LOperand* value) { - inputs_[0] = context; - inputs_[1] = value; - } - - LOperand* context() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } - - DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") -}; - - class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> { public: LAddI(LOperand* left, LOperand* right) { diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index ff6d4c4e93..15f9a0b380 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -1788,17 +1788,6 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { } -void LCodeGen::DoThrow(LThrow* instr) { - __ push(ToRegister(instr->value())); - ASSERT(ToRegister(instr->context()).is(cp)); - CallRuntime(Runtime::kThrow, 1, instr); - - if (FLAG_debug_code) { - __ stop("Unreachable code."); - } -} - - void LCodeGen::DoAddI(LAddI* instr) { LOperand* left = instr->left(); LOperand* right = instr->right(); diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index ee2f63adfc..e22e949bb5 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -1680,13 +1680,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { } -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { - LOperand* context = UseFixed(instr->context(), cp); - LOperand* value = UseFixed(instr->value(), a0); - return MarkAsCall(new(zone()) LThrow(context, value), instr); -} - - LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { return NULL; } diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index a9ac04b702..19dca48537 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -165,7 +165,6 @@ class LCodeGen; V(SubI) \ V(TaggedToI) \ V(ThisFunction) \ - V(Throw) \ V(ToFastProperties) \ V(TransitionElementsKind) \ V(TrapAllocationMemento) \ @@ -1328,20 +1327,6 @@ class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> { }; -class LThrow V8_FINAL : public LTemplateInstruction<0, 2, 0> { - public: - LThrow(LOperand* context, LOperand* value) { - inputs_[0] = context; - inputs_[1] = value; - } - - LOperand* context() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } - - DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") -}; - - class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> { public: LAddI(LOperand* left, LOperand* right) { diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index a7fea8c8f9..eca0dc32bd 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1694,18 +1694,6 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { } -void LCodeGen::DoThrow(LThrow* instr) { - __ push(ToRegister(instr->value())); - ASSERT(ToRegister(instr->context()).is(rsi)); - CallRuntime(Runtime::kThrow, 1, instr); - - if (FLAG_debug_code) { - Comment("Unreachable code."); - __ int3(); - } -} - - void LCodeGen::DoAddI(LAddI* instr) { LOperand* left = instr->left(); LOperand* right = instr->right(); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index a5a06f03ae..218b6cfbce 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1659,13 +1659,6 @@ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { } -LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { - LOperand* context = UseFixed(instr->context(), rsi); - LOperand* value = UseFixed(instr->value(), rax); - return MarkAsCall(new(zone()) LThrow(context, value), instr); -} - - LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { return NULL; } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index f57c244ac1..ca187a183d 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -164,7 +164,6 @@ class LCodeGen; V(SubI) \ V(TaggedToI) \ V(ThisFunction) \ - V(Throw) \ V(ToFastProperties) \ V(TransitionElementsKind) \ V(TrapAllocationMemento) \ @@ -1287,20 +1286,6 @@ class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> { }; -class LThrow V8_FINAL : public LTemplateInstruction<0, 2, 0> { - public: - explicit LThrow(LOperand* context, LOperand* value) { - inputs_[0] = context; - inputs_[1] = value; - } - - LOperand* context() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } - - DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") -}; - - class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> { public: LAddI(LOperand* left, LOperand* right) {