Chromium Code Reviews| Index: runtime/vm/intermediate_language_ia32.cc |
| =================================================================== |
| --- runtime/vm/intermediate_language_ia32.cc (revision 12301) |
| +++ runtime/vm/intermediate_language_ia32.cc (working copy) |
| @@ -2204,6 +2204,9 @@ |
| LocationSummary* CheckSmiInstr::MakeLocationSummary() const { |
| + if (value()->ResultCid() == kSmiCid) { |
|
Vyacheslav Egorov (Google)
2012/09/13 09:27:51
Maybe we should better reorder LICM and CSE?
srdjan
2012/09/13 09:46:45
I will try this in a separate CL (added a TODO her
|
| + return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| + } |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2214,6 +2217,7 @@ |
| void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| + if (value()->ResultCid() == kSmiCid) return; |
| Register value = locs()->in(0).reg(); |
| Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| kDeoptCheckSmi); |
| @@ -2227,15 +2231,13 @@ |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| - locs->set_in(0, Location::RequiresRegister()); |
| + locs->set_in(0, Location::RegisterOrConstant(array())); |
| locs->set_in(1, Location::RegisterOrConstant(index())); |
| return locs; |
| } |
| void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| - Register receiver = locs()->in(0).reg(); |
| - |
| const DeoptReasonId deopt_reason = |
| (array_type() == kGrowableObjectArrayCid) ? |
| kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray; |
| @@ -2247,15 +2249,26 @@ |
| intptr_t length_offset = (array_type() == kGrowableObjectArrayCid) |
| ? GrowableObjectArray::length_offset() |
| : Array::length_offset(); |
| + // This case should not have created a bound check instruction. |
| + ASSERT(!(locs()->in(0).IsConstant() && locs()->in(1).IsConstant())); |
| if (locs()->in(1).IsConstant()) { |
| + Register receiver = locs()->in(0).reg(); |
| const Object& constant = locs()->in(1).constant(); |
| ASSERT(constant.IsSmi()); |
| const int32_t imm = |
| reinterpret_cast<int32_t>(constant.raw()); |
| __ cmpl(FieldAddress(receiver, length_offset), Immediate(imm)); |
| __ j(BELOW_EQUAL, deopt); |
| + } else if (locs()->in(0).IsConstant()) { |
| + const Object& constant = locs()->in(0).constant(); |
| + ASSERT(constant.IsArray()); |
| + const Array& array = Array::Cast(constant); |
| + Register index = locs()->in(1).reg(); |
| + __ cmpl(index, Immediate(array.Length())); |
| + __ j(ABOVE_EQUAL, deopt); |
| } else { |
| + Register receiver = locs()->in(0).reg(); |
| Register index = locs()->in(1).reg(); |
| __ cmpl(index, FieldAddress(receiver, length_offset)); |
| __ j(ABOVE_EQUAL, deopt); |