| Index: src/interpreter/interpreter.cc
|
| diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
|
| index 6598f0ec754fabf93f58b5b48dd777cb210c4d6d..fd590fddd46728e4b2f16edc86b2c1bbeae069d0 100644
|
| --- a/src/interpreter/interpreter.cc
|
| +++ b/src/interpreter/interpreter.cc
|
| @@ -1102,7 +1102,8 @@ void Interpreter::DoToNumber(compiler::InterpreterAssembler* assembler) {
|
| // Cast the object referenced by the accumulator to a JSObject.
|
| void Interpreter::DoToObject(compiler::InterpreterAssembler* assembler) {
|
| Node* accumulator = __ GetAccumulator();
|
| - Node* result = __ CallRuntime(Runtime::kToObject, accumulator);
|
| + Node* result =
|
| + __ CallRuntime(Runtime::kInterpreterToObjectOrNull, accumulator);
|
| __ SetAccumulator(result);
|
| __ Dispatch();
|
| }
|
| @@ -1451,33 +1452,39 @@ void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
|
| }
|
|
|
|
|
| -// ForInPrepare <receiver>
|
| +// ForInPrepare <receiver> <cache_type> <cache_array> <cache_length>
|
| //
|
| -// Returns state for for..in loop execution based on the |receiver| and
|
| -// the property names in the accumulator.
|
| +// Returns state for for..in loop execution based on the object in the
|
| +// accumulator.
|
| +// The |receiver| is an input parameter.
|
| +// |cache_type|, |cache_array|, and |cache_length| are all output parameters.
|
| void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) {
|
| - Node* receiver_reg = __ BytecodeOperandReg(0);
|
| - Node* receiver = __ LoadRegister(receiver_reg);
|
| - Node* property_names = __ GetAccumulator();
|
| - Node* result = __ CallRuntime(Runtime::kInterpreterForInPrepare, receiver,
|
| - property_names);
|
| + // Call runtime to set-up ForInPrepareState
|
| + Node* object = __ GetAccumulator();
|
| + Node* result = __ CallRuntime(Runtime::kInterpreterForInPrepare, object);
|
| +
|
| + for (int i = 0; i < 3; i++) {
|
| + // 0 == receiver, 1 == cache_type, 2 == cache_array, 3 == cache_length
|
| + Node* cache_info = __ LoadFixedArrayElement(result, i);
|
| + Node* cache_info_reg = __ BytecodeOperandReg(i + 1);
|
| + __ StoreRegister(cache_info, cache_info_reg);
|
| + }
|
| __ SetAccumulator(result);
|
| __ Dispatch();
|
| }
|
|
|
|
|
| -// ForInNext <for_in_state> <index>
|
| +// ForInNext <receiver> <cache_type> <cache_array> <index>
|
| //
|
| -// 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* index_reg = __ BytecodeOperandReg(1);
|
| + Node* receiver_reg = __ BytecodeOperandReg(0);
|
| + Node* receiver = __ LoadRegister(receiver_reg);
|
| + Node* cache_type_reg = __ BytecodeOperandReg(1);
|
| + Node* cache_type = __ LoadRegister(cache_type_reg);
|
| + Node* cache_array_reg = __ BytecodeOperandReg(2);
|
| + Node* cache_array = __ LoadRegister(cache_array_reg);
|
| + Node* index_reg = __ BytecodeOperandReg(3);
|
| Node* index = __ LoadRegister(index_reg);
|
| Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array,
|
| cache_type, index);
|
| @@ -1486,22 +1493,34 @@ 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);
|
| + // TODO(oth): Implement directly rather than runtime call.
|
| + 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) {
|
| + // TODO(oth): Implement directly rather than runtime call.
|
| + 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
|
|
|