OLD | NEW |
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/instruction.h" | 5 #include "src/compiler/instruction.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 return os << static_cast<const void*>( | 309 return os << static_cast<const void*>( |
310 constant.ToExternalReference().address()); | 310 constant.ToExternalReference().address()); |
311 case Constant::kHeapObject: | 311 case Constant::kHeapObject: |
312 return os << Brief(*constant.ToHeapObject()); | 312 return os << Brief(*constant.ToHeapObject()); |
313 } | 313 } |
314 UNREACHABLE(); | 314 UNREACHABLE(); |
315 return os; | 315 return os; |
316 } | 316 } |
317 | 317 |
318 | 318 |
| 319 InstructionSequence::InstructionSequence(Linkage* linkage, Graph* graph, |
| 320 Schedule* schedule) |
| 321 : graph_(graph), |
| 322 node_map_(zone()->NewArray<int>(graph->NodeCount())), |
| 323 linkage_(linkage), |
| 324 schedule_(schedule), |
| 325 constants_(ConstantMap::key_compare(), |
| 326 ConstantMap::allocator_type(zone())), |
| 327 immediates_(zone()), |
| 328 instructions_(zone()), |
| 329 next_virtual_register_(0), |
| 330 pointer_maps_(zone()), |
| 331 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
| 332 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
| 333 deoptimization_entries_(zone()) { |
| 334 for (int i = 0; i < graph->NodeCount(); ++i) { |
| 335 node_map_[i] = -1; |
| 336 } |
| 337 } |
| 338 |
| 339 |
| 340 int InstructionSequence::GetVirtualRegister(const Node* node) { |
| 341 if (node_map_[node->id()] == -1) { |
| 342 node_map_[node->id()] = NextVirtualRegister(); |
| 343 } |
| 344 return node_map_[node->id()]; |
| 345 } |
| 346 |
| 347 |
319 Label* InstructionSequence::GetLabel(BasicBlock* block) { | 348 Label* InstructionSequence::GetLabel(BasicBlock* block) { |
320 return GetBlockStart(block)->label(); | 349 return GetBlockStart(block)->label(); |
321 } | 350 } |
322 | 351 |
323 | 352 |
324 BlockStartInstruction* InstructionSequence::GetBlockStart(BasicBlock* block) { | 353 BlockStartInstruction* InstructionSequence::GetBlockStart(BasicBlock* block) { |
325 return BlockStartInstruction::cast(InstructionAt(block->code_start())); | 354 return BlockStartInstruction::cast(InstructionAt(block->code_start())); |
326 } | 355 } |
327 | 356 |
328 | 357 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 os << " B" << (*iter)->id(); | 505 os << " B" << (*iter)->id(); |
477 } | 506 } |
478 os << "\n"; | 507 os << "\n"; |
479 } | 508 } |
480 return os; | 509 return os; |
481 } | 510 } |
482 | 511 |
483 } // namespace compiler | 512 } // namespace compiler |
484 } // namespace internal | 513 } // namespace internal |
485 } // namespace v8 | 514 } // namespace v8 |
OLD | NEW |