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

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

Issue 2470253003: [ignition] Reuse code-stub-assembler's context load operations. (Closed)
Patch Set: Created 4 years, 1 month 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Label context_search(this, 2, context_search_loop_variables); 97 Label context_search(this, 2, context_search_loop_variables);
98 98
99 // Fast path if the depth is 0. 99 // Fast path if the depth is 0.
100 Branch(Word32Equal(depth, Int32Constant(0)), &context_found, &context_search); 100 Branch(Word32Equal(depth, Int32Constant(0)), &context_found, &context_search);
101 101
102 // Loop until the depth is 0. 102 // Loop until the depth is 0.
103 Bind(&context_search); 103 Bind(&context_search);
104 { 104 {
105 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1))); 105 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
106 cur_context.Bind( 106 cur_context.Bind(
107 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX)); 107 LoadContextElement(cur_context.value(), Context::PREVIOUS_INDEX));
108 108
109 Branch(Word32Equal(cur_depth.value(), Int32Constant(0)), &context_found, 109 Branch(Word32Equal(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, 117 void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(Node* context,
(...skipping 10 matching lines...) Expand all
128 128
129 // Loop until the depth is 0. 129 // Loop until the depth is 0.
130 Goto(&context_search); 130 Goto(&context_search);
131 Bind(&context_search); 131 Bind(&context_search);
132 { 132 {
133 // TODO(leszeks): We only need to do this check if the context had a sloppy 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 134 // eval, we could pass in a context chain bitmask to figure out which
135 // contexts actually need to be checked. 135 // contexts actually need to be checked.
136 136
137 Node* extension_slot = 137 Node* extension_slot =
138 LoadContextSlot(cur_context.value(), Context::EXTENSION_INDEX); 138 LoadContextElement(cur_context.value(), Context::EXTENSION_INDEX);
139 139
140 // Jump to the target if the extension slot is not a hole. 140 // Jump to the target if the extension slot is not a hole.
141 GotoIf(WordNotEqual(extension_slot, TheHoleConstant()), target); 141 GotoIf(WordNotEqual(extension_slot, TheHoleConstant()), target);
142 142
143 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1))); 143 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
144 cur_context.Bind( 144 cur_context.Bind(
145 LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX)); 145 LoadContextElement(cur_context.value(), Context::PREVIOUS_INDEX));
146 146
147 GotoIf(Word32NotEqual(cur_depth.value(), Int32Constant(0)), 147 GotoIf(Word32NotEqual(cur_depth.value(), Int32Constant(0)),
148 &context_search); 148 &context_search);
149 } 149 }
150 } 150 }
151 151
152 Node* InterpreterAssembler::BytecodeOffset() { 152 Node* InterpreterAssembler::BytecodeOffset() {
153 return bytecode_offset_.value(); 153 return bytecode_offset_.value();
154 } 154 }
155 155
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 IntPtrAdd(IntPtrConstant(offset), WordShl(index, kPointerSizeLog2)); 478 IntPtrAdd(IntPtrConstant(offset), WordShl(index, kPointerSizeLog2));
479 if (Is64()) { 479 if (Is64()) {
480 return ChangeInt32ToInt64( 480 return ChangeInt32ToInt64(
481 Load(MachineType::Int32(), constant_pool, entry_offset)); 481 Load(MachineType::Int32(), constant_pool, entry_offset));
482 } else { 482 } else {
483 return SmiUntag( 483 return SmiUntag(
484 Load(MachineType::AnyTagged(), constant_pool, entry_offset)); 484 Load(MachineType::AnyTagged(), constant_pool, entry_offset));
485 } 485 }
486 } 486 }
487 487
488 Node* InterpreterAssembler::LoadContextSlot(Node* context, int slot_index) {
489 return Load(MachineType::AnyTagged(), context,
490 IntPtrConstant(Context::SlotOffset(slot_index)));
491 }
492
493 Node* InterpreterAssembler::LoadContextSlot(Node* context, Node* slot_index) { 488 Node* InterpreterAssembler::LoadContextSlot(Node* context, Node* slot_index) {
494 Node* offset = 489 Node* offset =
495 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), 490 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2),
496 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); 491 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag));
497 return Load(MachineType::AnyTagged(), context, offset); 492 return Load(MachineType::AnyTagged(), context, offset);
498 } 493 }
499 494
500 Node* InterpreterAssembler::StoreContextSlot(Node* context, Node* slot_index, 495 Node* InterpreterAssembler::StoreContextSlot(Node* context, Node* slot_index,
501 Node* value) { 496 Node* value) {
502 Node* offset = 497 Node* offset =
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 Goto(&loop); 1373 Goto(&loop);
1379 } 1374 }
1380 Bind(&done_loop); 1375 Bind(&done_loop);
1381 1376
1382 return array; 1377 return array;
1383 } 1378 }
1384 1379
1385 } // namespace interpreter 1380 } // namespace interpreter
1386 } // namespace internal 1381 } // namespace internal
1387 } // namespace v8 1382 } // namespace v8
OLDNEW
« src/interpreter/interpreter-assembler.h ('K') | « src/interpreter/interpreter-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698