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

Side by Side Diff: src/compiler/instruction-selector-impl.h

Issue 530783002: Convert Linkage to use MachineSignature. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/instruction-selector-unittest.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 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 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
7 7
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/compiler/instruction-selector.h" 9 #include "src/compiler/instruction-selector.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 30 matching lines...) Expand all
41 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, 41 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
42 DoubleRegister::ToAllocationIndex(reg))); 42 DoubleRegister::ToAllocationIndex(reg)));
43 } 43 }
44 44
45 InstructionOperand* DefineAsConstant(Node* node) { 45 InstructionOperand* DefineAsConstant(Node* node) {
46 selector()->MarkAsDefined(node); 46 selector()->MarkAsDefined(node);
47 sequence()->AddConstant(node->id(), ToConstant(node)); 47 sequence()->AddConstant(node->id(), ToConstant(node));
48 return ConstantOperand::Create(node->id(), zone()); 48 return ConstantOperand::Create(node->id(), zone());
49 } 49 }
50 50
51 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location) { 51 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location,
52 return Define(node, ToUnallocatedOperand(location)); 52 MachineType type) {
53 return Define(node, ToUnallocatedOperand(location, type));
53 } 54 }
54 55
55 InstructionOperand* Use(Node* node) { 56 InstructionOperand* Use(Node* node) {
56 return Use(node, 57 return Use(node,
57 new (zone()) UnallocatedOperand( 58 new (zone()) UnallocatedOperand(
58 UnallocatedOperand::ANY, UnallocatedOperand::USED_AT_START)); 59 UnallocatedOperand::ANY, UnallocatedOperand::USED_AT_START));
59 } 60 }
60 61
61 InstructionOperand* UseRegister(Node* node) { 62 InstructionOperand* UseRegister(Node* node) {
62 return Use(node, new (zone()) 63 return Use(node, new (zone())
(...skipping 24 matching lines...) Expand all
87 return Use(node, new (zone()) 88 return Use(node, new (zone())
88 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, 89 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
89 DoubleRegister::ToAllocationIndex(reg))); 90 DoubleRegister::ToAllocationIndex(reg)));
90 } 91 }
91 92
92 InstructionOperand* UseImmediate(Node* node) { 93 InstructionOperand* UseImmediate(Node* node) {
93 int index = sequence()->AddImmediate(ToConstant(node)); 94 int index = sequence()->AddImmediate(ToConstant(node));
94 return ImmediateOperand::Create(index, zone()); 95 return ImmediateOperand::Create(index, zone());
95 } 96 }
96 97
97 InstructionOperand* UseLocation(Node* node, LinkageLocation location) { 98 InstructionOperand* UseLocation(Node* node, LinkageLocation location,
98 return Use(node, ToUnallocatedOperand(location)); 99 MachineType type) {
100 return Use(node, ToUnallocatedOperand(location, type));
99 } 101 }
100 102
101 InstructionOperand* TempRegister() { 103 InstructionOperand* TempRegister() {
102 UnallocatedOperand* op = 104 UnallocatedOperand* op =
103 new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, 105 new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
104 UnallocatedOperand::USED_AT_START); 106 UnallocatedOperand::USED_AT_START);
105 op->set_virtual_register(sequence()->NextVirtualRegister()); 107 op->set_virtual_register(sequence()->NextVirtualRegister());
106 return op; 108 return op;
107 } 109 }
108 110
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 169 }
168 170
169 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { 171 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) {
170 DCHECK_NOT_NULL(node); 172 DCHECK_NOT_NULL(node);
171 DCHECK_NOT_NULL(operand); 173 DCHECK_NOT_NULL(operand);
172 operand->set_virtual_register(node->id()); 174 operand->set_virtual_register(node->id());
173 selector()->MarkAsUsed(node); 175 selector()->MarkAsUsed(node);
174 return operand; 176 return operand;
175 } 177 }
176 178
177 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location) { 179 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location,
180 MachineType type) {
178 if (location.location_ == LinkageLocation::ANY_REGISTER) { 181 if (location.location_ == LinkageLocation::ANY_REGISTER) {
179 return new (zone()) 182 return new (zone())
180 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); 183 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER);
181 } 184 }
182 if (location.location_ < 0) { 185 if (location.location_ < 0) {
183 return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, 186 return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT,
184 location.location_); 187 location.location_);
185 } 188 }
186 if (RepresentationOf(location.rep_) == kRepFloat64) { 189 if (RepresentationOf(type) == kRepFloat64) {
187 return new (zone()) UnallocatedOperand( 190 return new (zone()) UnallocatedOperand(
188 UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_); 191 UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_);
189 } 192 }
190 return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, 193 return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
191 location.location_); 194 location.location_);
192 } 195 }
193 196
194 InstructionSelector* selector_; 197 InstructionSelector* selector_;
195 }; 198 };
196 199
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 CallBuffer(Zone* zone, CallDescriptor* descriptor, 334 CallBuffer(Zone* zone, CallDescriptor* descriptor,
332 FrameStateDescriptor* frame_state); 335 FrameStateDescriptor* frame_state);
333 336
334 CallDescriptor* descriptor; 337 CallDescriptor* descriptor;
335 FrameStateDescriptor* frame_state_descriptor; 338 FrameStateDescriptor* frame_state_descriptor;
336 NodeVector output_nodes; 339 NodeVector output_nodes;
337 InstructionOperandVector outputs; 340 InstructionOperandVector outputs;
338 InstructionOperandVector instruction_args; 341 InstructionOperandVector instruction_args;
339 NodeVector pushed_nodes; 342 NodeVector pushed_nodes;
340 343
341 int input_count() const { return descriptor->InputCount(); } 344 size_t input_count() const { return descriptor->InputCount(); }
342 345
343 int frame_state_count() const { return descriptor->FrameStateCount(); } 346 size_t frame_state_count() const { return descriptor->FrameStateCount(); }
344 347
345 int frame_state_value_count() const { 348 size_t frame_state_value_count() const {
346 return (frame_state_descriptor == NULL) 349 return (frame_state_descriptor == NULL)
347 ? 0 350 ? 0
348 : (frame_state_descriptor->size() + 1); 351 : (frame_state_descriptor->size() + 1);
349 } 352 }
350 }; 353 };
351 354
352 } // namespace compiler 355 } // namespace compiler
353 } // namespace internal 356 } // namespace internal
354 } // namespace v8 357 } // namespace v8
355 358
356 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 359 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/instruction-selector-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698