| Index: runtime/vm/intermediate_language_arm.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_arm.cc (revision 38118)
|
| +++ runtime/vm/intermediate_language_arm.cc (working copy)
|
| @@ -5686,12 +5686,16 @@
|
| LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| const intptr_t kNumInputs = 1;
|
| - const intptr_t kNumTemps = !IsNullCheck() ? 1 : 0;
|
| + const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask());
|
| + const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0;
|
| LocationSummary* summary = new(isolate) LocationSummary(
|
| isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| summary->set_in(0, Location::RequiresRegister());
|
| if (!IsNullCheck()) {
|
| summary->set_temp(0, Location::RequiresRegister());
|
| + if (need_mask_temp) {
|
| + summary->set_temp(1, Location::RequiresRegister());
|
| + }
|
| }
|
| return summary;
|
| }
|
| @@ -5724,15 +5728,34 @@
|
| __ b(deopt, EQ);
|
| }
|
| __ LoadClassId(temp, value);
|
| - const intptr_t num_checks = unary_checks().NumberOfChecks();
|
| - for (intptr_t i = cix; i < num_checks; i++) {
|
| - ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid);
|
| - __ CompareImmediate(temp, unary_checks().GetReceiverClassIdAt(i));
|
| - if (i == (num_checks - 1)) {
|
| - __ b(deopt, NE);
|
| - } else {
|
| - __ b(&is_ok, EQ);
|
| +
|
| + if (IsDenseSwitch()) {
|
| + ASSERT(cids_[0] < cids_[cids_.length() - 1]);
|
| + __ AddImmediate(temp, -cids_[0]);
|
| + __ CompareImmediate(temp, cids_[cids_.length() - 1] - cids_[0]);
|
| + __ b(deopt, HI);
|
| +
|
| + intptr_t mask = ComputeCidMask();
|
| + if (!IsDenseMask(mask)) {
|
| + // Only need mask if there are missing numbers in the range.
|
| + ASSERT(cids_.length() > 2);
|
| + Register mask_reg = locs()->temp(1).reg();
|
| + __ LoadImmediate(mask_reg, 1);
|
| + __ Lsl(mask_reg, mask_reg, temp);
|
| + __ TestImmediate(mask_reg, mask);
|
| + __ b(deopt, EQ);
|
| }
|
| + } else {
|
| + const intptr_t num_checks = unary_checks().NumberOfChecks();
|
| + for (intptr_t i = cix; i < num_checks; i++) {
|
| + ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid);
|
| + __ CompareImmediate(temp, unary_checks().GetReceiverClassIdAt(i));
|
| + if (i == (num_checks - 1)) {
|
| + __ b(deopt, NE);
|
| + } else {
|
| + __ b(&is_ok, EQ);
|
| + }
|
| + }
|
| }
|
| __ Bind(&is_ok);
|
| }
|
| @@ -5757,6 +5780,25 @@
|
| }
|
|
|
|
|
| +LocationSummary* CheckClassIdInstr::MakeLocationSummary(Isolate* isolate,
|
| + bool opt) const {
|
| + const intptr_t kNumInputs = 1;
|
| + const intptr_t kNumTemps = 0;
|
| + LocationSummary* summary = new(isolate) LocationSummary(
|
| + isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| + summary->set_in(0, Location::RequiresRegister());
|
| + return summary;
|
| +}
|
| +
|
| +
|
| +void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| + Register value = locs()->in(0).reg();
|
| + Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass);
|
| + __ CompareImmediate(value, Smi::RawValue(cid_));
|
| + __ b(deopt, NE);
|
| +}
|
| +
|
| +
|
| LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate,
|
| bool opt) const {
|
| const intptr_t kNumInputs = 2;
|
|
|