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

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

Issue 15564004: Refactor the IL for object allocation with type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ASSERT(!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 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
1567 if (type_arguments().IsRawInstantiatedRaw(len)) { 1567 __ BranchEqual(instantiator_reg,
1568 __ BranchEqual(instantiator_reg, 1568 reinterpret_cast<intptr_t>(Object::null()),
1569 reinterpret_cast<intptr_t>(Object::null()), 1569 &type_arguments_instantiated);
1570 &type_arguments_instantiated);
1571 }
1572 // Instantiate non-null type arguments. 1570 // Instantiate non-null type arguments.
1573 // In the non-factory case, we rely on the allocation stub to 1571 // In the non-factory case, we rely on the allocation stub to
1574 // instantiate the type arguments. 1572 // instantiate the type arguments.
1575 __ LoadObject(result_reg, type_arguments()); 1573 __ LoadObject(result_reg, type_arguments());
1576 // result_reg: uninstantiated type arguments. 1574 // result_reg: uninstantiated type arguments.
1577 __ Bind(&type_arguments_instantiated); 1575 __ Bind(&type_arguments_instantiated);
1578 1576
1579 // result_reg: uninstantiated or instantiated type arguments. 1577 // result_reg: uninstantiated or instantiated type arguments.
1580 } 1578 }
1581 1579
(...skipping 17 matching lines...) Expand all
1599 1597
1600 // instantiator_reg is the instantiator AbstractTypeArguments object 1598 // instantiator_reg is the instantiator AbstractTypeArguments object
1601 // (or null). 1599 // (or null).
1602 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 1600 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1603 !type_arguments().CanShareInstantiatorTypeArguments( 1601 !type_arguments().CanShareInstantiatorTypeArguments(
1604 instantiator_class())); 1602 instantiator_class()));
1605 1603
1606 // If the instantiator is null and if the type argument vector 1604 // If the instantiator is null and if the type argument vector
1607 // instantiated from null becomes a vector of dynamic, then use null as 1605 // instantiated from null becomes a vector of dynamic, then use null as
1608 // the type arguments and do not pass the instantiator. 1606 // the type arguments and do not pass the instantiator.
1609 const intptr_t len = type_arguments().Length(); 1607 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
1610 if (type_arguments().IsRawInstantiatedRaw(len)) { 1608 Label instantiator_not_null;
1611 Label instantiator_not_null; 1609 __ BranchNotEqual(instantiator_reg,
1612 __ BranchNotEqual(instantiator_reg, 1610 reinterpret_cast<intptr_t>(Object::null()), &instantiator_not_null);
1613 reinterpret_cast<intptr_t>(Object::null()), &instantiator_not_null); 1611 // Null was used in VisitExtractConstructorTypeArguments as the
1614 // Null was used in VisitExtractConstructorTypeArguments as the 1612 // instantiated type arguments, no proper instantiator needed.
1615 // instantiated type arguments, no proper instantiator needed. 1613 __ LoadImmediate(instantiator_reg,
1616 __ LoadImmediate(instantiator_reg, 1614 Smi::RawValue(StubCode::kNoInstantiator));
1617 Smi::RawValue(StubCode::kNoInstantiator)); 1615 __ Bind(&instantiator_not_null);
1618 __ Bind(&instantiator_not_null);
1619 }
1620 // instantiator_reg: instantiator or kNoInstantiator. 1616 // instantiator_reg: instantiator or kNoInstantiator.
1621 } 1617 }
1622 1618
1623 1619
1624 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { 1620 LocationSummary* AllocateContextInstr::MakeLocationSummary() const {
1625 const intptr_t kNumInputs = 0; 1621 const intptr_t kNumInputs = 0;
1626 const intptr_t kNumTemps = 1; 1622 const intptr_t kNumTemps = 1;
1627 LocationSummary* locs = 1623 LocationSummary* locs =
1628 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1624 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1629 locs->set_temp(0, Location::RegisterLocation(T1)); 1625 locs->set_temp(0, Location::RegisterLocation(T1));
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 compiler->GenerateCall(token_pos(), 2893 compiler->GenerateCall(token_pos(),
2898 &label, 2894 &label,
2899 PcDescriptors::kOther, 2895 PcDescriptors::kOther,
2900 locs()); 2896 locs());
2901 __ Drop(2); // Discard type arguments and receiver. 2897 __ Drop(2); // Discard type arguments and receiver.
2902 } 2898 }
2903 2899
2904 } // namespace dart 2900 } // namespace dart
2905 2901
2906 #endif // defined TARGET_ARCH_MIPS 2902 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698