Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 1073173003: Eliminate object table and use regular object pool for deoptimization infos. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 const PcDescriptors& descriptors = PcDescriptors::Handle( 839 const PcDescriptors& descriptors = PcDescriptors::Handle(
840 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); 840 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint()));
841 if (!is_optimizing_) descriptors.Verify(parsed_function_.function()); 841 if (!is_optimizing_) descriptors.Verify(parsed_function_.function());
842 code.set_pc_descriptors(descriptors); 842 code.set_pc_descriptors(descriptors);
843 code.set_entry_patch_pc_offset(entry_patch_pc_offset_); 843 code.set_entry_patch_pc_offset(entry_patch_pc_offset_);
844 code.set_patch_code_pc_offset(patch_code_pc_offset_); 844 code.set_patch_code_pc_offset(patch_code_pc_offset_);
845 code.set_lazy_deopt_pc_offset(lazy_deopt_pc_offset_); 845 code.set_lazy_deopt_pc_offset(lazy_deopt_pc_offset_);
846 } 846 }
847 847
848 848
849 void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) { 849 RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) {
850 // For functions with optional arguments, all incoming arguments are copied 850 // For functions with optional arguments, all incoming arguments are copied
851 // to spill slots. The deoptimization environment does not track them. 851 // to spill slots. The deoptimization environment does not track them.
852 const Function& function = parsed_function().function(); 852 const Function& function = parsed_function().function();
853 const intptr_t incoming_arg_count = 853 const intptr_t incoming_arg_count =
854 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); 854 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
855 DeoptInfoBuilder builder(zone(), incoming_arg_count); 855 DeoptInfoBuilder builder(zone(), incoming_arg_count, assembler);
856 856
857 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); 857 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length());
858 if (deopt_info_table_size == 0) { 858 if (deopt_info_table_size == 0) {
859 code.set_deopt_info_array(Object::empty_array()); 859 return Object::empty_array().raw();
860 code.set_object_table(Object::empty_array());
861 } else { 860 } else {
862 const Array& array = 861 const Array& array =
863 Array::Handle(Array::New(deopt_info_table_size, Heap::kOld)); 862 Array::Handle(Array::New(deopt_info_table_size, Heap::kOld));
864 Smi& offset = Smi::Handle(); 863 Smi& offset = Smi::Handle();
865 TypedData& info = TypedData::Handle(); 864 TypedData& info = TypedData::Handle();
866 Smi& reason_and_flags = Smi::Handle(); 865 Smi& reason_and_flags = Smi::Handle();
867 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { 866 for (intptr_t i = 0; i < deopt_infos_.length(); i++) {
868 offset = Smi::New(deopt_infos_[i]->pc_offset()); 867 offset = Smi::New(deopt_infos_[i]->pc_offset());
869 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array); 868 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array);
870 reason_and_flags = DeoptTable::EncodeReasonAndFlags( 869 reason_and_flags = DeoptTable::EncodeReasonAndFlags(
871 deopt_infos_[i]->reason(), 870 deopt_infos_[i]->reason(),
872 deopt_infos_[i]->flags()); 871 deopt_infos_[i]->flags());
873 DeoptTable::SetEntry(array, i, offset, info, reason_and_flags); 872 DeoptTable::SetEntry(array, i, offset, info, reason_and_flags);
874 } 873 }
875 code.set_deopt_info_array(array); 874 return array.raw();
876 const Array& object_array =
877 Array::Handle(Array::MakeArray(builder.object_table()));
878 ASSERT(code.object_table() == Array::null());
879 code.set_object_table(object_array);
880 } 875 }
881 } 876 }
882 877
883 878
884 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { 879 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) {
885 if (stackmap_table_builder_ == NULL) { 880 if (stackmap_table_builder_ == NULL) {
886 // The unoptimizing compiler has no stack maps. 881 // The unoptimizing compiler has no stack maps.
887 code.set_stackmaps(Object::null_array()); 882 code.set_stackmaps(Object::null_array());
888 } else { 883 } else {
889 // Finalize the stack map array and add it to the code object. 884 // Finalize the stack map array and add it to the code object.
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 1675
1681 1676
1682 void FlowGraphCompiler::FrameStateClear() { 1677 void FlowGraphCompiler::FrameStateClear() {
1683 ASSERT(!is_optimizing()); 1678 ASSERT(!is_optimizing());
1684 frame_state_.TruncateTo(0); 1679 frame_state_.TruncateTo(0);
1685 } 1680 }
1686 #endif 1681 #endif
1687 1682
1688 1683
1689 } // namespace dart 1684 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698