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 const Array& array = Array::Handle(Array::NewOrEmpty( |
735 Array::Handle(Array::New(DeoptTable::SizeFor(deopt_infos_.length()), | 735 DeoptTable::SizeFor(deopt_infos_.length()), |
736 Heap::kOld)); | 736 Heap::kOld)); |
737 Smi& offset = Smi::Handle(); | 737 Smi& offset = Smi::Handle(); |
738 DeoptInfo& info = DeoptInfo::Handle(); | 738 DeoptInfo& info = DeoptInfo::Handle(); |
739 Smi& reason = Smi::Handle(); | 739 Smi& reason = Smi::Handle(); |
740 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { | 740 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { |
741 offset = Smi::New(deopt_infos_[i]->pc_offset()); | 741 offset = Smi::New(deopt_infos_[i]->pc_offset()); |
742 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); | 742 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); |
743 reason = Smi::New(deopt_infos_[i]->reason()); | 743 reason = Smi::New(deopt_infos_[i]->reason()); |
744 DeoptTable::SetEntry(array, i, offset, info, reason); | 744 DeoptTable::SetEntry(array, i, offset, info, reason); |
745 } | 745 } |
746 code.set_deopt_info_array(array); | 746 code.set_deopt_info_array(array); |
747 const Array& object_array = | 747 const Array& object_array = |
748 Array::Handle(Array::MakeArray(builder.object_table())); | 748 Array::Handle(Array::MakeArray(builder.object_table())); |
749 ASSERT(code.object_table() == Array::null()); | 749 ASSERT(code.object_table() == Array::null()); |
750 code.set_object_table(object_array); | 750 code.set_object_table(object_array); |
siva
2014/07/09 20:08:02
I think it would be preferable to write this code
| |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { | 754 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { |
755 if (stackmap_table_builder_ == NULL) { | 755 if (stackmap_table_builder_ == NULL) { |
756 // The unoptimizing compiler has no stack maps. | 756 // The unoptimizing compiler has no stack maps. |
757 code.set_stackmaps(Object::null_array()); | 757 code.set_stackmaps(Object::null_array()); |
758 } else { | 758 } else { |
759 // Finalize the stack map array and add it to the code object. | 759 // Finalize the stack map array and add it to the code object. |
760 ASSERT(is_optimizing()); | 760 ASSERT(is_optimizing()); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 } | 1390 } |
1391 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( | 1391 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( |
1392 parsed_function().function(), String::Handle(isolate(), target.name()), | 1392 parsed_function().function(), String::Handle(isolate(), target.name()), |
1393 arguments_descriptor, deopt_id, num_args_tested)); | 1393 arguments_descriptor, deopt_id, num_args_tested)); |
1394 ic_data.AddTarget(target); | 1394 ic_data.AddTarget(target); |
1395 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1395 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
1396 return &ic_data; | 1396 return &ic_data; |
1397 } | 1397 } |
1398 | 1398 |
1399 } // namespace dart | 1399 } // namespace dart |
OLD | NEW |