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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 921 |
922 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { | 922 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { |
923 if (code.is_optimized()) { | 923 if (code.is_optimized()) { |
924 // Optimized code does not need variable descriptors. They are | 924 // Optimized code does not need variable descriptors. They are |
925 // only stored in the unoptimized version. | 925 // only stored in the unoptimized version. |
926 code.set_var_descriptors(Object::empty_var_descriptors()); | 926 code.set_var_descriptors(Object::empty_var_descriptors()); |
927 return; | 927 return; |
928 } | 928 } |
929 LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(); | 929 LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(); |
930 if (parsed_function().node_sequence() == NULL) { | 930 if (parsed_function().node_sequence() == NULL) { |
931 // TODO(srdjan): Implement lazy local var descriptors if Irregexp functions. | 931 // Eager local var descriptors computation for Irregexp function as it is |
| 932 // complicated to factor out. |
| 933 // TODO(srdjan): Consider canonicalizing and reusing the local var |
| 934 // descriptor for IrregexpFunction. |
932 ASSERT(flow_graph().IsIrregexpFunction()); | 935 ASSERT(flow_graph().IsIrregexpFunction()); |
933 var_descs = LocalVarDescriptors::New(1); | 936 var_descs = LocalVarDescriptors::New(1); |
934 RawLocalVarDescriptors::VarInfo info; | 937 RawLocalVarDescriptors::VarInfo info; |
935 info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext); | 938 info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext); |
936 info.scope_id = 0; | 939 info.scope_id = 0; |
937 info.begin_pos = 0; | 940 info.begin_pos = 0; |
938 info.end_pos = 0; | 941 info.end_pos = 0; |
939 info.set_index(parsed_function().current_context_var()->index()); | 942 info.set_index(parsed_function().current_context_var()->index()); |
940 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info); | 943 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info); |
941 } else { | |
942 if (FLAG_eager_info_computation) { | |
943 var_descs = | |
944 parsed_function_.node_sequence()->scope()->GetVarDescriptors( | |
945 parsed_function_.function()); | |
946 } | |
947 } | 944 } |
948 code.set_var_descriptors(var_descs); | 945 code.set_var_descriptors(var_descs); |
949 } | 946 } |
950 | 947 |
951 | 948 |
952 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 949 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
953 ASSERT(code.static_calls_target_table() == Array::null()); | 950 ASSERT(code.static_calls_target_table() == Array::null()); |
954 code.set_static_calls_target_table( | 951 code.set_static_calls_target_table( |
955 Array::Handle(Array::MakeArray(static_calls_target_table_))); | 952 Array::Handle(Array::MakeArray(static_calls_target_table_))); |
956 } | 953 } |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 | 1723 |
1727 | 1724 |
1728 void FlowGraphCompiler::FrameStateClear() { | 1725 void FlowGraphCompiler::FrameStateClear() { |
1729 ASSERT(!is_optimizing()); | 1726 ASSERT(!is_optimizing()); |
1730 frame_state_.TruncateTo(0); | 1727 frame_state_.TruncateTo(0); |
1731 } | 1728 } |
1732 #endif | 1729 #endif |
1733 | 1730 |
1734 | 1731 |
1735 } // namespace dart | 1732 } // namespace dart |
OLD | NEW |