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

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

Issue 2343633002: [interpreter] Add a fast path for dynamic local load (Closed)
Patch Set: Disable clang format for the new test 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX)); 107 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
108 108
109 BranchIfWord32Equal(cur_depth.value(), Int32Constant(0), &context_found, 109 BranchIfWord32Equal(cur_depth.value(), Int32Constant(0), &context_found,
110 &context_search); 110 &context_search);
111 } 111 }
112 112
113 Bind(&context_found); 113 Bind(&context_found);
114 return cur_context.value(); 114 return cur_context.value();
115 } 115 }
116 116
117 void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(Node* context,
118 Node* depth,
119 Label* target) {
120 Variable cur_context(this, MachineRepresentation::kTaggedPointer);
121 cur_context.Bind(context);
122
123 Variable cur_depth(this, MachineRepresentation::kWord32);
124 cur_depth.Bind(depth);
125
126 Variable* context_search_loop_variables[2] = {&cur_depth, &cur_context};
127 Label context_search(this, 2, context_search_loop_variables);
128
129 // Loop until the depth is 0.
130 Goto(&context_search);
131 Bind(&context_search);
132 {
133 // TODO(leszeks): We only need to do this check if the context had a sloppy
134 // eval, we could pass in a context chain bitmask to figure out which
135 // contexts actually need to be checked.
rmcilroy 2016/09/16 08:56:55 It would probably take as long to check the bitmap
Leszek Swirski 2016/09/16 10:46:54 I see your point, but it would e.g. make a big dif
136
137 Node* extension_slot =
138 LoadContextSlot(cur_context.value(), Context::EXTENSION_INDEX);
139
140 // Jump to the target if the extension slot is not a hole
141 GotoIf(Word32NotEqual(extension_slot, TheHoleConstant()), target);
142
143 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
144 cur_context.Bind(
145 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
146
147 GotoIf(Word32NotEqual(cur_depth.value(), Int32Constant(0)),
148 &context_search);
149 }
150 }
151
117 Node* InterpreterAssembler::BytecodeOffset() { 152 Node* InterpreterAssembler::BytecodeOffset() {
118 return bytecode_offset_.value(); 153 return bytecode_offset_.value();
119 } 154 }
120 155
121 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { 156 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
122 if (made_call_) { 157 if (made_call_) {
123 // If we have made a call, restore bytecode array from stack frame in case 158 // If we have made a call, restore bytecode array from stack frame in case
124 // the debugger has swapped us to the patched debugger bytecode array. 159 // the debugger has swapped us to the patched debugger bytecode array.
125 return LoadRegister(Register::bytecode_array()); 160 return LoadRegister(Register::bytecode_array());
126 } else { 161 } else {
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 Goto(&loop); 1379 Goto(&loop);
1345 } 1380 }
1346 Bind(&done_loop); 1381 Bind(&done_loop);
1347 1382
1348 return array; 1383 return array;
1349 } 1384 }
1350 1385
1351 } // namespace interpreter 1386 } // namespace interpreter
1352 } // namespace internal 1387 } // namespace internal
1353 } // namespace v8 1388 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698