| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 return new LocationSummary(0, 0, LocationSummary::kCall); | 1171 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 | 1174 |
| 1175 | 1175 |
| 1176 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1176 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1177 compiler->GenerateCallRuntime(deopt_id(), | 1177 compiler->GenerateCallRuntime(deopt_id(), |
| 1178 token_pos(), | 1178 token_pos(), |
| 1179 try_index(), | 1179 try_index(), |
| 1180 kThrowRuntimeEntry, | 1180 kThrowRuntimeEntry, |
| 1181 locs()->stack_bitmap()); | 1181 locs()); |
| 1182 __ int3(); | 1182 __ int3(); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 | 1185 |
| 1186 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 1186 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| 1187 return new LocationSummary(0, 0, LocationSummary::kCall); | 1187 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 | 1190 |
| 1191 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1191 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1192 compiler->GenerateCallRuntime(deopt_id(), | 1192 compiler->GenerateCallRuntime(deopt_id(), |
| 1193 token_pos(), | 1193 token_pos(), |
| 1194 try_index(), | 1194 try_index(), |
| 1195 kReThrowRuntimeEntry, | 1195 kReThrowRuntimeEntry, |
| 1196 locs()->stack_bitmap()); | 1196 locs()); |
| 1197 __ int3(); | 1197 __ int3(); |
| 1198 } | 1198 } |
| 1199 | 1199 |
| 1200 | 1200 |
| 1201 LocationSummary* GotoInstr::MakeLocationSummary() const { | 1201 LocationSummary* GotoInstr::MakeLocationSummary() const { |
| 1202 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 1202 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 | 1205 |
| 1206 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1206 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 int argument_count = ArgumentCount(); | 1313 int argument_count = ArgumentCount(); |
| 1314 const Array& arguments_descriptor = | 1314 const Array& arguments_descriptor = |
| 1315 DartEntry::ArgumentsDescriptor(argument_count - 1, | 1315 DartEntry::ArgumentsDescriptor(argument_count - 1, |
| 1316 argument_names()); | 1316 argument_names()); |
| 1317 __ LoadObject(temp_reg, arguments_descriptor); | 1317 __ LoadObject(temp_reg, arguments_descriptor); |
| 1318 | 1318 |
| 1319 compiler->GenerateCall(token_pos(), | 1319 compiler->GenerateCall(token_pos(), |
| 1320 try_index(), | 1320 try_index(), |
| 1321 &StubCode::CallClosureFunctionLabel(), | 1321 &StubCode::CallClosureFunctionLabel(), |
| 1322 PcDescriptors::kOther, | 1322 PcDescriptors::kOther, |
| 1323 locs()->stack_bitmap()); | 1323 locs()); |
| 1324 __ Drop(argument_count); | 1324 __ Drop(argument_count); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 | 1327 |
| 1328 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 1328 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
| 1329 return MakeCallSummary(); | 1329 return MakeCallSummary(); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 | 1332 |
| 1333 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1333 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1334 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 1334 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 1335 deopt_id(), | 1335 deopt_id(), |
| 1336 token_pos(), | 1336 token_pos(), |
| 1337 try_index()); | 1337 try_index()); |
| 1338 compiler->GenerateInstanceCall(deopt_id(), | 1338 compiler->GenerateInstanceCall(deopt_id(), |
| 1339 token_pos(), | 1339 token_pos(), |
| 1340 try_index(), | 1340 try_index(), |
| 1341 function_name(), | 1341 function_name(), |
| 1342 ArgumentCount(), | 1342 ArgumentCount(), |
| 1343 argument_names(), | 1343 argument_names(), |
| 1344 checked_argument_count(), | 1344 checked_argument_count(), |
| 1345 locs()->stack_bitmap()); | 1345 locs()); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 | 1348 |
| 1349 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 1349 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
| 1350 return MakeCallSummary(); | 1350 return MakeCallSummary(); |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 | 1353 |
| 1354 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1354 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1355 Label done; | 1355 Label done; |
| 1356 if (recognized() == MethodRecognizer::kMathSqrt) { | 1356 if (recognized() == MethodRecognizer::kMathSqrt) { |
| 1357 compiler->GenerateInlinedMathSqrt(&done); | 1357 compiler->GenerateInlinedMathSqrt(&done); |
| 1358 // Falls through to static call when operand type is not double or smi. | 1358 // Falls through to static call when operand type is not double or smi. |
| 1359 } | 1359 } |
| 1360 compiler->GenerateStaticCall(deopt_id(), | 1360 compiler->GenerateStaticCall(deopt_id(), |
| 1361 token_pos(), | 1361 token_pos(), |
| 1362 try_index(), | 1362 try_index(), |
| 1363 function(), | 1363 function(), |
| 1364 ArgumentCount(), | 1364 ArgumentCount(), |
| 1365 argument_names(), | 1365 argument_names(), |
| 1366 locs()->stack_bitmap()); | 1366 locs()); |
| 1367 __ Bind(&done); | 1367 __ Bind(&done); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 | 1370 |
| 1371 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1371 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1372 if (!is_eliminated()) { | 1372 if (!is_eliminated()) { |
| 1373 compiler->GenerateAssertAssignable(deopt_id(), | 1373 compiler->GenerateAssertAssignable(deopt_id(), |
| 1374 token_pos(), | 1374 token_pos(), |
| 1375 try_index(), | 1375 try_index(), |
| 1376 dst_type(), | 1376 dst_type(), |
| 1377 dst_name(), | 1377 dst_name(), |
| 1378 locs()->stack_bitmap()); | 1378 locs()); |
| 1379 } | 1379 } |
| 1380 ASSERT(locs()->in(0).reg() == locs()->out().reg()); | 1380 ASSERT(locs()->in(0).reg() == locs()->out().reg()); |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 | 1383 |
| 1384 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 1384 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
| 1385 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1385 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
| 1386 locs->set_in(0, Location::RequiresRegister()); | 1386 locs->set_in(0, Location::RequiresRegister()); |
| 1387 locs->set_temp(0, Location::RequiresRegister()); | 1387 locs->set_temp(0, Location::RequiresRegister()); |
| 1388 locs->set_out(Location::SameAsFirstInput()); | 1388 locs->set_out(Location::SameAsFirstInput()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 | 1462 |
| 1463 | 1463 |
| 1464 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1464 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1465 const Class& cls = Class::ZoneHandle(constructor().Owner()); | 1465 const Class& cls = Class::ZoneHandle(constructor().Owner()); |
| 1466 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); | 1466 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls)); |
| 1467 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); | 1467 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); |
| 1468 compiler->GenerateCall(token_pos(), | 1468 compiler->GenerateCall(token_pos(), |
| 1469 try_index(), | 1469 try_index(), |
| 1470 &label, | 1470 &label, |
| 1471 PcDescriptors::kOther, | 1471 PcDescriptors::kOther, |
| 1472 locs()->stack_bitmap()); | 1472 locs()); |
| 1473 __ Drop(ArgumentCount()); // Discard arguments. | 1473 __ Drop(ArgumentCount()); // Discard arguments. |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 | 1476 |
| 1477 LocationSummary* CreateClosureComp::MakeLocationSummary() const { | 1477 LocationSummary* CreateClosureComp::MakeLocationSummary() const { |
| 1478 return MakeCallSummary(); | 1478 return MakeCallSummary(); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 | 1481 |
| 1482 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1482 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1483 const Function& closure_function = function(); | 1483 const Function& closure_function = function(); |
| 1484 const Code& stub = Code::Handle( | 1484 const Code& stub = Code::Handle( |
| 1485 StubCode::GetAllocationStubForClosure(closure_function)); | 1485 StubCode::GetAllocationStubForClosure(closure_function)); |
| 1486 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1486 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1487 compiler->GenerateCall(token_pos(), try_index(), &label, | 1487 compiler->GenerateCall(token_pos(), try_index(), &label, |
| 1488 PcDescriptors::kOther, | 1488 PcDescriptors::kOther, |
| 1489 locs()->stack_bitmap()); | 1489 locs()); |
| 1490 __ Drop(2); // Discard type arguments and receiver. | 1490 __ Drop(2); // Discard type arguments and receiver. |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 | 1493 |
| 1494 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { | 1494 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { |
| 1495 const intptr_t kNumInputs = 1; | 1495 const intptr_t kNumInputs = 1; |
| 1496 const intptr_t kNumTemps= 0; | 1496 const intptr_t kNumTemps= 0; |
| 1497 LocationSummary* locs = | 1497 LocationSummary* locs = |
| 1498 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1498 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1499 // TODO(fschneider): Use Any() once it is supported by all code generators. | 1499 // TODO(fschneider): Use Any() once it is supported by all code generators. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 ? UseDefinition(values()[i]->AsUse()->definition()) | 1544 ? UseDefinition(values()[i]->AsUse()->definition()) |
| 1545 : val); | 1545 : val); |
| 1546 } | 1546 } |
| 1547 return copy; | 1547 return copy; |
| 1548 } | 1548 } |
| 1549 | 1549 |
| 1550 | 1550 |
| 1551 #undef __ | 1551 #undef __ |
| 1552 | 1552 |
| 1553 } // namespace dart | 1553 } // namespace dart |
| OLD | NEW |