Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1576093004: [Interpreter] Add ForInPrepare runtime function which returns a ObjectTriple. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment and variable name tweaks Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/interpreter-assembler.h" 9 #include "src/compiler/interpreter-assembler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 } 1691 }
1692 1692
1693 1693
1694 // ForInPrepare <cache_type> <cache_array> <cache_length> 1694 // ForInPrepare <cache_type> <cache_array> <cache_length>
1695 // 1695 //
1696 // Returns state for for..in loop execution based on the object in the 1696 // Returns state for for..in loop execution based on the object in the
1697 // accumulator. The registers |cache_type|, |cache_array|, and 1697 // accumulator. The registers |cache_type|, |cache_array|, and
1698 // |cache_length| represent output parameters. 1698 // |cache_length| represent output parameters.
1699 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { 1699 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) {
1700 Node* object = __ GetAccumulator(); 1700 Node* object = __ GetAccumulator();
1701 Node* result = __ CallRuntime(Runtime::kInterpreterForInPrepare, object); 1701 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object);
1702
1703 // Set output registers:
1704 // 0 == cache_type, 1 == cache_array, 2 == cache_length
1702 for (int i = 0; i < 3; i++) { 1705 for (int i = 0; i < 3; i++) {
1703 // 0 == cache_type, 1 == cache_array, 2 == cache_length 1706 Node* cache_info = __ Projection(i, result_triple);
1704 Node* cache_info = __ LoadFixedArrayElement(result, i);
1705 Node* cache_info_reg = __ BytecodeOperandReg(i); 1707 Node* cache_info_reg = __ BytecodeOperandReg(i);
1706 __ StoreRegister(cache_info, cache_info_reg); 1708 __ StoreRegister(cache_info, cache_info_reg);
1707 } 1709 }
1708 __ SetAccumulator(result); 1710
1709 __ Dispatch(); 1711 __ Dispatch();
1710 } 1712 }
1711 1713
1712 1714
1713 // ForInNext <receiver> <cache_type> <cache_array> <index> 1715 // ForInNext <receiver> <cache_type> <cache_array> <index>
1714 // 1716 //
1715 // Returns the next enumerable property in the the accumulator. 1717 // Returns the next enumerable property in the the accumulator.
1716 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { 1718 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) {
1717 Node* receiver_reg = __ BytecodeOperandReg(0); 1719 Node* receiver_reg = __ BytecodeOperandReg(0);
1718 Node* receiver = __ LoadRegister(receiver_reg); 1720 Node* receiver = __ LoadRegister(receiver_reg);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 Node* index_reg = __ BytecodeOperandReg(0); 1755 Node* index_reg = __ BytecodeOperandReg(0);
1754 Node* index = __ LoadRegister(index_reg); 1756 Node* index = __ LoadRegister(index_reg);
1755 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1757 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1756 __ SetAccumulator(result); 1758 __ SetAccumulator(result);
1757 __ Dispatch(); 1759 __ Dispatch();
1758 } 1760 }
1759 1761
1760 } // namespace interpreter 1762 } // namespace interpreter
1761 } // namespace internal 1763 } // namespace internal
1762 } // namespace v8 1764 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698