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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 return summary; | 1019 return summary; |
1020 } | 1020 } |
1021 | 1021 |
1022 | 1022 |
1023 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1023 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1024 Register instance_reg = locs()->in(0).reg(); | 1024 Register instance_reg = locs()->in(0).reg(); |
1025 Register value_reg = locs()->in(1).reg(); | 1025 Register value_reg = locs()->in(1).reg(); |
1026 | 1026 |
1027 if (HasICData()) { | 1027 if (HasICData()) { |
1028 ASSERT(original() != NULL); | 1028 ASSERT(original() != NULL); |
1029 Label* deopt = compiler->AddDeoptStub(original()->cid(), | 1029 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
1030 original()->token_pos(), | 1030 original()->token_pos(), |
1031 original()->try_index(), | 1031 original()->try_index(), |
1032 kDeoptInstanceGetterSameTarget, | 1032 kDeoptInstanceGetterSameTarget, |
1033 instance_reg, | 1033 instance_reg, |
1034 value_reg); | 1034 value_reg); |
1035 // Smis do not have instance fields (Smi class is always first). | 1035 // Smis do not have instance fields (Smi class is always first). |
1036 Register temp_reg = locs()->temp(0).reg(); | 1036 Register temp_reg = locs()->temp(0).reg(); |
1037 ASSERT(temp_reg != instance_reg); | 1037 ASSERT(temp_reg != instance_reg); |
1038 ASSERT(temp_reg != value_reg); | 1038 ASSERT(temp_reg != value_reg); |
1039 ASSERT(ic_data() != NULL); | 1039 ASSERT(ic_data() != NULL); |
1040 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); | 1040 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); |
1041 } | 1041 } |
1042 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), | 1042 __ StoreIntoObject(instance_reg, FieldAddress(instance_reg, field().Offset()), |
1043 value_reg); | 1043 value_reg); |
1044 } | 1044 } |
1045 | 1045 |
1046 | 1046 |
1047 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 1047 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
1048 return new LocationSummary(0, 0, LocationSummary::kCall); | 1048 return new LocationSummary(0, 0, LocationSummary::kCall); |
1049 } | 1049 } |
1050 | 1050 |
1051 | 1051 |
1052 | 1052 |
1053 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1053 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1054 compiler->GenerateCallRuntime(cid(), | 1054 compiler->GenerateCallRuntime(deopt_id(), |
1055 token_pos(), | 1055 token_pos(), |
1056 try_index(), | 1056 try_index(), |
1057 kThrowRuntimeEntry); | 1057 kThrowRuntimeEntry); |
1058 __ int3(); | 1058 __ int3(); |
1059 } | 1059 } |
1060 | 1060 |
1061 | 1061 |
1062 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 1062 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
1063 return new LocationSummary(0, 0, LocationSummary::kCall); | 1063 return new LocationSummary(0, 0, LocationSummary::kCall); |
1064 } | 1064 } |
1065 | 1065 |
1066 | 1066 |
1067 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1067 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1068 compiler->GenerateCallRuntime(cid(), | 1068 compiler->GenerateCallRuntime(deopt_id(), |
1069 token_pos(), | 1069 token_pos(), |
1070 try_index(), | 1070 try_index(), |
1071 kReThrowRuntimeEntry); | 1071 kReThrowRuntimeEntry); |
1072 __ int3(); | 1072 __ int3(); |
1073 } | 1073 } |
1074 | 1074 |
1075 | 1075 |
1076 LocationSummary* GotoInstr::MakeLocationSummary() const { | 1076 LocationSummary* GotoInstr::MakeLocationSummary() const { |
1077 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 1077 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
1078 } | 1078 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 } | 1199 } |
1200 | 1200 |
1201 | 1201 |
1202 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 1202 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
1203 return MakeCallSummary(); | 1203 return MakeCallSummary(); |
1204 } | 1204 } |
1205 | 1205 |
1206 | 1206 |
1207 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1207 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1208 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 1208 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
1209 cid(), | 1209 deopt_id(), |
1210 token_pos(), | 1210 token_pos(), |
1211 try_index()); | 1211 try_index()); |
1212 compiler->GenerateInstanceCall(cid(), | 1212 compiler->GenerateInstanceCall(deopt_id(), |
1213 token_pos(), | 1213 token_pos(), |
1214 try_index(), | 1214 try_index(), |
1215 function_name(), | 1215 function_name(), |
1216 ArgumentCount(), | 1216 ArgumentCount(), |
1217 argument_names(), | 1217 argument_names(), |
1218 checked_argument_count()); | 1218 checked_argument_count()); |
1219 } | 1219 } |
1220 | 1220 |
1221 | 1221 |
1222 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 1222 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
1223 return MakeCallSummary(); | 1223 return MakeCallSummary(); |
1224 } | 1224 } |
1225 | 1225 |
1226 | 1226 |
1227 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1227 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1228 Label done; | 1228 Label done; |
1229 if (recognized() == MethodRecognizer::kMathSqrt) { | 1229 if (recognized() == MethodRecognizer::kMathSqrt) { |
1230 compiler->GenerateInlinedMathSqrt(&done); | 1230 compiler->GenerateInlinedMathSqrt(&done); |
1231 // Falls through to static call when operand type is not double or smi. | 1231 // Falls through to static call when operand type is not double or smi. |
1232 } | 1232 } |
1233 compiler->GenerateStaticCall(cid(), | 1233 compiler->GenerateStaticCall(deopt_id(), |
1234 token_pos(), | 1234 token_pos(), |
1235 try_index(), | 1235 try_index(), |
1236 function(), | 1236 function(), |
1237 ArgumentCount(), | 1237 ArgumentCount(), |
1238 argument_names()); | 1238 argument_names()); |
1239 __ Bind(&done); | 1239 __ Bind(&done); |
1240 } | 1240 } |
1241 | 1241 |
1242 | 1242 |
1243 LocationSummary* UseVal::MakeLocationSummary() const { | 1243 LocationSummary* UseVal::MakeLocationSummary() const { |
1244 return NULL; | 1244 return NULL; |
1245 } | 1245 } |
1246 | 1246 |
1247 | 1247 |
1248 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 1248 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
1249 UNIMPLEMENTED(); | 1249 UNIMPLEMENTED(); |
1250 } | 1250 } |
1251 | 1251 |
1252 | 1252 |
1253 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1253 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1254 compiler->GenerateAssertAssignable(cid(), | 1254 compiler->GenerateAssertAssignable(deopt_id(), |
1255 token_pos(), | 1255 token_pos(), |
1256 try_index(), | 1256 try_index(), |
1257 dst_type(), | 1257 dst_type(), |
1258 dst_name()); | 1258 dst_name()); |
1259 ASSERT(locs()->in(0).reg() == locs()->out().reg()); | 1259 ASSERT(locs()->in(0).reg() == locs()->out().reg()); |
1260 } | 1260 } |
1261 | 1261 |
1262 | 1262 |
1263 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 1263 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
1264 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1264 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 if (compiler->is_ssa()) { | 1388 if (compiler->is_ssa()) { |
1389 ASSERT(locs()->in(0).IsRegister()); | 1389 ASSERT(locs()->in(0).IsRegister()); |
1390 __ PushRegister(locs()->in(0).reg()); | 1390 __ PushRegister(locs()->in(0).reg()); |
1391 } | 1391 } |
1392 } | 1392 } |
1393 | 1393 |
1394 | 1394 |
1395 #undef __ | 1395 #undef __ |
1396 | 1396 |
1397 } // namespace dart | 1397 } // namespace dart |
OLD | NEW |