| 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_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 return summary; | 986 return summary; |
| 987 } | 987 } |
| 988 | 988 |
| 989 | 989 |
| 990 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 990 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 991 Register instance_reg = locs()->in(0).reg(); | 991 Register instance_reg = locs()->in(0).reg(); |
| 992 Register value_reg = locs()->in(1).reg(); | 992 Register value_reg = locs()->in(1).reg(); |
| 993 | 993 |
| 994 if (HasICData()) { | 994 if (HasICData()) { |
| 995 ASSERT(original() != NULL); | 995 ASSERT(original() != NULL); |
| 996 Label* deopt = compiler->AddDeoptStub(original()->cid(), | 996 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
| 997 original()->token_pos(), | 997 original()->token_pos(), |
| 998 original()->try_index(), | 998 original()->try_index(), |
| 999 kDeoptInstanceGetterSameTarget, | 999 kDeoptInstanceGetterSameTarget, |
| 1000 instance_reg, | 1000 instance_reg, |
| 1001 value_reg); | 1001 value_reg); |
| 1002 // Smis do not have instance fields (Smi class is always first). | 1002 // Smis do not have instance fields (Smi class is always first). |
| 1003 Register temp_reg = locs()->temp(0).reg(); | 1003 Register temp_reg = locs()->temp(0).reg(); |
| 1004 ASSERT(temp_reg != instance_reg); | 1004 ASSERT(temp_reg != instance_reg); |
| 1005 ASSERT(temp_reg != value_reg); | 1005 ASSERT(temp_reg != value_reg); |
| 1006 ASSERT(ic_data() != NULL); | 1006 ASSERT(ic_data() != NULL); |
| 1007 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); | 1007 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); |
| 1008 } | 1008 } |
| 1009 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), | 1009 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), |
| 1010 value_reg); | 1010 value_reg); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 | 1013 |
| 1014 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 1014 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
| 1015 return new LocationSummary(0, 0, LocationSummary::kCall); | 1015 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 | 1018 |
| 1019 | 1019 |
| 1020 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1020 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1021 compiler->GenerateCallRuntime(cid(), | 1021 compiler->GenerateCallRuntime(deopt_id(), |
| 1022 token_pos(), | 1022 token_pos(), |
| 1023 try_index(), | 1023 try_index(), |
| 1024 kThrowRuntimeEntry); | 1024 kThrowRuntimeEntry); |
| 1025 __ int3(); | 1025 __ int3(); |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 | 1028 |
| 1029 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 1029 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| 1030 return new LocationSummary(0, 0, LocationSummary::kCall); | 1030 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 | 1033 |
| 1034 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1034 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1035 compiler->GenerateCallRuntime(cid(), | 1035 compiler->GenerateCallRuntime(deopt_id(), |
| 1036 token_pos(), | 1036 token_pos(), |
| 1037 try_index(), | 1037 try_index(), |
| 1038 kReThrowRuntimeEntry); | 1038 kReThrowRuntimeEntry); |
| 1039 __ int3(); | 1039 __ int3(); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 | 1042 |
| 1043 LocationSummary* GotoInstr::MakeLocationSummary() const { | 1043 LocationSummary* GotoInstr::MakeLocationSummary() const { |
| 1044 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 1044 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| 1045 } | 1045 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 | 1168 |
| 1169 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 1169 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
| 1170 return MakeCallSummary(); | 1170 return MakeCallSummary(); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 | 1173 |
| 1174 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1174 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1175 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 1175 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 1176 cid(), | 1176 deopt_id(), |
| 1177 token_pos(), | 1177 token_pos(), |
| 1178 try_index()); | 1178 try_index()); |
| 1179 compiler->GenerateInstanceCall(cid(), | 1179 compiler->GenerateInstanceCall(deopt_id(), |
| 1180 token_pos(), | 1180 token_pos(), |
| 1181 try_index(), | 1181 try_index(), |
| 1182 function_name(), | 1182 function_name(), |
| 1183 ArgumentCount(), | 1183 ArgumentCount(), |
| 1184 argument_names(), | 1184 argument_names(), |
| 1185 checked_argument_count()); | 1185 checked_argument_count()); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 | 1188 |
| 1189 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 1189 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
| 1190 return MakeCallSummary(); | 1190 return MakeCallSummary(); |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 | 1193 |
| 1194 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1194 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1195 Label done; | 1195 Label done; |
| 1196 if (recognized() == MethodRecognizer::kMathSqrt) { | 1196 if (recognized() == MethodRecognizer::kMathSqrt) { |
| 1197 compiler->GenerateInlinedMathSqrt(&done); | 1197 compiler->GenerateInlinedMathSqrt(&done); |
| 1198 // Falls through to static call when operand type is not double or smi. | 1198 // Falls through to static call when operand type is not double or smi. |
| 1199 } | 1199 } |
| 1200 compiler->GenerateStaticCall(cid(), | 1200 compiler->GenerateStaticCall(deopt_id(), |
| 1201 token_pos(), | 1201 token_pos(), |
| 1202 try_index(), | 1202 try_index(), |
| 1203 function(), | 1203 function(), |
| 1204 ArgumentCount(), | 1204 ArgumentCount(), |
| 1205 argument_names()); | 1205 argument_names()); |
| 1206 __ Bind(&done); | 1206 __ Bind(&done); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 | 1209 |
| 1210 LocationSummary* UseVal::MakeLocationSummary() const { | 1210 LocationSummary* UseVal::MakeLocationSummary() const { |
| 1211 return NULL; | 1211 return NULL; |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 | 1214 |
| 1215 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 1215 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1216 UNIMPLEMENTED(); | 1216 UNIMPLEMENTED(); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 | 1219 |
| 1220 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1220 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1221 compiler->GenerateAssertAssignable(cid(), | 1221 compiler->GenerateAssertAssignable(deopt_id(), |
| 1222 token_pos(), | 1222 token_pos(), |
| 1223 try_index(), | 1223 try_index(), |
| 1224 dst_type(), | 1224 dst_type(), |
| 1225 dst_name()); | 1225 dst_name()); |
| 1226 ASSERT(locs()->in(0).reg() == locs()->out().reg()); | 1226 ASSERT(locs()->in(0).reg() == locs()->out().reg()); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 | 1229 |
| 1230 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 1230 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
| 1231 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1231 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 if (compiler->is_ssa()) { | 1355 if (compiler->is_ssa()) { |
| 1356 ASSERT(locs()->in(0).IsRegister()); | 1356 ASSERT(locs()->in(0).IsRegister()); |
| 1357 __ PushRegister(locs()->in(0).reg()); | 1357 __ PushRegister(locs()->in(0).reg()); |
| 1358 } | 1358 } |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 | 1361 |
| 1362 #undef __ | 1362 #undef __ |
| 1363 | 1363 |
| 1364 } // namespace dart | 1364 } // namespace dart |
| OLD | NEW |