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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 1555713002: [Interpreter] Bytecodes for exchanging registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/interpreter-assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 158
159 void BytecodeGraphBuilder::Environment::BindAccumulator( 159 void BytecodeGraphBuilder::Environment::BindAccumulator(
160 Node* node, FrameStateBeforeAndAfter* states) { 160 Node* node, FrameStateBeforeAndAfter* states) {
161 if (states) { 161 if (states) {
162 states->AddToNode(node, AccumulatorUpdateMode::kOutputInAccumulator); 162 states->AddToNode(node, AccumulatorUpdateMode::kOutputInAccumulator);
163 } 163 }
164 values()->at(accumulator_base_) = node; 164 values()->at(accumulator_base_) = node;
165 } 165 }
166 166
167
167 void BytecodeGraphBuilder::Environment::RecordAfterState( 168 void BytecodeGraphBuilder::Environment::RecordAfterState(
168 Node* node, FrameStateBeforeAndAfter* states) { 169 Node* node, FrameStateBeforeAndAfter* states) {
169 states->AddToNode(node, AccumulatorUpdateMode::kOutputIgnored); 170 states->AddToNode(node, AccumulatorUpdateMode::kOutputIgnored);
170 } 171 }
171 172
172 173
174 void BytecodeGraphBuilder::Environment::ExchangeRegisters(
175 interpreter::Register reg0, interpreter::Register reg1) {
176 int reg0_index = RegisterToValuesIndex(reg0);
177 int reg1_index = RegisterToValuesIndex(reg1);
178 Node* saved_reg0_value = values()->at(reg0_index);
179 values()->at(reg0_index) = values()->at(reg1_index);
180 values()->at(reg1_index) = saved_reg0_value;
181 }
182
183
173 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { 184 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const {
174 return values()->at(accumulator_base_); 185 return values()->at(accumulator_base_);
175 } 186 }
176 187
177 188
178 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const { 189 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const {
179 return GetControlDependency()->opcode() == IrOpcode::kDead; 190 return GetControlDependency()->opcode() == IrOpcode::kDead;
180 } 191 }
181 192
182 193
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 565 }
555 566
556 567
557 void BytecodeGraphBuilder::VisitMov( 568 void BytecodeGraphBuilder::VisitMov(
558 const interpreter::BytecodeArrayIterator& iterator) { 569 const interpreter::BytecodeArrayIterator& iterator) {
559 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 570 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0));
560 environment()->BindRegister(iterator.GetRegisterOperand(1), value); 571 environment()->BindRegister(iterator.GetRegisterOperand(1), value);
561 } 572 }
562 573
563 574
575 void BytecodeGraphBuilder::VisitExchange(
576 const interpreter::BytecodeArrayIterator& iterator) {
577 environment()->ExchangeRegisters(iterator.GetRegisterOperand(0),
578 iterator.GetRegisterOperand(1));
579 }
580
581
582 void BytecodeGraphBuilder::VisitExchangeWide(
583 const interpreter::BytecodeArrayIterator& iterator) {
584 environment()->ExchangeRegisters(iterator.GetRegisterOperand(0),
585 iterator.GetRegisterOperand(1));
586 }
587
588
564 void BytecodeGraphBuilder::BuildLoadGlobal( 589 void BytecodeGraphBuilder::BuildLoadGlobal(
565 const interpreter::BytecodeArrayIterator& iterator, 590 const interpreter::BytecodeArrayIterator& iterator,
566 TypeofMode typeof_mode) { 591 TypeofMode typeof_mode) {
567 FrameStateBeforeAndAfter states(this, iterator); 592 FrameStateBeforeAndAfter states(this, iterator);
568 Handle<Name> name = 593 Handle<Name> name =
569 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); 594 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0));
570 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); 595 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1));
571 596
572 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 597 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
573 Node* node = NewNode(op, BuildLoadFeedbackVector()); 598 Node* node = NewNode(op, BuildLoadFeedbackVector());
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 1878
1854 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { 1879 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) {
1855 if (environment()->IsMarkedAsUnreachable()) return; 1880 if (environment()->IsMarkedAsUnreachable()) return;
1856 environment()->MarkAsUnreachable(); 1881 environment()->MarkAsUnreachable();
1857 exit_controls_.push_back(exit); 1882 exit_controls_.push_back(exit);
1858 } 1883 }
1859 1884
1860 } // namespace compiler 1885 } // namespace compiler
1861 } // namespace internal 1886 } // namespace internal
1862 } // namespace v8 1887 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698