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/cha.h" | 9 #include "vm/cha.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 724 |
725 | 725 |
726 void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) { | 726 void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) { |
727 // For functions with optional arguments, all incoming arguments are copied | 727 // For functions with optional arguments, all incoming arguments are copied |
728 // to spill slots. The deoptimization environment does not track them. | 728 // to spill slots. The deoptimization environment does not track them. |
729 const Function& function = parsed_function().function(); | 729 const Function& function = parsed_function().function(); |
730 const intptr_t incoming_arg_count = | 730 const intptr_t incoming_arg_count = |
731 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); | 731 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); |
732 DeoptInfoBuilder builder(isolate(), incoming_arg_count); | 732 DeoptInfoBuilder builder(isolate(), incoming_arg_count); |
733 | 733 |
734 const Array& array = | 734 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); |
735 Array::Handle(Array::New(DeoptTable::SizeFor(deopt_infos_.length()), | 735 if (deopt_info_table_size == 0) { |
736 Heap::kOld)); | 736 code.set_deopt_info_array(Object::empty_array()); |
737 Smi& offset = Smi::Handle(); | 737 code.set_object_table(Object::empty_array()); |
738 DeoptInfo& info = DeoptInfo::Handle(); | 738 } else { |
739 Smi& reason = Smi::Handle(); | 739 const Array& array = |
740 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { | 740 Array::Handle(Array::New(deopt_info_table_size, Heap::kOld)); |
741 offset = Smi::New(deopt_infos_[i]->pc_offset()); | 741 Smi& offset = Smi::Handle(); |
742 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); | 742 DeoptInfo& info = DeoptInfo::Handle(); |
743 reason = Smi::New(deopt_infos_[i]->reason()); | 743 Smi& reason = Smi::Handle(); |
744 DeoptTable::SetEntry(array, i, offset, info, reason); | 744 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { |
| 745 offset = Smi::New(deopt_infos_[i]->pc_offset()); |
| 746 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); |
| 747 reason = Smi::New(deopt_infos_[i]->reason()); |
| 748 DeoptTable::SetEntry(array, i, offset, info, reason); |
| 749 } |
| 750 code.set_deopt_info_array(array); |
| 751 const Array& object_array = |
| 752 Array::Handle(Array::MakeArray(builder.object_table())); |
| 753 ASSERT(code.object_table() == Array::null()); |
| 754 code.set_object_table(object_array); |
745 } | 755 } |
746 code.set_deopt_info_array(array); | |
747 const Array& object_array = | |
748 Array::Handle(Array::MakeArray(builder.object_table())); | |
749 ASSERT(code.object_table() == Array::null()); | |
750 code.set_object_table(object_array); | |
751 } | 756 } |
752 | 757 |
753 | 758 |
754 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { | 759 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { |
755 if (stackmap_table_builder_ == NULL) { | 760 if (stackmap_table_builder_ == NULL) { |
756 // The unoptimizing compiler has no stack maps. | 761 // The unoptimizing compiler has no stack maps. |
757 code.set_stackmaps(Object::null_array()); | 762 code.set_stackmaps(Object::null_array()); |
758 } else { | 763 } else { |
759 // Finalize the stack map array and add it to the code object. | 764 // Finalize the stack map array and add it to the code object. |
760 ASSERT(is_optimizing()); | 765 ASSERT(is_optimizing()); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 } | 1395 } |
1391 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( | 1396 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( |
1392 parsed_function().function(), String::Handle(isolate(), target.name()), | 1397 parsed_function().function(), String::Handle(isolate(), target.name()), |
1393 arguments_descriptor, deopt_id, num_args_tested)); | 1398 arguments_descriptor, deopt_id, num_args_tested)); |
1394 ic_data.AddTarget(target); | 1399 ic_data.AddTarget(target); |
1395 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1400 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
1396 return &ic_data; | 1401 return &ic_data; |
1397 } | 1402 } |
1398 | 1403 |
1399 } // namespace dart | 1404 } // namespace dart |
OLD | NEW |