OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 } | 1418 } |
1419 | 1419 |
1420 | 1420 |
1421 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1421 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1422 UNIMPLEMENTED(); | 1422 UNIMPLEMENTED(); |
1423 } | 1423 } |
1424 | 1424 |
1425 | 1425 |
1426 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( | 1426 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( |
1427 bool opt) const { | 1427 bool opt) const { |
1428 UNIMPLEMENTED(); | 1428 const intptr_t kNumInputs = 1; |
1429 return NULL; | 1429 const intptr_t kNumTemps = 0; |
| 1430 LocationSummary* locs = |
| 1431 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1432 locs->set_in(0, Location::RegisterLocation(R0)); |
| 1433 locs->set_out(0, Location::RegisterLocation(R0)); |
| 1434 return locs; |
1430 } | 1435 } |
1431 | 1436 |
1432 | 1437 |
1433 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 1438 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
1434 FlowGraphCompiler* compiler) { | 1439 FlowGraphCompiler* compiler) { |
1435 UNIMPLEMENTED(); | 1440 Register instantiator_reg = locs()->in(0).reg(); |
| 1441 Register result_reg = locs()->out(0).reg(); |
| 1442 ASSERT(instantiator_reg == R0); |
| 1443 ASSERT(instantiator_reg == result_reg); |
| 1444 |
| 1445 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 1446 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 1447 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1448 instantiator_class())); |
| 1449 // If the instantiator is null and if the type argument vector |
| 1450 // instantiated from null becomes a vector of dynamic, then use null as |
| 1451 // the type arguments. |
| 1452 Label type_arguments_instantiated; |
| 1453 const intptr_t len = type_arguments().Length(); |
| 1454 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1455 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
| 1456 __ b(&type_arguments_instantiated, EQ); |
| 1457 } |
| 1458 |
| 1459 __ LoadObject(R2, type_arguments(), PP); |
| 1460 __ LoadFieldFromOffset(R2, R2, TypeArguments::instantiations_offset()); |
| 1461 __ AddImmediate(R2, R2, Array::data_offset() - kHeapObjectTag, PP); |
| 1462 // The instantiations cache is initialized with Object::zero_array() and is |
| 1463 // therefore guaranteed to contain kNoInstantiator. No length check needed. |
| 1464 Label loop, found, slow_case; |
| 1465 __ Bind(&loop); |
| 1466 __ LoadFromOffset(R1, R2, 0 * kWordSize); // Cached instantiator. |
| 1467 __ CompareRegisters(R1, R0); |
| 1468 __ b(&found, EQ); |
| 1469 __ AddImmediate(R2, R2, 2 * kWordSize, PP); |
| 1470 __ CompareImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator), PP); |
| 1471 __ b(&loop, NE); |
| 1472 __ b(&slow_case); |
| 1473 __ Bind(&found); |
| 1474 __ LoadFromOffset(R0, R2, 1 * kWordSize); // Cached instantiated args. |
| 1475 __ b(&type_arguments_instantiated); |
| 1476 |
| 1477 __ Bind(&slow_case); |
| 1478 // Instantiate non-null type arguments. |
| 1479 // A runtime call to instantiate the type arguments is required. |
| 1480 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 1481 __ PushObject(type_arguments(), PP); |
| 1482 __ Push(instantiator_reg); // Push instantiator type arguments. |
| 1483 compiler->GenerateRuntimeCall(token_pos(), |
| 1484 deopt_id(), |
| 1485 kInstantiateTypeArgumentsRuntimeEntry, |
| 1486 2, |
| 1487 locs()); |
| 1488 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 1489 __ Pop(result_reg); // Pop instantiated type arguments. |
| 1490 __ Bind(&type_arguments_instantiated); |
1436 } | 1491 } |
1437 | 1492 |
1438 | 1493 |
1439 LocationSummary* AllocateContextInstr::MakeLocationSummary(bool opt) const { | 1494 LocationSummary* AllocateContextInstr::MakeLocationSummary(bool opt) const { |
1440 const intptr_t kNumInputs = 0; | 1495 const intptr_t kNumInputs = 0; |
1441 const intptr_t kNumTemps = 1; | 1496 const intptr_t kNumTemps = 1; |
1442 LocationSummary* locs = | 1497 LocationSummary* locs = |
1443 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1498 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
1444 locs->set_temp(0, Location::RegisterLocation(R1)); | 1499 locs->set_temp(0, Location::RegisterLocation(R1)); |
1445 locs->set_out(0, Location::RegisterLocation(R0)); | 1500 locs->set_out(0, Location::RegisterLocation(R0)); |
1446 return locs; | 1501 return locs; |
1447 } | 1502 } |
1448 | 1503 |
1449 | 1504 |
1450 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1505 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1451 ASSERT(locs()->temp(0).reg() == R1); | 1506 ASSERT(locs()->temp(0).reg() == R1); |
1452 ASSERT(locs()->out(0).reg() == R0); | 1507 ASSERT(locs()->out(0).reg() == R0); |
1453 | 1508 |
1454 __ LoadImmediate(R1, num_context_variables(), PP); | 1509 __ LoadImmediate(R1, num_context_variables(), PP); |
1455 const ExternalLabel label("alloc_context", | 1510 const ExternalLabel label("alloc_context", |
1456 StubCode::AllocateContextEntryPoint()); | 1511 StubCode::AllocateContextEntryPoint()); |
1457 compiler->GenerateCall(token_pos(), | 1512 compiler->GenerateCall(token_pos(), |
1458 &label, | 1513 &label, |
1459 PcDescriptors::kOther, | 1514 PcDescriptors::kOther, |
1460 locs()); | 1515 locs()); |
1461 } | 1516 } |
1462 | 1517 |
1463 | 1518 |
1464 LocationSummary* CloneContextInstr::MakeLocationSummary(bool opt) const { | 1519 LocationSummary* CloneContextInstr::MakeLocationSummary(bool opt) const { |
1465 UNIMPLEMENTED(); | 1520 const intptr_t kNumInputs = 1; |
1466 return NULL; | 1521 const intptr_t kNumTemps = 0; |
| 1522 LocationSummary* locs = |
| 1523 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1524 locs->set_in(0, Location::RegisterLocation(R0)); |
| 1525 locs->set_out(0, Location::RegisterLocation(R0)); |
| 1526 return locs; |
1467 } | 1527 } |
1468 | 1528 |
1469 | 1529 |
1470 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1530 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1471 UNIMPLEMENTED(); | 1531 Register context_value = locs()->in(0).reg(); |
| 1532 Register result = locs()->out(0).reg(); |
| 1533 |
| 1534 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 1535 __ Push(context_value); |
| 1536 compiler->GenerateRuntimeCall(token_pos(), |
| 1537 deopt_id(), |
| 1538 kCloneContextRuntimeEntry, |
| 1539 1, |
| 1540 locs()); |
| 1541 __ Drop(1); // Remove argument. |
| 1542 __ Pop(result); // Get result (cloned context). |
1472 } | 1543 } |
1473 | 1544 |
1474 | 1545 |
1475 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(bool opt) const { | 1546 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(bool opt) const { |
1476 UNREACHABLE(); | 1547 UNREACHABLE(); |
1477 return NULL; | 1548 return NULL; |
1478 } | 1549 } |
1479 | 1550 |
1480 | 1551 |
1481 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1552 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 compiler->GenerateCall(token_pos(), | 2626 compiler->GenerateCall(token_pos(), |
2556 &label, | 2627 &label, |
2557 PcDescriptors::kOther, | 2628 PcDescriptors::kOther, |
2558 locs()); | 2629 locs()); |
2559 __ Drop(ArgumentCount()); // Discard arguments. | 2630 __ Drop(ArgumentCount()); // Discard arguments. |
2560 } | 2631 } |
2561 | 2632 |
2562 } // namespace dart | 2633 } // namespace dart |
2563 | 2634 |
2564 #endif // defined TARGET_ARCH_ARM64 | 2635 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |