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

Side by Side Diff: src/compiler/instruction.cc

Issue 1050803002: [turbofan] cleanup InstructionOperand a little (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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/instruction.h ('k') | src/compiler/mips/code-generator-mips.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/graph.h" 6 #include "src/compiler/graph.h"
7 #include "src/compiler/instruction.h" 7 #include "src/compiler/instruction.h"
8 #include "src/compiler/schedule.h" 8 #include "src/compiler/schedule.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 24 matching lines...) Expand all
35 return os << "(R)"; 35 return os << "(R)";
36 case UnallocatedOperand::MUST_HAVE_SLOT: 36 case UnallocatedOperand::MUST_HAVE_SLOT:
37 return os << "(S)"; 37 return os << "(S)";
38 case UnallocatedOperand::SAME_AS_FIRST_INPUT: 38 case UnallocatedOperand::SAME_AS_FIRST_INPUT:
39 return os << "(1)"; 39 return os << "(1)";
40 case UnallocatedOperand::ANY: 40 case UnallocatedOperand::ANY:
41 return os << "(-)"; 41 return os << "(-)";
42 } 42 }
43 } 43 }
44 case InstructionOperand::CONSTANT: 44 case InstructionOperand::CONSTANT:
45 return os << "[constant:" << op.index() << "]"; 45 return os << "[constant:" << ConstantOperand::cast(op).virtual_register()
46 << "]";
46 case InstructionOperand::IMMEDIATE: 47 case InstructionOperand::IMMEDIATE:
47 return os << "[immediate:" << op.index() << "]"; 48 return os << "[immediate:" << ImmediateOperand::cast(op).index() << "]";
48 case InstructionOperand::STACK_SLOT: 49 case InstructionOperand::STACK_SLOT:
49 return os << "[stack:" << op.index() << "]"; 50 return os << "[stack:" << StackSlotOperand::cast(op).index() << "]";
50 case InstructionOperand::DOUBLE_STACK_SLOT: 51 case InstructionOperand::DOUBLE_STACK_SLOT:
51 return os << "[double_stack:" << op.index() << "]"; 52 return os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index()
53 << "]";
52 case InstructionOperand::REGISTER: 54 case InstructionOperand::REGISTER:
53 return os << "[" << conf->general_register_name(op.index()) << "|R]"; 55 return os << "["
56 << conf->general_register_name(
57 RegisterOperand::cast(op).index()) << "|R]";
54 case InstructionOperand::DOUBLE_REGISTER: 58 case InstructionOperand::DOUBLE_REGISTER:
55 return os << "[" << conf->double_register_name(op.index()) << "|R]"; 59 return os << "["
60 << conf->double_register_name(
61 DoubleRegisterOperand::cast(op).index()) << "|R]";
56 case InstructionOperand::INVALID: 62 case InstructionOperand::INVALID:
57 return os << "(x)"; 63 return os << "(x)";
58 } 64 }
59 UNREACHABLE(); 65 UNREACHABLE();
60 return os; 66 return os;
61 } 67 }
62 68
63 69
64 std::ostream& operator<<(std::ostream& os, 70 std::ostream& operator<<(std::ostream& os,
65 const PrintableMoveOperands& printable) { 71 const PrintableMoveOperands& printable) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 first = false; 172 first = false;
167 PrintableMoveOperands pmo = {printable.register_configuration_, move}; 173 PrintableMoveOperands pmo = {printable.register_configuration_, move};
168 os << pmo; 174 os << pmo;
169 } 175 }
170 return os; 176 return os;
171 } 177 }
172 178
173 179
174 void PointerMap::RecordPointer(InstructionOperand* op, Zone* zone) { 180 void PointerMap::RecordPointer(InstructionOperand* op, Zone* zone) {
175 // Do not record arguments as pointers. 181 // Do not record arguments as pointers.
176 if (op->IsStackSlot() && op->index() < 0) return; 182 if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
177 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot()); 183 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
178 pointer_operands_.Add(op, zone); 184 pointer_operands_.Add(op, zone);
179 } 185 }
180 186
181 187
182 void PointerMap::RemovePointer(InstructionOperand* op) { 188 void PointerMap::RemovePointer(InstructionOperand* op) {
183 // Do not record arguments as pointers. 189 // Do not record arguments as pointers.
184 if (op->IsStackSlot() && op->index() < 0) return; 190 if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
185 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot()); 191 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
186 for (int i = 0; i < pointer_operands_.length(); ++i) { 192 for (int i = 0; i < pointer_operands_.length(); ++i) {
187 if (pointer_operands_[i]->Equals(op)) { 193 if (pointer_operands_[i]->Equals(op)) {
188 pointer_operands_.Remove(i); 194 pointer_operands_.Remove(i);
189 --i; 195 --i;
190 } 196 }
191 } 197 }
192 } 198 }
193 199
194 200
195 void PointerMap::RecordUntagged(InstructionOperand* op, Zone* zone) { 201 void PointerMap::RecordUntagged(InstructionOperand* op, Zone* zone) {
196 // Do not record arguments as pointers. 202 // Do not record arguments as pointers.
197 if (op->IsStackSlot() && op->index() < 0) return; 203 if (op->IsStackSlot() && StackSlotOperand::cast(op)->index() < 0) return;
198 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot()); 204 DCHECK(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
199 untagged_operands_.Add(op, zone); 205 untagged_operands_.Add(op, zone);
200 } 206 }
201 207
202 208
203 std::ostream& operator<<(std::ostream& os, const PointerMap& pm) { 209 std::ostream& operator<<(std::ostream& os, const PointerMap& pm) {
204 os << "{"; 210 os << "{";
205 for (ZoneList<InstructionOperand*>::iterator op = 211 for (ZoneList<InstructionOperand*>::iterator op =
206 pm.pointer_operands_.begin(); 212 pm.pointer_operands_.begin();
207 op != pm.pointer_operands_.end(); ++op) { 213 op != pm.pointer_operands_.end(); ++op) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 InstructionSequence::StateId state_id) { 592 InstructionSequence::StateId state_id) {
587 return deoptimization_entries_[state_id.ToInt()]; 593 return deoptimization_entries_[state_id.ToInt()];
588 } 594 }
589 595
590 596
591 int InstructionSequence::GetFrameStateDescriptorCount() { 597 int InstructionSequence::GetFrameStateDescriptorCount() {
592 return static_cast<int>(deoptimization_entries_.size()); 598 return static_cast<int>(deoptimization_entries_.size());
593 } 599 }
594 600
595 601
602 RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) {
603 InstructionOperand* operand = instr->InputAt(index);
604 Constant constant =
605 operand->IsImmediate()
606 ? GetImmediate(ImmediateOperand::cast(operand)->index())
607 : GetConstant(ConstantOperand::cast(operand)->virtual_register());
608 return constant.ToRpoNumber();
609 }
610
611
596 FrameStateDescriptor::FrameStateDescriptor( 612 FrameStateDescriptor::FrameStateDescriptor(
597 Zone* zone, const FrameStateCallInfo& state_info, size_t parameters_count, 613 Zone* zone, const FrameStateCallInfo& state_info, size_t parameters_count,
598 size_t locals_count, size_t stack_count, FrameStateDescriptor* outer_state) 614 size_t locals_count, size_t stack_count, FrameStateDescriptor* outer_state)
599 : type_(state_info.type()), 615 : type_(state_info.type()),
600 bailout_id_(state_info.bailout_id()), 616 bailout_id_(state_info.bailout_id()),
601 frame_state_combine_(state_info.state_combine()), 617 frame_state_combine_(state_info.state_combine()),
602 parameters_count_(parameters_count), 618 parameters_count_(parameters_count),
603 locals_count_(locals_count), 619 locals_count_(locals_count),
604 stack_count_(stack_count), 620 stack_count_(stack_count),
605 types_(zone), 621 types_(zone),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 os << " B" << succ.ToInt(); 744 os << " B" << succ.ToInt();
729 } 745 }
730 os << "\n"; 746 os << "\n";
731 } 747 }
732 return os; 748 return os;
733 } 749 }
734 750
735 } // namespace compiler 751 } // namespace compiler
736 } // namespace internal 752 } // namespace internal
737 } // namespace v8 753 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698