Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 7f9bf8129895501462a08fedfcb1acec1d97bd95..5778358196c8ac5d964f35c08e53cafe06524cf6 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -591,6 +591,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 |
@@ -776,6 +802,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|. |