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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 319 InstructionSequence::InstructionSequence(Linkage* linkage, Graph* graph, |
320 Schedule* schedule) | 320 Schedule* schedule) |
321 : graph_(graph), | 321 : zone_(schedule->zone()), |
322 node_map_(zone()->NewArray<int>(graph->NodeCount())), | 322 node_count_(graph->NodeCount()), |
| 323 node_map_(zone()->NewArray<int>(node_count_)), |
323 linkage_(linkage), | 324 linkage_(linkage), |
324 schedule_(schedule), | 325 schedule_(schedule), |
325 constants_(ConstantMap::key_compare(), | 326 constants_(ConstantMap::key_compare(), |
326 ConstantMap::allocator_type(zone())), | 327 ConstantMap::allocator_type(zone())), |
327 immediates_(zone()), | 328 immediates_(zone()), |
328 instructions_(zone()), | 329 instructions_(zone()), |
329 next_virtual_register_(0), | 330 next_virtual_register_(0), |
330 pointer_maps_(zone()), | 331 pointer_maps_(zone()), |
331 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), | 332 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
332 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), | 333 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), |
333 deoptimization_entries_(zone()) { | 334 deoptimization_entries_(zone()) { |
334 for (int i = 0; i < graph->NodeCount(); ++i) { | 335 for (int i = 0; i < node_count_; ++i) { |
335 node_map_[i] = -1; | 336 node_map_[i] = -1; |
336 } | 337 } |
337 } | 338 } |
338 | 339 |
339 | 340 |
340 int InstructionSequence::GetVirtualRegister(const Node* node) { | 341 int InstructionSequence::GetVirtualRegister(const Node* node) { |
341 if (node_map_[node->id()] == -1) { | 342 if (node_map_[node->id()] == -1) { |
342 node_map_[node->id()] = NextVirtualRegister(); | 343 node_map_[node->id()] = NextVirtualRegister(); |
343 } | 344 } |
344 return node_map_[node->id()]; | 345 return node_map_[node->id()]; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 os << " B" << (*iter)->id(); | 578 os << " B" << (*iter)->id(); |
578 } | 579 } |
579 os << "\n"; | 580 os << "\n"; |
580 } | 581 } |
581 return os; | 582 return os; |
582 } | 583 } |
583 | 584 |
584 } // namespace compiler | 585 } // namespace compiler |
585 } // namespace internal | 586 } // namespace internal |
586 } // namespace v8 | 587 } // namespace v8 |
OLD | NEW |