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/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 | 549 |
550 // Allocate registers. | 550 // Allocate registers. |
551 Frame frame; | 551 Frame frame; |
552 { | 552 { |
553 int node_count = sequence.VirtualRegisterCount(); | 553 int node_count = sequence.VirtualRegisterCount(); |
554 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { | 554 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { |
555 info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); | 555 info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); |
556 return Handle<Code>::null(); | 556 return Handle<Code>::null(); |
557 } | 557 } |
558 ZonePool::Scope zone_scope(data->zone_pool()); | 558 ZonePool::Scope zone_scope(data->zone_pool()); |
559 RegisterAllocator allocator(zone_scope.zone(), &frame, info(), &sequence); | 559 |
560 const char* debug_name = NULL; | |
561 #ifdef DEBUG | |
562 SmartArrayPointer<char> debug_name_chars; | |
563 if (info()->IsStub()) { | |
564 if (info()->code_stub() != NULL) { | |
565 CodeStub::Major major_key = info()->code_stub()->MajorKey(); | |
566 debug_name = CodeStub::MajorName(major_key, false); | |
567 } | |
568 } else { | |
569 AllowHandleDereference allow_deref; | |
570 debug_name_chars = info()->function()->debug_name()->ToCString(); | |
571 debug_name = debug_name_chars.get(); | |
572 } | |
573 #endif | |
Jarin
2014/10/29 12:16:51
Could you extract the code above to a function and
| |
574 | |
575 RegisterAllocator allocator(zone_scope.zone(), &frame, &sequence, | |
576 debug_name); | |
560 if (!allocator.Allocate(data->pipeline_statistics())) { | 577 if (!allocator.Allocate(data->pipeline_statistics())) { |
561 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); | 578 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); |
562 return Handle<Code>::null(); | 579 return Handle<Code>::null(); |
563 } | 580 } |
564 if (FLAG_trace_turbo) { | 581 if (FLAG_trace_turbo) { |
565 TurboCfgFile tcf(isolate()); | 582 TurboCfgFile tcf(isolate()); |
566 tcf << AsC1VAllocator("CodeGen", &allocator); | 583 tcf << AsC1VAllocator("CodeGen", &allocator); |
567 } | 584 } |
568 } | 585 } |
569 | 586 |
(...skipping 30 matching lines...) Expand all Loading... | |
600 } | 617 } |
601 | 618 |
602 | 619 |
603 void Pipeline::TearDown() { | 620 void Pipeline::TearDown() { |
604 InstructionOperand::TearDownCaches(); | 621 InstructionOperand::TearDownCaches(); |
605 } | 622 } |
606 | 623 |
607 } // namespace compiler | 624 } // namespace compiler |
608 } // namespace internal | 625 } // namespace internal |
609 } // namespace v8 | 626 } // namespace v8 |
OLD | NEW |