Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index b1bd1976339f2c37e451cde252565d75c289d5d3..dac2a491a8b7079a5877e98a5ce75a70f864621d 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -1465,19 +1465,18 @@ void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { |
} |
-// ForInNext <for_in_state> <index> |
+// ForInNext <receiver> <index> <cache_type> <cache_array> |
// |
-// Returns the next key in a for..in loop. The state associated with the |
-// iteration is contained in |for_in_state| and |index| is the current |
-// zero-based iteration count. |
+// Returns the next key in a for..in loop. |
void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { |
- Node* for_in_state_reg = __ BytecodeOperandReg(0); |
- Node* for_in_state = __ LoadRegister(for_in_state_reg); |
- Node* receiver = __ LoadFixedArrayElement(for_in_state, 0); |
- Node* cache_array = __ LoadFixedArrayElement(for_in_state, 1); |
- Node* cache_type = __ LoadFixedArrayElement(for_in_state, 2); |
+ Node* receiver_reg = __ BytecodeOperandReg(0); |
+ Node* receiver = __ LoadRegister(receiver_reg); |
Node* index_reg = __ BytecodeOperandReg(1); |
Node* index = __ LoadRegister(index_reg); |
+ Node* cache_type_reg = __ BytecodeOperandReg(2); |
+ Node* cache_type = __ LoadRegister(cache_type_reg); |
+ Node* cache_array_reg = __ BytecodeOperandReg(3); |
+ Node* cache_array = __ LoadRegister(cache_array_reg); |
Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, |
cache_type, index); |
__ SetAccumulator(result); |
@@ -1485,22 +1484,32 @@ void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { |
} |
-// ForInDone <for_in_state> |
+// ForInDone <index> <cache_length> |
// |
-// Returns the next key in a for..in loop. The accumulator contains the current |
-// zero-based iteration count and |for_in_state| is the state returned by an |
-// earlier invocation of ForInPrepare. |
+// Returns the next key in a for..in loop. |
void Interpreter::DoForInDone(compiler::InterpreterAssembler* assembler) { |
- Node* index = __ GetAccumulator(); |
- Node* for_in_state_reg = __ BytecodeOperandReg(0); |
- Node* for_in_state = __ LoadRegister(for_in_state_reg); |
- Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
+ Node* index_reg = __ BytecodeOperandReg(0); |
+ Node* index = __ LoadRegister(index_reg); |
+ Node* cache_length_reg = __ BytecodeOperandReg(1); |
+ Node* cache_length = __ LoadRegister(cache_length_reg); |
Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
__ SetAccumulator(result); |
__ Dispatch(); |
} |
+// ForInStep <index> |
+// |
+// Increments the loop counter |index|. |
+void Interpreter::DoForInStep(compiler::InterpreterAssembler* assembler) { |
+ Node* index_reg = __ BytecodeOperandReg(0); |
+ Node* index = __ LoadRegister(index_reg); |
+ Node* result = __ CallRuntime(Runtime::kForInStep, index); |
+ __ StoreRegister(result, index_reg); |
+ __ Dispatch(); |
+} |
+ |
+ |
} // namespace interpreter |
} // namespace internal |
} // namespace v8 |