| Index: vm/intermediate_language_x64.cc
|
| ===================================================================
|
| --- vm/intermediate_language_x64.cc (revision 10409)
|
| +++ vm/intermediate_language_x64.cc (working copy)
|
| @@ -250,8 +250,9 @@
|
|
|
| LocationSummary* EqualityCompareComp::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 2;
|
| - if (receiver_class_id() != kObject) {
|
| - ASSERT((receiver_class_id() == kSmi) || (receiver_class_id() == kDouble));
|
| + if (receiver_class_id() != kObjectCid) {
|
| + ASSERT((receiver_class_id() == kSmiCid) ||
|
| + (receiver_class_id() == kDoubleCid));
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| @@ -333,10 +334,10 @@
|
| Register right = locs.in(1).reg();
|
| __ testq(left, Immediate(kSmiTagMask));
|
| Register temp = locs.temp(0).reg();
|
| - if (ic_data.GetReceiverClassIdAt(0) == kSmi) {
|
| + if (ic_data.GetReceiverClassIdAt(0) == kSmiCid) {
|
| Label done, load_class_id;
|
| __ j(NOT_ZERO, &load_class_id, Assembler::kNearJump);
|
| - __ movq(temp, Immediate(kSmi));
|
| + __ movq(temp, Immediate(kSmiCid));
|
| __ jmp(&done, Assembler::kNearJump);
|
| __ Bind(&load_class_id);
|
| __ LoadClassId(temp, left);
|
| @@ -348,7 +349,7 @@
|
| Condition cond = TokenKindToSmiCondition(kind);
|
| Label done;
|
| for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
|
| - ASSERT((ic_data.GetReceiverClassIdAt(i) != kSmi) || (i == 0));
|
| + ASSERT((ic_data.GetReceiverClassIdAt(i) != kSmiCid) || (i == 0));
|
| Label next_test;
|
| __ cmpq(temp, Immediate(ic_data.GetReceiverClassIdAt(i)));
|
| __ j(NOT_EQUAL, &next_test);
|
| @@ -534,12 +535,12 @@
|
|
|
|
|
| void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - if (receiver_class_id() == kSmi) {
|
| + if (receiver_class_id() == kSmiCid) {
|
| EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch.
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
| }
|
| - if (receiver_class_id() == kDouble) {
|
| + if (receiver_class_id() == kDoubleCid) {
|
| EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch.
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
| @@ -558,7 +559,7 @@
|
|
|
|
|
| LocationSummary* RelationalOpComp::MakeLocationSummary() const {
|
| - if (operands_class_id() == kSmi || operands_class_id() == kDouble) {
|
| + if (operands_class_id() == kSmiCid || operands_class_id() == kDoubleCid) {
|
| const intptr_t kNumInputs = 2;
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* summary =
|
| @@ -569,18 +570,18 @@
|
| summary->set_temp(0, Location::RequiresRegister());
|
| return summary;
|
| }
|
| - ASSERT(operands_class_id() == kObject);
|
| + ASSERT(operands_class_id() == kObjectCid);
|
| return MakeCallSummary();
|
| }
|
|
|
|
|
| void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - if (operands_class_id() == kSmi) {
|
| + if (operands_class_id() == kSmiCid) {
|
| EmitSmiComparisonOp(compiler, *locs(), kind(), NULL,
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
| }
|
| - if (operands_class_id() == kDouble) {
|
| + if (operands_class_id() == kDoubleCid) {
|
| EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL,
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
| @@ -593,7 +594,7 @@
|
| // Load receiver into RAX, class into RDI.
|
| Label done;
|
| const intptr_t kNumArguments = 2;
|
| - __ movq(RDI, Immediate(kSmi));
|
| + __ movq(RDI, Immediate(kSmiCid));
|
| __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize));
|
| __ testq(RAX, Immediate(kSmiTagMask));
|
| __ j(ZERO, &done);
|
| @@ -673,7 +674,7 @@
|
|
|
| LocationSummary* LoadIndexedComp::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 2;
|
| - if (receiver_type() == kGrowableObjectArray) {
|
| + if (receiver_type() == kGrowableObjectArrayCid) {
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| @@ -682,13 +683,13 @@
|
| locs->set_temp(0, Location::RequiresRegister());
|
| locs->set_out(Location::RequiresRegister());
|
| return locs;
|
| - } else if ((receiver_type() == kArray) ||
|
| - (receiver_type() == kImmutableArray)) {
|
| + } else if ((receiver_type() == kArrayCid) ||
|
| + (receiver_type() == kImmutableArrayCid)) {
|
| return LocationSummary::Make(kNumInputs,
|
| Location::RequiresRegister(),
|
| LocationSummary::kNoCall);
|
| } else {
|
| - ASSERT(receiver_type() == kIllegalObjectKind);
|
| + ASSERT(receiver_type() == kIllegalCid);
|
| return MakeCallSummary();
|
| }
|
| }
|
| @@ -705,7 +706,7 @@
|
| const ICData& ic_data = *comp->ic_data();
|
| ASSERT(ic_data.num_args_tested() == 1);
|
| // No indexed access on Smi.
|
| - ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi);
|
| + ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmiCid);
|
| // Load receiver into RAX.
|
| const intptr_t kNumArguments = 2;
|
| __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize));
|
| @@ -725,7 +726,7 @@
|
|
|
|
|
| void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - if (receiver_type() == kIllegalObjectKind) {
|
| + if (receiver_type() == kIllegalCid) {
|
| if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
| EmitLoadIndexedPolymorphic(compiler, this);
|
| } else {
|
| @@ -739,7 +740,8 @@
|
| Register index = locs()->in(1).reg();
|
| Register result = locs()->out().reg();
|
|
|
| - const DeoptReasonId deopt_reason = (receiver_type() == kGrowableObjectArray) ?
|
| + const DeoptReasonId deopt_reason =
|
| + (receiver_type() == kGrowableObjectArrayCid) ?
|
| kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray;
|
|
|
| Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
| @@ -758,8 +760,8 @@
|
| __ j(NOT_ZERO, deopt);
|
|
|
| switch (receiver_type()) {
|
| - case kArray:
|
| - case kImmutableArray:
|
| + case kArrayCid:
|
| + case kImmutableArrayCid:
|
| __ cmpq(index, FieldAddress(receiver, Array::length_offset()));
|
| __ j(ABOVE_EQUAL, deopt);
|
| // Note that index is Smi, i.e, times 4.
|
| @@ -767,7 +769,7 @@
|
| __ movq(result, FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)));
|
| break;
|
|
|
| - case kGrowableObjectArray: {
|
| + case kGrowableObjectArrayCid: {
|
| Register temp = locs()->temp(0).reg();
|
|
|
| __ cmpq(index,
|
| @@ -789,7 +791,7 @@
|
|
|
| LocationSummary* StoreIndexedComp::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 3;
|
| - if (receiver_type() == kGrowableObjectArray) {
|
| + if (receiver_type() == kGrowableObjectArrayCid) {
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| @@ -799,12 +801,12 @@
|
| locs->set_temp(0, Location::RequiresRegister());
|
| locs->set_out(Location::NoLocation());
|
| return locs;
|
| - } else if (receiver_type() == kArray) {
|
| + } else if (receiver_type() == kArrayCid) {
|
| return LocationSummary::Make(kNumInputs,
|
| Location::NoLocation(),
|
| LocationSummary::kNoCall);
|
| } else {
|
| - ASSERT(receiver_type() == kIllegalObjectKind);
|
| + ASSERT(receiver_type() == kIllegalCid);
|
| return MakeCallSummary();
|
| }
|
| }
|
| @@ -843,7 +845,7 @@
|
| const ICData& ic_data = *comp->ic_data();
|
| ASSERT(ic_data.num_args_tested() == 1);
|
| // No indexed access on Smi.
|
| - ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi);
|
| + ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmiCid);
|
| // Load receiver into RAX.
|
| const intptr_t kNumArguments = 3;
|
| __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize));
|
| @@ -863,7 +865,7 @@
|
|
|
|
|
| void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - if (receiver_type() == kIllegalObjectKind) {
|
| + if (receiver_type() == kIllegalCid) {
|
| if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
| EmitStoreIndexedPolymorphic(compiler, this);
|
| } else {
|
| @@ -893,8 +895,8 @@
|
| __ j(NOT_ZERO, deopt);
|
|
|
| switch (receiver_type()) {
|
| - case kArray:
|
| - case kImmutableArray:
|
| + case kArrayCid:
|
| + case kImmutableArrayCid:
|
| __ cmpq(index, FieldAddress(receiver, Array::length_offset()));
|
| __ j(ABOVE_EQUAL, deopt);
|
| // Note that index is Smi, i.e, times 4.
|
| @@ -904,7 +906,7 @@
|
| value);
|
| break;
|
|
|
| - case kGrowableObjectArray: {
|
| + case kGrowableObjectArrayCid: {
|
| Register temp = locs()->temp(0).reg();
|
| __ cmpq(index,
|
| FieldAddress(receiver, GrowableObjectArray::length_offset()));
|
| @@ -1128,7 +1130,7 @@
|
| // because a null instantiator will have the wrong class (Null instead of
|
| // TypeArguments).
|
| Label type_arguments_uninstantiated;
|
| - __ CompareClassId(instantiator_reg, kTypeArguments);
|
| + __ CompareClassId(instantiator_reg, kTypeArgumentsCid);
|
| __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump);
|
| __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()),
|
| Immediate(Smi::RawValue(len)));
|
| @@ -1189,7 +1191,7 @@
|
| // 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, kTypeArguments);
|
| + __ CompareClassId(instantiator_reg, kTypeArgumentsCid);
|
| __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump);
|
| Immediate arguments_length =
|
| Immediate(Smi::RawValue(type_arguments().Length()));
|
| @@ -1256,7 +1258,7 @@
|
| // matching length and, if so, use it as the instantiated type_arguments.
|
| // No need to check the instantiator (RAX) for null here, because a null
|
| // instantiator will have the wrong class (Null instead of TypeArguments).
|
| - __ CompareClassId(instantiator_reg, kTypeArguments);
|
| + __ CompareClassId(instantiator_reg, kTypeArgumentsCid);
|
| __ j(NOT_EQUAL, &done, Assembler::kNearJump);
|
| Immediate arguments_length =
|
| Immediate(Smi::RawValue(type_arguments().Length()));
|
| @@ -1555,7 +1557,7 @@
|
| {
|
| __ Bind(&call_method);
|
| Function& target = Function::ZoneHandle(
|
| - comp->ic_data()->GetTargetForReceiverClassId(kSmi));
|
| + comp->ic_data()->GetTargetForReceiverClassId(kSmiCid));
|
| ASSERT(!target.IsNull());
|
| const intptr_t kArgumentCount = 2;
|
| __ pushq(temp);
|
| @@ -1617,7 +1619,7 @@
|
| __ j(NOT_ZERO, &non_smi);
|
| __ testq(right, Immediate(kSmiTagMask)); // Is argument Smi?
|
| __ j(ZERO, &smi_smi);
|
| - __ CompareClassId(right, kMint); // Is argument Mint?
|
| + __ CompareClassId(right, kMintCid); // Is argument Mint?
|
| __ j(NOT_EQUAL, deopt); // Argument neither Smi nor Mint.
|
| __ cmpq(left, Immediate(0));
|
| __ j(LESS, &smi_static_call); // Negative Smi receiver, Mint argument.
|
| @@ -1630,7 +1632,7 @@
|
| __ jmp(&done);
|
|
|
| __ Bind(&non_smi); // Receiver is non-Smi.
|
| - __ CompareClassId(left, kMint); // Is receiver Mint?
|
| + __ CompareClassId(left, kMintCid); // Is receiver Mint?
|
| __ j(NOT_EQUAL, deopt); // Receiver neither Smi nor Mint.
|
| __ testq(right, Immediate(kSmiTagMask)); // Is argument Smi?
|
| __ j(NOT_ZERO, &mint_static_call); // Mint receiver, non-Smi argument.
|
| @@ -1648,7 +1650,7 @@
|
| __ Bind(&smi_static_call);
|
| {
|
| Function& target = Function::ZoneHandle(
|
| - comp->ic_data()->GetTargetForReceiverClassId(kSmi));
|
| + comp->ic_data()->GetTargetForReceiverClassId(kSmiCid));
|
| if (target.IsNull()) {
|
| __ jmp(deopt);
|
| } else {
|
| @@ -1668,7 +1670,7 @@
|
| __ Bind(&mint_static_call);
|
| {
|
| Function& target = Function::ZoneHandle(
|
| - comp->ic_data()->GetTargetForReceiverClassId(kMint));
|
| + comp->ic_data()->GetTargetForReceiverClassId(kMintCid));
|
| if (target.IsNull()) {
|
| __ jmp(deopt);
|
| } else {
|
| @@ -1784,7 +1786,7 @@
|
| instance_call()->try_index(),
|
| kDeoptUnaryOp,
|
| value);
|
| - if (test_class_id == kSmi) {
|
| + if (test_class_id == kSmiCid) {
|
| __ testq(value, Immediate(kSmiTagMask));
|
| __ j(NOT_ZERO, deopt);
|
| switch (op_kind()) {
|
| @@ -1836,11 +1838,11 @@
|
| instance_call()->try_index(),
|
| kDeoptUnaryOp,
|
| value);
|
| - if (test_class_id == kDouble) {
|
| + if (test_class_id == kDoubleCid) {
|
| Register temp = locs()->temp(0).reg();
|
| __ testq(value, Immediate(kSmiTagMask));
|
| __ j(ZERO, deopt); // Smi.
|
| - __ CompareClassId(value, kDouble);
|
| + __ CompareClassId(value, kDoubleCid);
|
| __ j(NOT_EQUAL, deopt);
|
| // Allocate result object.
|
| const Class& double_class = compiler->double_class();
|
| @@ -1867,7 +1869,7 @@
|
|
|
| LocationSummary* ToDoubleComp::MakeLocationSummary() const {
|
| const intptr_t kNumInputs = 1;
|
| - if (from() == kDouble) {
|
| + if (from() == kDoubleCid) {
|
| const intptr_t kNumTemps = 0;
|
| LocationSummary* locs =
|
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| @@ -1875,17 +1877,17 @@
|
| locs->set_out(Location::SameAsFirstInput());
|
| return locs;
|
| } else {
|
| - ASSERT(from() == kSmi);
|
| + ASSERT(from() == kSmiCid);
|
| return MakeCallSummary(); // Calls a stub to allocate result.
|
| }
|
| }
|
|
|
|
|
| void ToDoubleComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - Register value = (from() == kDouble) ? locs()->in(0).reg() : RBX;
|
| + Register value = (from() == kDoubleCid) ? locs()->in(0).reg() : RBX;
|
| Register result = locs()->out().reg();
|
|
|
| - const DeoptReasonId deopt_reason = (from() == kDouble) ?
|
| + const DeoptReasonId deopt_reason = (from() == kDoubleCid) ?
|
| kDeoptDoubleToDouble : kDeoptIntegerToDouble;
|
| Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
| instance_call()->token_pos(),
|
| @@ -1893,16 +1895,16 @@
|
| deopt_reason,
|
| value);
|
|
|
| - if (from() == kDouble) {
|
| + if (from() == kDoubleCid) {
|
| __ testq(value, Immediate(kSmiTagMask));
|
| __ j(ZERO, deopt); // Deoptimize if Smi.
|
| - __ CompareClassId(value, kDouble);
|
| + __ CompareClassId(value, kDoubleCid);
|
| __ j(NOT_EQUAL, deopt); // Deoptimize if not Double.
|
| ASSERT(value == result);
|
| return;
|
| }
|
|
|
| - ASSERT(from() == kSmi);
|
| + ASSERT(from() == kSmiCid);
|
|
|
| const Class& double_class = compiler->double_class();
|
| const Code& stub =
|
| @@ -1943,7 +1945,7 @@
|
| ASSERT(ic_data()->num_args_tested() == 1);
|
| Label handle_smi;
|
| Label* is_smi_label =
|
| - ic_data()->GetReceiverClassIdAt(0) == kSmi ? &handle_smi : deopt;
|
| + ic_data()->GetReceiverClassIdAt(0) == kSmiCid ? &handle_smi : deopt;
|
|
|
| // Load receiver into RAX.
|
| __ movq(RAX,
|
| @@ -1963,7 +1965,7 @@
|
| instance_call()->try_index());
|
| if (is_smi_label == &handle_smi) {
|
| __ Bind(&handle_smi);
|
| - ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi);
|
| + ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmiCid);
|
| const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0));
|
| compiler->GenerateStaticCall(instance_call()->deopt_id(),
|
| instance_call()->token_pos(),
|
| @@ -1998,8 +2000,8 @@
|
| return locs;
|
| }
|
| if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
| - if (ICDataWithBothClassIds(*ic_data(), kSmi) ||
|
| - ICDataWithBothClassIds(*ic_data(), kDouble)) {
|
| + if (ICDataWithBothClassIds(*ic_data(), kSmiCid) ||
|
| + ICDataWithBothClassIds(*ic_data(), kDoubleCid)) {
|
| const intptr_t kNumInputs = 2;
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* summary =
|
| @@ -2037,12 +2039,12 @@
|
| }
|
| // Relational or equality.
|
| if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
| - if (ICDataWithBothClassIds(*ic_data(), kSmi)) {
|
| + if (ICDataWithBothClassIds(*ic_data(), kSmiCid)) {
|
| EmitSmiComparisonOp(compiler, *locs(), kind(), this,
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
| }
|
| - if (ICDataWithBothClassIds(*ic_data(), kDouble)) {
|
| + if (ICDataWithBothClassIds(*ic_data(), kDoubleCid)) {
|
| EmitDoubleComparisonOp(compiler, *locs(), kind(), this,
|
| deopt_id(), token_pos(), try_index());
|
| return;
|
|
|