OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 552 } |
553 | 553 |
554 | 554 |
555 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, | 555 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, |
556 intptr_t token_pos) { | 556 intptr_t token_pos) { |
557 ASSERT(is_optimizing()); | 557 ASSERT(is_optimizing()); |
558 ASSERT(!intrinsic_mode()); | 558 ASSERT(!intrinsic_mode()); |
559 CompilerDeoptInfo* info = | 559 CompilerDeoptInfo* info = |
560 new CompilerDeoptInfo(deopt_id, | 560 new CompilerDeoptInfo(deopt_id, |
561 ICData::kDeoptAtCall, | 561 ICData::kDeoptAtCall, |
| 562 0, // No flags. |
562 pending_deoptimization_env_); | 563 pending_deoptimization_env_); |
563 info->set_pc_offset(assembler()->CodeSize()); | 564 info->set_pc_offset(assembler()->CodeSize()); |
564 deopt_infos_.Add(info); | 565 deopt_infos_.Add(info); |
565 } | 566 } |
566 | 567 |
567 | 568 |
568 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters | 569 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters |
569 // and FlowGraphCompiler::SlowPathEnvironmentFor. | 570 // and FlowGraphCompiler::SlowPathEnvironmentFor. |
570 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { | 571 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { |
571 if (is_optimizing()) { | 572 if (is_optimizing()) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 def->AsMaterializeObject()->RemapRegisters(fpu_reg_slots, | 729 def->AsMaterializeObject()->RemapRegisters(fpu_reg_slots, |
729 cpu_reg_slots); | 730 cpu_reg_slots); |
730 } | 731 } |
731 } | 732 } |
732 } | 733 } |
733 return env; | 734 return env; |
734 } | 735 } |
735 | 736 |
736 | 737 |
737 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 738 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
738 ICData::DeoptReasonId reason) { | 739 ICData::DeoptReasonId reason, |
| 740 uint32_t flags) { |
739 if (intrinsic_mode()) { | 741 if (intrinsic_mode()) { |
740 return &intrinsic_slow_path_label_; | 742 return &intrinsic_slow_path_label_; |
741 } | 743 } |
742 | 744 |
743 ASSERT(is_optimizing_); | 745 ASSERT(is_optimizing_); |
744 CompilerDeoptInfoWithStub* stub = | 746 CompilerDeoptInfoWithStub* stub = |
745 new CompilerDeoptInfoWithStub(deopt_id, | 747 new CompilerDeoptInfoWithStub(deopt_id, |
746 reason, | 748 reason, |
| 749 flags, |
747 pending_deoptimization_env_); | 750 pending_deoptimization_env_); |
748 deopt_infos_.Add(stub); | 751 deopt_infos_.Add(stub); |
749 return stub->entry_label(); | 752 return stub->entry_label(); |
750 } | 753 } |
751 | 754 |
752 | 755 |
753 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 756 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
754 ASSERT(exception_handlers_list_ != NULL); | 757 ASSERT(exception_handlers_list_ != NULL); |
755 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 758 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
756 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 759 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
(...skipping 23 matching lines...) Expand all Loading... |
780 | 783 |
781 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); | 784 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); |
782 if (deopt_info_table_size == 0) { | 785 if (deopt_info_table_size == 0) { |
783 code.set_deopt_info_array(Object::empty_array()); | 786 code.set_deopt_info_array(Object::empty_array()); |
784 code.set_object_table(Object::empty_array()); | 787 code.set_object_table(Object::empty_array()); |
785 } else { | 788 } else { |
786 const Array& array = | 789 const Array& array = |
787 Array::Handle(Array::New(deopt_info_table_size, Heap::kOld)); | 790 Array::Handle(Array::New(deopt_info_table_size, Heap::kOld)); |
788 Smi& offset = Smi::Handle(); | 791 Smi& offset = Smi::Handle(); |
789 DeoptInfo& info = DeoptInfo::Handle(); | 792 DeoptInfo& info = DeoptInfo::Handle(); |
790 Smi& reason = Smi::Handle(); | 793 Smi& reason_and_flags = Smi::Handle(); |
791 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { | 794 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { |
792 offset = Smi::New(deopt_infos_[i]->pc_offset()); | 795 offset = Smi::New(deopt_infos_[i]->pc_offset()); |
793 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); | 796 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); |
794 reason = Smi::New(deopt_infos_[i]->reason()); | 797 reason_and_flags = DeoptTable::EncodeReasonAndFlags( |
795 DeoptTable::SetEntry(array, i, offset, info, reason); | 798 deopt_infos_[i]->reason(), |
| 799 deopt_infos_[i]->flags()); |
| 800 DeoptTable::SetEntry(array, i, offset, info, reason_and_flags); |
796 } | 801 } |
797 code.set_deopt_info_array(array); | 802 code.set_deopt_info_array(array); |
798 const Array& object_array = | 803 const Array& object_array = |
799 Array::Handle(Array::MakeArray(builder.object_table())); | 804 Array::Handle(Array::MakeArray(builder.object_table())); |
800 ASSERT(code.object_table() == Array::null()); | 805 ASSERT(code.object_table() == Array::null()); |
801 code.set_object_table(object_array); | 806 code.set_object_table(object_array); |
802 } | 807 } |
803 } | 808 } |
804 | 809 |
805 | 810 |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 threshold = FLAG_optimization_counter_scale * basic_blocks + | 1487 threshold = FLAG_optimization_counter_scale * basic_blocks + |
1483 FLAG_min_optimization_counter_threshold; | 1488 FLAG_min_optimization_counter_threshold; |
1484 if (threshold > FLAG_optimization_counter_threshold) { | 1489 if (threshold > FLAG_optimization_counter_threshold) { |
1485 threshold = FLAG_optimization_counter_threshold; | 1490 threshold = FLAG_optimization_counter_threshold; |
1486 } | 1491 } |
1487 } | 1492 } |
1488 return threshold; | 1493 return threshold; |
1489 } | 1494 } |
1490 | 1495 |
1491 } // namespace dart | 1496 } // namespace dart |
OLD | NEW |