Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 226ddbd8533bca6b28763f4e475a673c93d3642d..23083a99d2ebb58f29f31a601601431cb432a0e1 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -729,12 +729,22 @@ void Interpreter::DoBinaryOp(Runtime::FunctionId function_id, |
__ Dispatch(); |
} |
+template <class Generator> |
+void Interpreter::DoBinaryOp(InterpreterAssembler* assembler) { |
+ Node* reg_index = __ BytecodeOperandReg(0); |
+ Node* lhs = __ LoadRegister(reg_index); |
+ Node* rhs = __ GetAccumulator(); |
+ Node* context = __ GetContext(); |
+ Node* result = Generator::Generate(assembler, lhs, rhs, context); |
+ __ SetAccumulator(result); |
+ __ Dispatch(); |
+} |
// Add <src> |
// |
// Add register <src> to accumulator. |
void Interpreter::DoAdd(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Add(isolate_), assembler); |
+ DoBinaryOp<AddStub>(assembler); |
} |
@@ -742,7 +752,7 @@ void Interpreter::DoAdd(InterpreterAssembler* assembler) { |
// |
// Subtract register <src> from accumulator. |
void Interpreter::DoSub(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Subtract(isolate_), assembler); |
+ DoBinaryOp<SubtractStub>(assembler); |
} |
@@ -750,7 +760,7 @@ void Interpreter::DoSub(InterpreterAssembler* assembler) { |
// |
// Multiply accumulator by register <src>. |
void Interpreter::DoMul(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Multiply(isolate_), assembler); |
+ DoBinaryOp<MultiplyStub>(assembler); |
} |
@@ -758,7 +768,7 @@ void Interpreter::DoMul(InterpreterAssembler* assembler) { |
// |
// Divide register <src> by accumulator. |
void Interpreter::DoDiv(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Divide(isolate_), assembler); |
+ DoBinaryOp<DivideStub>(assembler); |
} |
@@ -766,7 +776,7 @@ void Interpreter::DoDiv(InterpreterAssembler* assembler) { |
// |
// Modulo register <src> by accumulator. |
void Interpreter::DoMod(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Modulus(isolate_), assembler); |
+ DoBinaryOp<ModulusStub>(assembler); |
} |
@@ -774,7 +784,7 @@ void Interpreter::DoMod(InterpreterAssembler* assembler) { |
// |
// BitwiseOr register <src> to accumulator. |
void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseOr(isolate_), assembler); |
+ DoBinaryOp<BitwiseOrStub>(assembler); |
} |
@@ -782,7 +792,7 @@ void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { |
// |
// BitwiseXor register <src> to accumulator. |
void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseXor(isolate_), assembler); |
+ DoBinaryOp<BitwiseXorStub>(assembler); |
} |
@@ -790,7 +800,7 @@ void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { |
// |
// BitwiseAnd register <src> to accumulator. |
void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseAnd(isolate_), assembler); |
+ DoBinaryOp<BitwiseAndStub>(assembler); |
} |
@@ -801,7 +811,7 @@ void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) { |
// before the operation. 5 lsb bits from the accumulator are used as count |
// i.e. <src> << (accumulator & 0x1F). |
void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::ShiftLeft(isolate_), assembler); |
+ DoBinaryOp<ShiftLeftStub>(assembler); |
} |
@@ -812,7 +822,7 @@ void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) { |
// accumulator to uint32 before the operation. 5 lsb bits from the accumulator |
// are used as count i.e. <src> >> (accumulator & 0x1F). |
void Interpreter::DoShiftRight(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::ShiftRight(isolate_), assembler); |
+ DoBinaryOp<ShiftRightStub>(assembler); |
} |
@@ -823,7 +833,7 @@ void Interpreter::DoShiftRight(InterpreterAssembler* assembler) { |
// uint32 before the operation 5 lsb bits from the accumulator are used as |
// count i.e. <src> << (accumulator & 0x1F). |
void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::ShiftRightLogical(isolate_), assembler); |
+ DoBinaryOp<ShiftRightLogicalStub>(assembler); |
} |
void Interpreter::DoCountOp(Callable callable, |