Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 14672035: Further improve and simplify IL for building constructor type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1549
1550 1550
1551 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 1551 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
1552 FlowGraphCompiler* compiler) { 1552 FlowGraphCompiler* compiler) {
1553 Register instantiator_reg = locs()->in(0).reg(); 1553 Register instantiator_reg = locs()->in(0).reg();
1554 Register result_reg = locs()->out().reg(); 1554 Register result_reg = locs()->out().reg();
1555 ASSERT(instantiator_reg == result_reg); 1555 ASSERT(instantiator_reg == result_reg);
1556 1556
1557 // instantiator_reg is the instantiator type argument vector, i.e. an 1557 // instantiator_reg is the instantiator type argument vector, i.e. an
1558 // AbstractTypeArguments object (or null). 1558 // AbstractTypeArguments object (or null).
1559 if (!type_arguments().IsUninstantiatedIdentity() && 1559 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1560 !type_arguments().CanShareInstantiatorTypeArguments( 1560 !type_arguments().CanShareInstantiatorTypeArguments(
1561 instantiator_class())) { 1561 instantiator_class()));
1562 // If the instantiator is null and if the type argument vector 1562 // If the instantiator is null and if the type argument vector
1563 // instantiated from null becomes a vector of dynamic, then use null as 1563 // instantiated from null becomes a vector of dynamic, then use null as
1564 // the type arguments. 1564 // the type arguments.
1565 Label type_arguments_instantiated; 1565 Label type_arguments_instantiated;
1566 const intptr_t len = type_arguments().Length(); 1566 const intptr_t len = type_arguments().Length();
1567 if (type_arguments().IsRawInstantiatedRaw(len)) { 1567 if (type_arguments().IsRawInstantiatedRaw(len)) {
1568 __ BranchEqual(instantiator_reg, 1568 __ BranchEqual(instantiator_reg,
1569 reinterpret_cast<intptr_t>(Object::null()), 1569 reinterpret_cast<intptr_t>(Object::null()),
1570 &type_arguments_instantiated); 1570 &type_arguments_instantiated);
1571 }
1572 // Instantiate non-null type arguments.
1573 // In the non-factory case, we rely on the allocation stub to
1574 // instantiate the type arguments.
1575 __ LoadObject(result_reg, type_arguments());
1576 // result_reg: uninstantiated type arguments.
1577 __ Bind(&type_arguments_instantiated);
1578 } 1571 }
1579 ASSERT(instantiator_reg == result_reg); 1572 // Instantiate non-null type arguments.
1573 // In the non-factory case, we rely on the allocation stub to
1574 // instantiate the type arguments.
1575 __ LoadObject(result_reg, type_arguments());
1576 // result_reg: uninstantiated type arguments.
1577 __ Bind(&type_arguments_instantiated);
1578
1580 // result_reg: uninstantiated or instantiated type arguments. 1579 // result_reg: uninstantiated or instantiated type arguments.
1581 } 1580 }
1582 1581
1583 1582
1584 LocationSummary* 1583 LocationSummary*
1585 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { 1584 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const {
1586 const intptr_t kNumInputs = 1; 1585 const intptr_t kNumInputs = 1;
1587 const intptr_t kNumTemps = 0; 1586 const intptr_t kNumTemps = 0;
1588 LocationSummary* locs = 1587 LocationSummary* locs =
1589 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1588 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1590 locs->set_in(0, Location::RequiresRegister()); 1589 locs->set_in(0, Location::RequiresRegister());
1591 locs->set_out(Location::SameAsFirstInput()); 1590 locs->set_out(Location::SameAsFirstInput());
1592 return locs; 1591 return locs;
1593 } 1592 }
1594 1593
1595 1594
1596 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 1595 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
1597 FlowGraphCompiler* compiler) { 1596 FlowGraphCompiler* compiler) {
1598 Register instantiator_reg = locs()->in(0).reg(); 1597 Register instantiator_reg = locs()->in(0).reg();
1599 ASSERT(locs()->out().reg() == instantiator_reg); 1598 ASSERT(locs()->out().reg() == instantiator_reg);
1600 1599
1601 // instantiator_reg is the instantiator AbstractTypeArguments object 1600 // instantiator_reg is the instantiator AbstractTypeArguments object
1602 // (or null). 1601 // (or null).
1603 if (type_arguments().IsUninstantiatedIdentity() || 1602 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1604 type_arguments().CanShareInstantiatorTypeArguments( 1603 !type_arguments().CanShareInstantiatorTypeArguments(
1605 instantiator_class())) { 1604 instantiator_class()));
1606 // The instantiator was used in VisitExtractConstructorTypeArguments as the 1605
1606 // If the instantiator is null and if the type argument vector
1607 // instantiated from null becomes a vector of dynamic, then use null as
1608 // the type arguments and do not pass the instantiator.
1609 const intptr_t len = type_arguments().Length();
1610 if (type_arguments().IsRawInstantiatedRaw(len)) {
1611 Label instantiator_not_null;
1612 __ BranchNotEqual(instantiator_reg,
1613 reinterpret_cast<intptr_t>(Object::null()), &instantiator_not_null);
1614 // Null was used in VisitExtractConstructorTypeArguments as the
1607 // instantiated type arguments, no proper instantiator needed. 1615 // instantiated type arguments, no proper instantiator needed.
1608 __ LoadImmediate(instantiator_reg, 1616 __ LoadImmediate(instantiator_reg,
1609 Smi::RawValue(StubCode::kNoInstantiator)); 1617 Smi::RawValue(StubCode::kNoInstantiator));
1610 } else { 1618 __ Bind(&instantiator_not_null);
1611 // If the instantiator is null and if the type argument vector
1612 // instantiated from null becomes a vector of dynamic, then use null as
1613 // the type arguments and do not pass the instantiator.
1614 const intptr_t len = type_arguments().Length();
1615 if (type_arguments().IsRawInstantiatedRaw(len)) {
1616 Label instantiator_not_null;
1617 __ BranchNotEqual(instantiator_reg,
1618 reinterpret_cast<intptr_t>(Object::null()), &instantiator_not_null);
1619 // Null was used in VisitExtractConstructorTypeArguments as the
1620 // instantiated type arguments, no proper instantiator needed.
1621 __ LoadImmediate(instantiator_reg,
1622 Smi::RawValue(StubCode::kNoInstantiator));
1623 __ Bind(&instantiator_not_null);
1624 }
1625 } 1619 }
1626 // instantiator_reg: instantiator or kNoInstantiator. 1620 // instantiator_reg: instantiator or kNoInstantiator.
1627 } 1621 }
1628 1622
1629 1623
1630 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { 1624 LocationSummary* AllocateContextInstr::MakeLocationSummary() const {
1631 const intptr_t kNumInputs = 0; 1625 const intptr_t kNumInputs = 0;
1632 const intptr_t kNumTemps = 1; 1626 const intptr_t kNumTemps = 1;
1633 LocationSummary* locs = 1627 LocationSummary* locs =
1634 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1628 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 compiler->GenerateCall(token_pos(), 2897 compiler->GenerateCall(token_pos(),
2904 &label, 2898 &label,
2905 PcDescriptors::kOther, 2899 PcDescriptors::kOther,
2906 locs()); 2900 locs());
2907 __ Drop(2); // Discard type arguments and receiver. 2901 __ Drop(2); // Discard type arguments and receiver.
2908 } 2902 }
2909 2903
2910 } // namespace dart 2904 } // namespace dart
2911 2905
2912 #endif // defined TARGET_ARCH_MIPS 2906 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698