Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 2b3171f31f8f1a1bd0762227101aeb814794acd7..2919cf02a284f957b28ce9dad5aaad7bc4e97bea 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -508,6 +508,32 @@ void Interpreter::DoShiftRightLogical( |
} |
+void Interpreter::DoCountOp(Runtime::FunctionId function_id, |
+ compiler::InterpreterAssembler* assembler) { |
+ Node* value = __ GetAccumulator(); |
+ Node* one = __ NumberConstant(1); |
+ Node* result = __ CallRuntime(function_id, value, one); |
+ __ SetAccumulator(result); |
+ __ Dispatch(); |
+} |
+ |
+ |
+// Inc |
+// |
+// Increments value in the accumulator by one. |
+void Interpreter::DoInc(compiler::InterpreterAssembler* assembler) { |
+ DoCountOp(Runtime::kAdd, assembler); |
+} |
+ |
+ |
+// Dec |
+// |
+// Decrements value in the accumulator by one. |
+void Interpreter::DoDec(compiler::InterpreterAssembler* assembler) { |
+ DoCountOp(Runtime::kSubtract, assembler); |
+} |
+ |
+ |
// LogicalNot |
// |
// Perform logical-not on the accumulator, first casting the |
@@ -693,6 +719,17 @@ void Interpreter::DoToName(compiler::InterpreterAssembler* assembler) { |
} |
+// ToNumber |
+// |
+// Cast the object referenced by the accumulator to a number. |
+void Interpreter::DoToNumber(compiler::InterpreterAssembler* assembler) { |
+ Node* accumulator = __ GetAccumulator(); |
+ Node* result = __ CallRuntime(Runtime::kToNumber, accumulator); |
+ __ SetAccumulator(result); |
+ __ Dispatch(); |
+} |
+ |
+ |
// Jump <imm8> |
// |
// Jump by number of bytes represented by the immediate operand |imm8|. |