| Index: runtime/vm/intermediate_language_arm.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_arm.cc (revision 22056)
|
| +++ runtime/vm/intermediate_language_arm.cc (working copy)
|
| @@ -1442,11 +1442,10 @@
|
|
|
| LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 1;
|
| - const intptr_t kNumTemps = 1;
|
| + const intptr_t kNumTemps = 0;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
|
| locs->set_in(0, Location::RegisterLocation(R0));
|
| - locs->set_temp(0, Location::RegisterLocation(R1));
|
| locs->set_out(Location::RegisterLocation(R0));
|
| return locs;
|
| }
|
| @@ -1455,48 +1454,34 @@
|
| void InstantiateTypeArgumentsInstr::EmitNativeCode(
|
| FlowGraphCompiler* compiler) {
|
| Register instantiator_reg = locs()->in(0).reg();
|
| - Register temp = locs()->temp(0).reg();
|
| Register result_reg = locs()->out().reg();
|
|
|
| // 'instantiator_reg' is the instantiator AbstractTypeArguments object
|
| // (or null).
|
| - // If the instantiator is null and if the type argument vector
|
| - // instantiated from null becomes a vector of dynamic, then use null as
|
| - // the type arguments.
|
| - Label type_arguments_instantiated;
|
| - const intptr_t len = type_arguments().Length();
|
| - if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| - __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
|
| - __ cmp(instantiator_reg, ShifterOperand(IP));
|
| - __ b(&type_arguments_instantiated, EQ);
|
| + if (!type_arguments().IsUninstantiatedIdentity()) {
|
| + // If the instantiator is null and if the type argument vector
|
| + // instantiated from null becomes a vector of dynamic, then use null as
|
| + // the type arguments.
|
| + Label type_arguments_instantiated;
|
| + const intptr_t len = type_arguments().Length();
|
| + if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| + __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
|
| + __ cmp(instantiator_reg, ShifterOperand(IP));
|
| + __ b(&type_arguments_instantiated, EQ);
|
| + }
|
| + // Instantiate non-null type arguments.
|
| + // A runtime call to instantiate the type arguments is required.
|
| + __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| + __ PushObject(type_arguments());
|
| + __ Push(instantiator_reg); // Push instantiator type arguments.
|
| + compiler->GenerateCallRuntime(token_pos(),
|
| + deopt_id(),
|
| + kInstantiateTypeArgumentsRuntimeEntry,
|
| + locs());
|
| + __ Drop(2); // Drop instantiator and uninstantiated type arguments.
|
| + __ Pop(result_reg); // Pop instantiated type arguments.
|
| + __ Bind(&type_arguments_instantiated);
|
| }
|
| - // Instantiate non-null type arguments.
|
| - if (type_arguments().IsUninstantiatedIdentity()) {
|
| - // Check if the instantiator type argument vector is a TypeArguments of a
|
| - // matching length and, if so, use it as the instantiated type_arguments.
|
| - // No need to check the instantiator ('instantiator_reg') for null here,
|
| - // because a null instantiator will have the wrong class (Null instead of
|
| - // TypeArguments).
|
| - Label type_arguments_uninstantiated;
|
| - __ CompareClassId(instantiator_reg, kTypeArgumentsCid, temp);
|
| - __ b(&type_arguments_uninstantiated, NE);
|
| - __ ldr(temp,
|
| - FieldAddress(instantiator_reg, TypeArguments::length_offset()));
|
| - __ CompareImmediate(temp, Smi::RawValue(len));
|
| - __ b(&type_arguments_instantiated, EQ);
|
| - __ Bind(&type_arguments_uninstantiated);
|
| - }
|
| - // A runtime call to instantiate the type arguments is required.
|
| - __ PushObject(Object::ZoneHandle()); // Make room for the result.
|
| - __ PushObject(type_arguments());
|
| - __ Push(instantiator_reg); // Push instantiator type arguments.
|
| - compiler->GenerateCallRuntime(token_pos(),
|
| - deopt_id(),
|
| - kInstantiateTypeArgumentsRuntimeEntry,
|
| - locs());
|
| - __ Drop(2); // Drop instantiator and uninstantiated type arguments.
|
| - __ Pop(result_reg); // Pop instantiated type arguments.
|
| - __ Bind(&type_arguments_instantiated);
|
| ASSERT(instantiator_reg == result_reg);
|
| // 'result_reg': Instantiated type arguments.
|
| }
|
| @@ -1505,12 +1490,11 @@
|
| LocationSummary*
|
| ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 1;
|
| - const intptr_t kNumTemps = 1;
|
| + const intptr_t kNumTemps = 0;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| locs->set_in(0, Location::RequiresRegister());
|
| locs->set_out(Location::SameAsFirstInput());
|
| - locs->set_temp(0, Location::RequiresRegister());
|
| return locs;
|
| }
|
|
|
| @@ -1520,40 +1504,28 @@
|
| Register instantiator_reg = locs()->in(0).reg();
|
| Register result_reg = locs()->out().reg();
|
| ASSERT(instantiator_reg == result_reg);
|
| - Register temp_reg = locs()->temp(0).reg();
|
|
|
| // instantiator_reg is the instantiator type argument vector, i.e. an
|
| // AbstractTypeArguments object (or null).
|
| - // If the instantiator is null and if the type argument vector
|
| - // instantiated from null becomes a vector of dynamic, then use null as
|
| - // the type arguments.
|
| - Label type_arguments_instantiated;
|
| - const intptr_t len = type_arguments().Length();
|
| - if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| - __ CompareImmediate(instantiator_reg,
|
| - reinterpret_cast<intptr_t>(Object::null()));
|
| - __ b(&type_arguments_instantiated, EQ);
|
| + if (!type_arguments().IsUninstantiatedIdentity()) {
|
| + // If the instantiator is null and if the type argument vector
|
| + // instantiated from null becomes a vector of dynamic, then use null as
|
| + // the type arguments.
|
| + Label type_arguments_instantiated;
|
| + const intptr_t len = type_arguments().Length();
|
| + if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| + __ CompareImmediate(instantiator_reg,
|
| + reinterpret_cast<intptr_t>(Object::null()));
|
| + __ b(&type_arguments_instantiated, EQ);
|
| + }
|
| + // Instantiate non-null type arguments.
|
| + // In the non-factory case, we rely on the allocation stub to
|
| + // instantiate the type arguments.
|
| + __ LoadObject(result_reg, type_arguments());
|
| + // result_reg: uninstantiated type arguments.
|
| + __ Bind(&type_arguments_instantiated);
|
| }
|
| - // Instantiate non-null type arguments.
|
| - if (type_arguments().IsUninstantiatedIdentity()) {
|
| - // Check if the instantiator type argument vector is a TypeArguments of a
|
| - // matching length and, if so, use it as the instantiated type_arguments.
|
| - // No need to check instantiator_reg for null here, because a null
|
| - // instantiator will have the wrong class (Null instead of TypeArguments).
|
| - Label type_arguments_uninstantiated;
|
| - __ CompareClassId(instantiator_reg, kTypeArgumentsCid, temp_reg);
|
| - __ b(&type_arguments_uninstantiated, NE);
|
| - __ ldr(temp_reg,
|
| - FieldAddress(instantiator_reg, TypeArguments::length_offset()));
|
| - __ CompareImmediate(temp_reg, Smi::RawValue(type_arguments().Length()));
|
| - __ b(&type_arguments_instantiated, EQ);
|
| - __ Bind(&type_arguments_uninstantiated);
|
| - }
|
| - // In the non-factory case, we rely on the allocation stub to
|
| - // instantiate the type arguments.
|
| - __ LoadObject(result_reg, type_arguments());
|
| - // result_reg: uninstantiated type arguments.
|
| - __ Bind(&type_arguments_instantiated);
|
| + ASSERT(instantiator_reg == result_reg);
|
| // result_reg: uninstantiated or instantiated type arguments.
|
| }
|
|
|
| @@ -1561,12 +1533,11 @@
|
| LocationSummary*
|
| ExtractConstructorInstantiatorInstr::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 1;
|
| - const intptr_t kNumTemps = 1;
|
| + const intptr_t kNumTemps = 0;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| locs->set_in(0, Location::RequiresRegister());
|
| locs->set_out(Location::SameAsFirstInput());
|
| - locs->set_temp(0, Location::RequiresRegister());
|
| return locs;
|
| }
|
|
|
| @@ -1575,51 +1546,31 @@
|
| FlowGraphCompiler* compiler) {
|
| Register instantiator_reg = locs()->in(0).reg();
|
| ASSERT(locs()->out().reg() == instantiator_reg);
|
| - Register temp_reg = locs()->temp(0).reg();
|
|
|
| // instantiator_reg is the instantiator AbstractTypeArguments object
|
| - // (or null). If the instantiator is null and if the type argument vector
|
| - // instantiated from null becomes a vector of dynamic, then use null as
|
| - // the type arguments and do not pass the instantiator.
|
| - Label done;
|
| - const intptr_t len = type_arguments().Length();
|
| - if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| - Label instantiator_not_null;
|
| - __ CompareImmediate(instantiator_reg,
|
| - reinterpret_cast<intptr_t>(Object::null()));
|
| - __ b(&instantiator_not_null, NE);
|
| - // Null was used in VisitExtractConstructorTypeArguments as the
|
| - // instantiated type arguments, no proper instantiator needed.
|
| - __ LoadImmediate(instantiator_reg,
|
| - Smi::RawValue(StubCode::kNoInstantiator));
|
| - __ b(&done);
|
| - __ Bind(&instantiator_not_null);
|
| - }
|
| - // Instantiate non-null type arguments.
|
| + // (or null).
|
| if (type_arguments().IsUninstantiatedIdentity()) {
|
| - // TODO(regis): The following emitted code is duplicated in
|
| - // VisitExtractConstructorTypeArguments above. The reason is that the code
|
| - // is split between two computations, so that each one produces a
|
| - // single value, rather than producing a pair of values.
|
| - // If this becomes an issue, we should expose these tests at the IL level.
|
| -
|
| - // Check if the instantiator type argument vector is a TypeArguments of a
|
| - // matching length and, if so, use it as the instantiated type_arguments.
|
| - // No need to check the instantiator ('instantiator_reg') for null here,
|
| - // because a null instantiator will have the wrong class (Null instead of
|
| - // TypeArguments).
|
| - __ CompareClassId(instantiator_reg, kTypeArgumentsCid, temp_reg);
|
| - __ b(&done, NE);
|
| - __ ldr(temp_reg,
|
| - FieldAddress(instantiator_reg, TypeArguments::length_offset()));
|
| - __ CompareImmediate(temp_reg, Smi::RawValue(type_arguments().Length()));
|
| - __ b(&done, NE);
|
| // The instantiator was used in VisitExtractConstructorTypeArguments as the
|
| // instantiated type arguments, no proper instantiator needed.
|
| __ LoadImmediate(instantiator_reg,
|
| Smi::RawValue(StubCode::kNoInstantiator));
|
| + } else {
|
| + // If the instantiator is null and if the type argument vector
|
| + // instantiated from null becomes a vector of dynamic, then use null as
|
| + // the type arguments and do not pass the instantiator.
|
| + const intptr_t len = type_arguments().Length();
|
| + if (type_arguments().IsRawInstantiatedRaw(len)) {
|
| + Label instantiator_not_null;
|
| + __ CompareImmediate(instantiator_reg,
|
| + reinterpret_cast<intptr_t>(Object::null()));
|
| + __ b(&instantiator_not_null, NE);
|
| + // Null was used in VisitExtractConstructorTypeArguments as the
|
| + // instantiated type arguments, no proper instantiator needed.
|
| + __ LoadImmediate(instantiator_reg,
|
| + Smi::RawValue(StubCode::kNoInstantiator));
|
| + __ Bind(&instantiator_not_null);
|
| + }
|
| }
|
| - __ Bind(&done);
|
| // instantiator_reg: instantiator or kNoInstantiator.
|
| }
|
|
|
|
|