Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index de7a0bd0264894755c6d3f02d9baaadbff37e1f6..cee05b7e2d1472d1ff12e46bd1d7a343633f8f6e 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -727,12 +727,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); |
} |
@@ -740,7 +750,7 @@ void Interpreter::DoAdd(InterpreterAssembler* assembler) { |
// |
// Subtract register <src> from accumulator. |
void Interpreter::DoSub(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Subtract(isolate_), assembler); |
+ DoBinaryOp<SubtractStub>(assembler); |
} |
@@ -748,7 +758,7 @@ void Interpreter::DoSub(InterpreterAssembler* assembler) { |
// |
// Multiply accumulator by register <src>. |
void Interpreter::DoMul(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Multiply(isolate_), assembler); |
+ DoBinaryOp<MultiplyStub>(assembler); |
} |
@@ -756,7 +766,7 @@ void Interpreter::DoMul(InterpreterAssembler* assembler) { |
// |
// Divide register <src> by accumulator. |
void Interpreter::DoDiv(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Divide(isolate_), assembler); |
+ DoBinaryOp<DivideStub>(assembler); |
} |
@@ -764,7 +774,7 @@ void Interpreter::DoDiv(InterpreterAssembler* assembler) { |
// |
// Modulo register <src> by accumulator. |
void Interpreter::DoMod(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::Modulus(isolate_), assembler); |
+ DoBinaryOp<ModulusStub>(assembler); |
} |
@@ -772,7 +782,7 @@ void Interpreter::DoMod(InterpreterAssembler* assembler) { |
// |
// BitwiseOr register <src> to accumulator. |
void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseOr(isolate_), assembler); |
+ DoBinaryOp<BitwiseOrStub>(assembler); |
} |
@@ -780,7 +790,7 @@ void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { |
// |
// BitwiseXor register <src> to accumulator. |
void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseXor(isolate_), assembler); |
+ DoBinaryOp<BitwiseXorStub>(assembler); |
} |
@@ -788,7 +798,7 @@ void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { |
// |
// BitwiseAnd register <src> to accumulator. |
void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) { |
- DoBinaryOp(CodeFactory::BitwiseAnd(isolate_), assembler); |
+ DoBinaryOp<BitwiseAndStub>(assembler); |
} |
@@ -799,7 +809,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); |
} |
@@ -810,7 +820,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); |
} |
@@ -821,7 +831,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, |