| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 845 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
| 846 return new LocationSummary(0, 0, LocationSummary::kCall); | 846 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 847 } | 847 } |
| 848 | 848 |
| 849 | 849 |
| 850 | 850 |
| 851 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 851 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 852 compiler->GenerateCallRuntime(deopt_id(), | 852 compiler->GenerateCallRuntime(deopt_id(), |
| 853 token_pos(), | 853 token_pos(), |
| 854 try_index(), | 854 try_index(), |
| 855 kThrowRuntimeEntry); | 855 kThrowRuntimeEntry, |
| 856 locs()->stack_bitmap()); |
| 856 __ int3(); | 857 __ int3(); |
| 857 } | 858 } |
| 858 | 859 |
| 859 | 860 |
| 860 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 861 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| 861 return new LocationSummary(0, 0, LocationSummary::kCall); | 862 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 862 } | 863 } |
| 863 | 864 |
| 864 | 865 |
| 865 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 866 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 866 compiler->GenerateCallRuntime(deopt_id(), | 867 compiler->GenerateCallRuntime(deopt_id(), |
| 867 token_pos(), | 868 token_pos(), |
| 868 try_index(), | 869 try_index(), |
| 869 kReThrowRuntimeEntry); | 870 kReThrowRuntimeEntry, |
| 871 locs()->stack_bitmap()); |
| 870 __ int3(); | 872 __ int3(); |
| 871 } | 873 } |
| 872 | 874 |
| 873 | 875 |
| 874 LocationSummary* GotoInstr::MakeLocationSummary() const { | 876 LocationSummary* GotoInstr::MakeLocationSummary() const { |
| 875 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 877 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| 876 } | 878 } |
| 877 | 879 |
| 878 | 880 |
| 879 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 881 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 Register temp_reg = locs()->temp(0).reg(); | 987 Register temp_reg = locs()->temp(0).reg(); |
| 986 int argument_count = ArgumentCount(); | 988 int argument_count = ArgumentCount(); |
| 987 const Array& arguments_descriptor = | 989 const Array& arguments_descriptor = |
| 988 DartEntry::ArgumentsDescriptor(argument_count - 1, | 990 DartEntry::ArgumentsDescriptor(argument_count - 1, |
| 989 argument_names()); | 991 argument_names()); |
| 990 __ LoadObject(temp_reg, arguments_descriptor); | 992 __ LoadObject(temp_reg, arguments_descriptor); |
| 991 | 993 |
| 992 compiler->GenerateCall(token_pos(), | 994 compiler->GenerateCall(token_pos(), |
| 993 try_index(), | 995 try_index(), |
| 994 &StubCode::CallClosureFunctionLabel(), | 996 &StubCode::CallClosureFunctionLabel(), |
| 995 PcDescriptors::kOther); | 997 PcDescriptors::kOther, |
| 998 locs()->stack_bitmap()); |
| 996 __ Drop(argument_count); | 999 __ Drop(argument_count); |
| 997 } | 1000 } |
| 998 | 1001 |
| 999 | 1002 |
| 1000 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 1003 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
| 1001 return MakeCallSummary(); | 1004 return MakeCallSummary(); |
| 1002 } | 1005 } |
| 1003 | 1006 |
| 1004 | 1007 |
| 1005 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1008 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1006 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 1009 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 1007 deopt_id(), | 1010 deopt_id(), |
| 1008 token_pos(), | 1011 token_pos(), |
| 1009 try_index()); | 1012 try_index()); |
| 1010 compiler->GenerateInstanceCall(deopt_id(), | 1013 compiler->GenerateInstanceCall(deopt_id(), |
| 1011 token_pos(), | 1014 token_pos(), |
| 1012 try_index(), | 1015 try_index(), |
| 1013 function_name(), | 1016 function_name(), |
| 1014 ArgumentCount(), | 1017 ArgumentCount(), |
| 1015 argument_names(), | 1018 argument_names(), |
| 1016 checked_argument_count()); | 1019 checked_argument_count(), |
| 1020 locs()->stack_bitmap()); |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1019 | 1023 |
| 1020 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 1024 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
| 1021 return MakeCallSummary(); | 1025 return MakeCallSummary(); |
| 1022 } | 1026 } |
| 1023 | 1027 |
| 1024 | 1028 |
| 1025 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1029 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1026 Label done; | 1030 Label done; |
| 1027 if (recognized() == MethodRecognizer::kMathSqrt) { | 1031 if (recognized() == MethodRecognizer::kMathSqrt) { |
| 1028 compiler->GenerateInlinedMathSqrt(&done); | 1032 compiler->GenerateInlinedMathSqrt(&done); |
| 1029 // Falls through to static call when operand type is not double or smi. | 1033 // Falls through to static call when operand type is not double or smi. |
| 1030 } | 1034 } |
| 1031 compiler->GenerateStaticCall(deopt_id(), | 1035 compiler->GenerateStaticCall(deopt_id(), |
| 1032 token_pos(), | 1036 token_pos(), |
| 1033 try_index(), | 1037 try_index(), |
| 1034 function(), | 1038 function(), |
| 1035 ArgumentCount(), | 1039 ArgumentCount(), |
| 1036 argument_names()); | 1040 argument_names(), |
| 1041 locs()->stack_bitmap()); |
| 1037 __ Bind(&done); | 1042 __ Bind(&done); |
| 1038 } | 1043 } |
| 1039 | 1044 |
| 1040 | 1045 |
| 1041 LocationSummary* UseVal::MakeLocationSummary() const { | 1046 LocationSummary* UseVal::MakeLocationSummary() const { |
| 1042 return NULL; | 1047 return NULL; |
| 1043 } | 1048 } |
| 1044 | 1049 |
| 1045 | 1050 |
| 1046 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 1051 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1047 UNIMPLEMENTED(); | 1052 UNIMPLEMENTED(); |
| 1048 } | 1053 } |
| 1049 | 1054 |
| 1050 | 1055 |
| 1051 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1056 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1052 if (!IsEliminated()) { | 1057 if (!IsEliminated()) { |
| 1053 compiler->GenerateAssertAssignable(deopt_id(), | 1058 compiler->GenerateAssertAssignable(deopt_id(), |
| 1054 token_pos(), | 1059 token_pos(), |
| 1055 try_index(), | 1060 try_index(), |
| 1056 dst_type(), | 1061 dst_type(), |
| 1057 dst_name()); | 1062 dst_name(), |
| 1063 locs()->stack_bitmap()); |
| 1058 } | 1064 } |
| 1059 ASSERT(locs()->in(0).reg() == locs()->out().reg()); | 1065 ASSERT(locs()->in(0).reg() == locs()->out().reg()); |
| 1060 } | 1066 } |
| 1061 | 1067 |
| 1062 | 1068 |
| 1063 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 1069 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
| 1064 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1070 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
| 1065 locs->set_in(0, Location::RequiresRegister()); | 1071 locs->set_in(0, Location::RequiresRegister()); |
| 1066 locs->set_temp(0, Location::RequiresRegister()); | 1072 locs->set_temp(0, Location::RequiresRegister()); |
| 1067 locs->set_out(Location::SameAsFirstInput()); | 1073 locs->set_out(Location::SameAsFirstInput()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 } | 1146 } |
| 1141 | 1147 |
| 1142 | 1148 |
| 1143 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1149 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1144 const Class& cls = Class::ZoneHandle(constructor().owner()); | 1150 const Class& cls = Class::ZoneHandle(constructor().owner()); |
| 1145 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); | 1151 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); |
| 1146 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); | 1152 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); |
| 1147 compiler->GenerateCall(token_pos(), | 1153 compiler->GenerateCall(token_pos(), |
| 1148 try_index(), | 1154 try_index(), |
| 1149 &label, | 1155 &label, |
| 1150 PcDescriptors::kOther); | 1156 PcDescriptors::kOther, |
| 1157 locs()->stack_bitmap()); |
| 1151 __ Drop(ArgumentCount()); // Discard arguments. | 1158 __ Drop(ArgumentCount()); // Discard arguments. |
| 1152 } | 1159 } |
| 1153 | 1160 |
| 1154 | 1161 |
| 1155 LocationSummary* CreateClosureComp::MakeLocationSummary() const { | 1162 LocationSummary* CreateClosureComp::MakeLocationSummary() const { |
| 1156 return MakeCallSummary(); | 1163 return MakeCallSummary(); |
| 1157 } | 1164 } |
| 1158 | 1165 |
| 1159 | 1166 |
| 1160 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1167 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1161 const Function& closure_function = function(); | 1168 const Function& closure_function = function(); |
| 1162 const Code& stub = Code::Handle( | 1169 const Code& stub = Code::Handle( |
| 1163 StubCode::GetAllocationStubForClosure(closure_function)); | 1170 StubCode::GetAllocationStubForClosure(closure_function)); |
| 1164 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1171 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1165 compiler->GenerateCall(token_pos(), try_index(), &label, | 1172 compiler->GenerateCall(token_pos(), try_index(), &label, |
| 1166 PcDescriptors::kOther); | 1173 PcDescriptors::kOther, |
| 1174 locs()->stack_bitmap()); |
| 1167 __ Drop(2); // Discard type arguments and receiver. | 1175 __ Drop(2); // Discard type arguments and receiver. |
| 1168 } | 1176 } |
| 1169 | 1177 |
| 1170 | 1178 |
| 1171 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { | 1179 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { |
| 1172 const intptr_t kNumInputs = 1; | 1180 const intptr_t kNumInputs = 1; |
| 1173 const intptr_t kNumTemps= 0; | 1181 const intptr_t kNumTemps= 0; |
| 1174 LocationSummary* locs = | 1182 LocationSummary* locs = |
| 1175 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1183 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1176 // TODO(fschneider): Use Any() once it is supported by all code generators. | 1184 // TODO(fschneider): Use Any() once it is supported by all code generators. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 locations_[i] = Location::NoLocation(); | 1228 locations_[i] = Location::NoLocation(); |
| 1221 } | 1229 } |
| 1222 } | 1230 } |
| 1223 } | 1231 } |
| 1224 } | 1232 } |
| 1225 | 1233 |
| 1226 | 1234 |
| 1227 #undef __ | 1235 #undef __ |
| 1228 | 1236 |
| 1229 } // namespace dart | 1237 } // namespace dart |
| OLD | NEW |