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

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

Issue 2336643002: [Interpreter] Move context chain search loop to handler (Closed)
Patch Set: Fix documentation nits Created 4 years, 3 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-assembler.h" 5 #include "src/interpreter/interpreter-assembler.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 Node* InterpreterAssembler::GetContext() { 79 Node* InterpreterAssembler::GetContext() {
80 return LoadRegister(Register::current_context()); 80 return LoadRegister(Register::current_context());
81 } 81 }
82 82
83 void InterpreterAssembler::SetContext(Node* value) { 83 void InterpreterAssembler::SetContext(Node* value) {
84 StoreRegister(value, Register::current_context()); 84 StoreRegister(value, Register::current_context());
85 } 85 }
86 86
87 Node* InterpreterAssembler::GetContextAtDepth(Node* context, Node* depth) {
88 Variable cur_context(this, MachineRepresentation::kTaggedPointer);
89 cur_context.Bind(context);
90
91 Variable cur_depth(this, MachineRepresentation::kWord32);
92 cur_depth.Bind(depth);
93
94 Label context_found(this);
95
96 Variable* context_search_loop_variables[2] = {&cur_depth, &cur_context};
97 Label context_search(this, 2, context_search_loop_variables);
98
99 // Fast path if the depth is 0.
100 BranchIfWord32Equal(depth, Int32Constant(0), &context_found, &context_search);
101
102 // Loop until the depth is 0.
103 Bind(&context_search);
104 {
105 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
106 cur_context.Bind(
107 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
108
109 BranchIfWord32Equal(cur_depth.value(), Int32Constant(0), &context_found,
110 &context_search);
111 }
112
113 Bind(&context_found);
114 return cur_context.value();
115 }
116
87 Node* InterpreterAssembler::BytecodeOffset() { 117 Node* InterpreterAssembler::BytecodeOffset() {
88 return bytecode_offset_.value(); 118 return bytecode_offset_.value();
89 } 119 }
90 120
91 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { 121 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
92 if (made_call_) { 122 if (made_call_) {
93 // If we have made a call, restore bytecode array from stack frame in case 123 // If we have made a call, restore bytecode array from stack frame in case
94 // the debugger has swapped us to the patched debugger bytecode array. 124 // the debugger has swapped us to the patched debugger bytecode array.
95 return LoadRegister(Register::bytecode_array()); 125 return LoadRegister(Register::bytecode_array());
96 } else { 126 } else {
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 Goto(&loop); 1354 Goto(&loop);
1325 } 1355 }
1326 Bind(&done_loop); 1356 Bind(&done_loop);
1327 1357
1328 return array; 1358 return array;
1329 } 1359 }
1330 1360
1331 } // namespace interpreter 1361 } // namespace interpreter
1332 } // namespace internal 1362 } // namespace internal
1333 } // namespace v8 1363 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | test/cctest/interpreter/bytecode_expectations/BasicLoops.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698