Chromium Code Reviews| Index: runtime/vm/intermediate_language_x64.cc |
| =================================================================== |
| --- runtime/vm/intermediate_language_x64.cc (revision 31125) |
| +++ runtime/vm/intermediate_language_x64.cc (working copy) |
| @@ -34,7 +34,7 @@ |
| } |
| -LocationSummary* PushArgumentInstr::MakeLocationSummary() const { |
| +LocationSummary* PushArgumentInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps= 0; |
| LocationSummary* locs = |
| @@ -61,7 +61,7 @@ |
| } |
| -LocationSummary* ReturnInstr::MakeLocationSummary() const { |
| +LocationSummary* ReturnInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -130,11 +130,11 @@ |
| } |
| -LocationSummary* IfThenElseInstr::MakeLocationSummary() const { |
| - LocationSummary* locs = comparison()->MakeLocationSummary(); |
| +LocationSummary* IfThenElseInstr::MakeLocationSummary(bool opt) const { |
| + comparison()->InitializeLocationSummary(optimizing); |
| // TODO(vegorov): support byte register constraints in the register allocator. |
| - locs->set_out(Location::RegisterLocation(RDX)); |
| - return locs; |
| + comparison()->locs()->set_out(Location::RegisterLocation(RDX)); |
| + return comparison()->locs(); |
| } |
| @@ -187,7 +187,7 @@ |
| } |
| -LocationSummary* LoadLocalInstr::MakeLocationSummary() const { |
| +LocationSummary* LoadLocalInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| return LocationSummary::Make(kNumInputs, |
| Location::RequiresRegister(), |
| @@ -201,7 +201,7 @@ |
| } |
| -LocationSummary* StoreLocalInstr::MakeLocationSummary() const { |
| +LocationSummary* StoreLocalInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| return LocationSummary::Make(kNumInputs, |
| Location::SameAsFirstInput(), |
| @@ -217,7 +217,7 @@ |
| } |
| -LocationSummary* ConstantInstr::MakeLocationSummary() const { |
| +LocationSummary* ConstantInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| return LocationSummary::Make(kNumInputs, |
| Location::RequiresRegister(), |
| @@ -234,7 +234,7 @@ |
| } |
| -LocationSummary* AssertAssignableInstr::MakeLocationSummary() const { |
| +LocationSummary* AssertAssignableInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 3; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -247,7 +247,7 @@ |
| } |
| -LocationSummary* AssertBooleanInstr::MakeLocationSummary() const { |
| +LocationSummary* AssertBooleanInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -308,7 +308,7 @@ |
| } |
| -LocationSummary* EqualityCompareInstr::MakeLocationSummary() const { |
| +LocationSummary* EqualityCompareInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| if (operation_cid() == kDoubleCid) { |
| const intptr_t kNumTemps = 0; |
| @@ -491,7 +491,7 @@ |
| } |
| -LocationSummary* TestSmiInstr::MakeLocationSummary() const { |
| +LocationSummary* TestSmiInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -535,7 +535,7 @@ |
| } |
| -LocationSummary* RelationalOpInstr::MakeLocationSummary() const { |
| +LocationSummary* RelationalOpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| if (operation_cid() == kDoubleCid) { |
| @@ -596,7 +596,7 @@ |
| } |
| -LocationSummary* NativeCallInstr::MakeLocationSummary() const { |
| +LocationSummary* NativeCallInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| const intptr_t kNumTemps = 3; |
| LocationSummary* locs = |
| @@ -652,7 +652,7 @@ |
| } |
| -LocationSummary* StringFromCharCodeInstr::MakeLocationSummary() const { |
| +LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| // TODO(fschneider): Allow immediate operands for the char code. |
| return LocationSummary::Make(kNumInputs, |
| @@ -673,7 +673,7 @@ |
| } |
| -LocationSummary* StringInterpolateInstr::MakeLocationSummary() const { |
| +LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -699,7 +699,7 @@ |
| } |
| -LocationSummary* LoadUntaggedInstr::MakeLocationSummary() const { |
| +LocationSummary* LoadUntaggedInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| return LocationSummary::Make(kNumInputs, |
| Location::RequiresRegister(), |
| @@ -714,7 +714,7 @@ |
| } |
| -LocationSummary* LoadClassIdInstr::MakeLocationSummary() const { |
| +LocationSummary* LoadClassIdInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| return LocationSummary::Make(kNumInputs, |
| Location::RequiresRegister(), |
| @@ -801,7 +801,7 @@ |
| } |
| -LocationSummary* LoadIndexedInstr::MakeLocationSummary() const { |
| +LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -952,7 +952,7 @@ |
| } |
| -LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { |
| +LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 3; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1130,7 +1130,7 @@ |
| } |
| -LocationSummary* GuardFieldInstr::MakeLocationSummary() const { |
| +LocationSummary* GuardFieldInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| LocationSummary* summary = |
| new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall); |
| @@ -1476,21 +1476,146 @@ |
| } |
| -LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
| +class StoreInstanceFieldSlowPath : public SlowPathCode { |
| + public: |
| + explicit StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction) |
| + : instruction_(instruction) { } |
| + |
| + virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| + __ Comment("StoreInstanceFieldSlowPath"); |
| + __ Bind(entry_label()); |
| + const Class& double_class = compiler->double_class(); |
| + const Code& stub = |
| + Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| + const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| + |
| + LocationSummary* locs = instruction_->locs(); |
| + locs->live_registers()->Remove(locs->out()); |
| + |
| + compiler->SaveLiveRegisters(locs); |
| + compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position. |
| + &label, |
| + PcDescriptors::kOther, |
| + locs); |
| + __ MoveRegister(locs->temp(0).reg(), RAX); |
| + compiler->RestoreLiveRegisters(locs); |
| + |
| + __ jmp(exit_label()); |
| + } |
| + |
| + private: |
| + StoreInstanceFieldInstr* instruction_; |
| +}; |
| + |
| + |
| +LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| - new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| + new LocationSummary(kNumInputs, kNumTemps, |
| + (field().guarded_cid() == kIllegalCid) || (initialization_) |
| + ? LocationSummary::kCallOnSlowPath |
| + : LocationSummary::kNoCall); |
| + |
| summary->set_in(0, Location::RequiresRegister()); |
| - summary->set_in(1, ShouldEmitStoreBarrier() |
| + if (IsUnboxedStore() && optimizing) { |
| + summary->set_in(1, Location::RequiresFpuRegister()); |
| + summary->AddTemp(Location::RequiresRegister()); |
| + summary->AddTemp(Location::RequiresRegister()); |
| + } else if (IsPotentialUnboxedStore()) { |
| + summary->set_in(1, ShouldEmitStoreBarrier() |
| + ? Location::WritableRegister() |
| + : Location::RequiresRegister()); |
| + summary->AddTemp(Location::RequiresRegister()); |
| + summary->AddTemp(Location::RequiresRegister()); |
| + summary->AddTemp(optimizing ? Location::RequiresFpuRegister() |
| + : Location::FpuRegisterLocation(XMM1)); |
| + } else { |
| + summary->set_in(1, ShouldEmitStoreBarrier() |
| ? Location::WritableRegister() |
| : Location::RegisterOrConstant(value())); |
| + } |
| return summary; |
| } |
| void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| + Label skip_store; |
| + |
| Register instance_reg = locs()->in(0).reg(); |
| + |
| + if (IsUnboxedStore() && compiler->is_optimizing()) { |
| + XmmRegister value = locs()->in(1).fpu_reg(); |
| + Register temp = locs()->temp(0).reg(); |
| + Register temp2 = locs()->temp(1).reg(); |
| + |
| + if (initialization_) { |
| + StoreInstanceFieldSlowPath* slow_path = |
| + new StoreInstanceFieldSlowPath(this); |
| + compiler->AddSlowPathCode(slow_path); |
| + |
| + __ TryAllocate(compiler->double_class(), |
| + slow_path->entry_label(), |
| + Assembler::kFarJump, |
| + temp, |
| + PP); |
| + __ Bind(slow_path->exit_label()); |
| + __ movq(temp2, temp); |
| + __ StoreIntoObject(instance_reg, |
| + FieldAddress(instance_reg, field().Offset()), |
| + temp2); |
| + } else { |
| + __ movq(temp, FieldAddress(instance_reg, field().Offset())); |
| + } |
| + __ movsd(FieldAddress(temp, Double::value_offset()), value); |
| + return; |
| + } |
| + |
| + if (IsPotentialUnboxedStore()) { |
| + Register value_reg = locs()->in(1).reg(); |
| + Register temp = locs()->temp(0).reg(); |
| + Register temp2 = locs()->temp(1).reg(); |
| + FpuRegister fpu_temp = locs()->temp(2).fpu_reg(); |
| + |
| + Label store_pointer, copy_payload; |
| + __ LoadObject(temp, Field::ZoneHandle(field().raw()), PP); |
| + __ cmpq(FieldAddress(temp, Field::guarded_cid_offset()), |
| + Immediate(kDoubleCid)); |
| + __ j(NOT_EQUAL, &store_pointer); |
| + __ cmpq(FieldAddress(temp, Field::is_nullable_offset()), |
| + Immediate(kNullCid)); |
| + __ j(EQUAL, &store_pointer); |
| + |
| + __ movq(temp, FieldAddress(instance_reg, field().Offset())); |
| + __ CompareObject(temp, Object::null_object(), PP); |
| + __ j(NOT_EQUAL, ©_payload); |
| + |
| + StoreInstanceFieldSlowPath* slow_path = |
| + new StoreInstanceFieldSlowPath(this); |
| + compiler->AddSlowPathCode(slow_path); |
| + |
| + if (!compiler->is_optimizing()) { |
| + locs()->live_registers()->Add(locs()->in(0)); |
| + locs()->live_registers()->Add(locs()->in(1)); |
|
srdjan
2013/12/13 22:12:06
This is for saving and restoring registers (aka sl
Florian Schneider
2013/12/16 13:08:09
Yes, the optimizing compiler computes live_registe
|
| + } |
| + __ TryAllocate(compiler->double_class(), |
| + slow_path->entry_label(), |
| + Assembler::kFarJump, |
| + temp, |
| + PP); |
| + __ Bind(slow_path->exit_label()); |
| + __ movq(temp2, temp); |
| + __ StoreIntoObject(instance_reg, |
| + FieldAddress(instance_reg, field().Offset()), |
| + temp2); |
| + |
| + __ Bind(©_payload); |
| + __ movsd(fpu_temp, FieldAddress(value_reg, Double::value_offset())); |
| + __ movsd(FieldAddress(temp, Double::value_offset()), fpu_temp); |
| + __ jmp(&skip_store); |
| + __ Bind(&store_pointer); |
| + } |
| + |
| if (ShouldEmitStoreBarrier()) { |
| Register value_reg = locs()->in(1).reg(); |
| __ StoreIntoObject(instance_reg, |
| @@ -1507,10 +1632,11 @@ |
| FieldAddress(instance_reg, field().Offset()), value_reg); |
| } |
| } |
| + __ Bind(&skip_store); |
| } |
| -LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const { |
| +LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -1533,7 +1659,7 @@ |
| } |
| -LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { |
| +LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(bool opt) const { |
| LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
| locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| : Location::RequiresRegister()); |
| @@ -1557,7 +1683,7 @@ |
| } |
| -LocationSummary* InstanceOfInstr::MakeLocationSummary() const { |
| +LocationSummary* InstanceOfInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 3; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -1584,7 +1710,7 @@ |
| } |
| -LocationSummary* CreateArrayInstr::MakeLocationSummary() const { |
| +LocationSummary* CreateArrayInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1608,7 +1734,7 @@ |
| LocationSummary* |
| -AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { |
| +AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const { |
| return MakeCallSummary(); |
| } |
| @@ -1626,22 +1752,114 @@ |
| } |
| -LocationSummary* LoadFieldInstr::MakeLocationSummary() const { |
| - return LocationSummary::Make(1, |
| - Location::RequiresRegister(), |
| - LocationSummary::kNoCall); |
| +class BoxDoubleSlowPath : public SlowPathCode { |
| + public: |
| + explicit BoxDoubleSlowPath(Instruction* instruction) |
| + : instruction_(instruction) { } |
| + |
| + virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| + __ Comment("BoxDoubleSlowPath"); |
| + __ Bind(entry_label()); |
| + const Class& double_class = compiler->double_class(); |
| + const Code& stub = |
| + Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| + const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| + |
| + LocationSummary* locs = instruction_->locs(); |
| + locs->live_registers()->Remove(locs->out()); |
| + |
| + compiler->SaveLiveRegisters(locs); |
| + compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position. |
| + &label, |
| + PcDescriptors::kOther, |
| + locs); |
| + __ MoveRegister(locs->out().reg(), RAX); |
| + compiler->RestoreLiveRegisters(locs); |
| + |
| + __ jmp(exit_label()); |
| + } |
| + |
| + private: |
| + Instruction* instruction_; |
| +}; |
| + |
| + |
| +LocationSummary* LoadFieldInstr::MakeLocationSummary(bool opt) const { |
| + const intptr_t kNumInputs = 1; |
| + const intptr_t kNumTemps = 0; |
| + LocationSummary* locs = |
| + new LocationSummary( |
| + kNumInputs, kNumTemps, |
| + (optimizing && !IsPotentialUnboxedLoad()) |
| + ? LocationSummary::kNoCall |
| + : LocationSummary::kCallOnSlowPath); |
| + |
| + locs->set_in(0, Location::RequiresRegister()); |
| + |
| + if (IsUnboxedLoad() && optimizing) { |
| + locs->AddTemp(Location::RequiresRegister()); |
| + } else if (IsPotentialUnboxedLoad()) { |
| + locs->AddTemp(optimizing ? Location::RequiresFpuRegister() |
| + : Location::FpuRegisterLocation(XMM1)); |
| + locs->AddTemp(Location::RequiresRegister()); |
| + } |
| + locs->set_out(Location::RequiresRegister()); |
| + return locs; |
| } |
| void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| Register instance_reg = locs()->in(0).reg(); |
| - Register result_reg = locs()->out().reg(); |
| + if (IsUnboxedLoad() && compiler->is_optimizing()) { |
| + XmmRegister result = locs()->out().fpu_reg(); |
| + Register temp = locs()->temp(0).reg(); |
| + __ movq(temp, FieldAddress(instance_reg, offset_in_bytes())); |
|
srdjan
2013/12/13 22:12:06
I wonder if we could split the instructions, one t
Florian Schneider
2013/12/16 13:08:09
Possibly yes. The current approach makes the Load/
|
| + __ movsd(result, FieldAddress(temp, Double::value_offset())); |
| + return; |
| + } |
| - __ movq(result_reg, FieldAddress(instance_reg, offset_in_bytes())); |
| + Label done; |
| + Register result = locs()->out().reg(); |
| + if (IsPotentialUnboxedLoad()) { |
| + Register temp = locs()->temp(1).reg(); |
| + XmmRegister value = locs()->temp(0).fpu_reg(); |
| + |
| + Label load_pointer; |
| + __ LoadObject(result, Field::ZoneHandle(field()->raw()), PP); |
| + |
| + |
| + __ cmpq(FieldAddress(result, Field::guarded_cid_offset()), |
| + Immediate(kDoubleCid)); |
| + __ j(NOT_EQUAL, &load_pointer); |
| + __ cmpq(FieldAddress(result, Field::is_nullable_offset()), |
| + Immediate(kNullCid)); |
| + __ j(EQUAL, &load_pointer); |
| + |
| + BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); |
| + compiler->AddSlowPathCode(slow_path); |
| + |
| + if (!compiler->is_optimizing()) { |
| + locs()->live_registers()->Add(locs()->in(0)); |
| + } |
| + |
| + __ TryAllocate(compiler->double_class(), |
| + slow_path->entry_label(), |
| + Assembler::kFarJump, |
| + result, |
| + PP); |
| + __ Bind(slow_path->exit_label()); |
| + __ movq(temp, FieldAddress(instance_reg, offset_in_bytes())); |
| + __ movsd(value, FieldAddress(temp, Double::value_offset())); |
| + __ movsd(FieldAddress(result, Double::value_offset()), value); |
| + __ jmp(&done); |
| + __ Bind(&load_pointer); |
| + } |
| + __ movq(result, FieldAddress(instance_reg, offset_in_bytes())); |
| + __ Bind(&done); |
| } |
| -LocationSummary* InstantiateTypeInstr::MakeLocationSummary() const { |
| +LocationSummary* InstantiateTypeInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1673,7 +1891,8 @@ |
| } |
| -LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary() const { |
| +LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( |
| + bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1721,7 +1940,7 @@ |
| LocationSummary* |
| -ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { |
| +ExtractConstructorTypeArgumentsInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1763,7 +1982,7 @@ |
| LocationSummary* |
| -ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { |
| +ExtractConstructorInstantiatorInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1802,7 +2021,7 @@ |
| } |
| -LocationSummary* AllocateContextInstr::MakeLocationSummary() const { |
| +LocationSummary* AllocateContextInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* locs = |
| @@ -1827,7 +2046,7 @@ |
| } |
| -LocationSummary* CloneContextInstr::MakeLocationSummary() const { |
| +LocationSummary* CloneContextInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -1854,7 +2073,7 @@ |
| } |
| -LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { |
| +LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(bool opt) const { |
| UNREACHABLE(); |
| return NULL; |
| } |
| @@ -1891,7 +2110,7 @@ |
| } |
| -LocationSummary* CheckStackOverflowInstr::MakeLocationSummary() const { |
| +LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* summary = |
| @@ -2114,7 +2333,7 @@ |
| } |
| -LocationSummary* BinarySmiOpInstr::MakeLocationSummary() const { |
| +LocationSummary* BinarySmiOpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| ConstantInstr* right_constant = right()->definition()->AsConstant(); |
| @@ -2565,7 +2784,7 @@ |
| } |
| -LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { |
| +LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(bool opt) const { |
| intptr_t left_cid = left()->Type()->ToCid(); |
| intptr_t right_cid = right()->Type()->ToCid(); |
| ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); |
| @@ -2601,7 +2820,7 @@ |
| } |
| -LocationSummary* BoxDoubleInstr::MakeLocationSummary() const { |
| +LocationSummary* BoxDoubleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2614,38 +2833,6 @@ |
| } |
| -class BoxDoubleSlowPath : public SlowPathCode { |
| - public: |
| - explicit BoxDoubleSlowPath(BoxDoubleInstr* instruction) |
| - : instruction_(instruction) { } |
| - |
| - virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| - __ Comment("BoxDoubleSlowPath"); |
| - __ Bind(entry_label()); |
| - const Class& double_class = compiler->double_class(); |
| - const Code& stub = |
| - Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| - const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| - |
| - LocationSummary* locs = instruction_->locs(); |
| - locs->live_registers()->Remove(locs->out()); |
| - |
| - compiler->SaveLiveRegisters(locs); |
| - compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position. |
| - &label, |
| - PcDescriptors::kOther, |
| - locs); |
| - __ MoveRegister(locs->out().reg(), RAX); |
| - compiler->RestoreLiveRegisters(locs); |
| - |
| - __ jmp(exit_label()); |
| - } |
| - |
| - private: |
| - BoxDoubleInstr* instruction_; |
| -}; |
| - |
| - |
| void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); |
| compiler->AddSlowPathCode(slow_path); |
| @@ -2663,7 +2850,7 @@ |
| } |
| -LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { |
| +LocationSummary* UnboxDoubleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2704,7 +2891,7 @@ |
| } |
| -LocationSummary* BoxFloat32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2766,7 +2953,7 @@ |
| } |
| -LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| return LocationSummary::Make(kNumInputs, |
| Location::RequiresFpuRegister(), |
| @@ -2790,7 +2977,7 @@ |
| } |
| -LocationSummary* BoxInt32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* BoxInt32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2852,7 +3039,7 @@ |
| } |
| -LocationSummary* UnboxInt32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* UnboxInt32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2879,7 +3066,7 @@ |
| } |
| -LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const { |
| +LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2907,7 +3094,7 @@ |
| } |
| -LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary() const { |
| +LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2935,7 +3122,7 @@ |
| } |
| -LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary() const { |
| +LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -2977,7 +3164,7 @@ |
| } |
| -LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary() const { |
| +LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3004,7 +3191,7 @@ |
| } |
| -LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary() const { |
| +LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3024,7 +3211,8 @@ |
| } |
| -LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( |
| + bool opt) const { |
| const intptr_t kNumInputs = 4; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3061,7 +3249,7 @@ |
| } |
| -LocationSummary* Float32x4ZeroInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3077,7 +3265,7 @@ |
| } |
| -LocationSummary* Float32x4SplatInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4SplatInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3098,7 +3286,7 @@ |
| } |
| -LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3141,7 +3329,7 @@ |
| } |
| -LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3171,7 +3359,7 @@ |
| } |
| -LocationSummary* Float32x4ScaleInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3200,7 +3388,7 @@ |
| } |
| -LocationSummary* Float32x4SqrtInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3231,7 +3419,7 @@ |
| } |
| -LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3258,7 +3446,7 @@ |
| } |
| -LocationSummary* Float32x4ClampInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ClampInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 3; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3281,7 +3469,7 @@ |
| } |
| -LocationSummary* Float32x4WithInstr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4WithInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3349,7 +3537,7 @@ |
| } |
| -LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3365,7 +3553,8 @@ |
| } |
| -LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary() const { |
| +LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( |
| + bool opt) const { |
| const intptr_t kNumInputs = 4; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* summary = |
| @@ -3434,7 +3623,7 @@ |
| } |
| -LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary() const { |
| +LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3479,7 +3668,7 @@ |
| } |
| -LocationSummary* Int32x4SelectInstr::MakeLocationSummary() const { |
| +LocationSummary* Int32x4SelectInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 3; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* summary = |
| @@ -3513,7 +3702,7 @@ |
| } |
| -LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary() const { |
| +LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* summary = |
| @@ -3579,7 +3768,7 @@ |
| } |
| -LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary() const { |
| +LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3595,7 +3784,7 @@ |
| } |
| -LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary() const { |
| +LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3635,7 +3824,7 @@ |
| } |
| -LocationSummary* MathUnaryInstr::MakeLocationSummary() const { |
| +LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const { |
| if ((kind() == MethodRecognizer::kMathSin) || |
| (kind() == MethodRecognizer::kMathCos)) { |
| // Calling convention on x64 uses XMM0 and XMM1 to pass the first two |
| @@ -3674,7 +3863,7 @@ |
| } |
| -LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { |
| +LocationSummary* UnarySmiOpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| return LocationSummary::Make(kNumInputs, |
| Location::SameAsFirstInput(), |
| @@ -3707,7 +3896,7 @@ |
| } |
| -LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary() const { |
| +LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -3725,7 +3914,7 @@ |
| } |
| -LocationSummary* MathMinMaxInstr::MakeLocationSummary() const { |
| +LocationSummary* MathMinMaxInstr::MakeLocationSummary(bool opt) const { |
| if (result_cid() == kDoubleCid) { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 1; |
| @@ -3814,7 +4003,7 @@ |
| } |
| -LocationSummary* SmiToDoubleInstr::MakeLocationSummary() const { |
| +LocationSummary* SmiToDoubleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* result = |
| @@ -3833,7 +4022,7 @@ |
| } |
| -LocationSummary* DoubleToIntegerInstr::MakeLocationSummary() const { |
| +LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* result = |
| @@ -3884,7 +4073,7 @@ |
| } |
| -LocationSummary* DoubleToSmiInstr::MakeLocationSummary() const { |
| +LocationSummary* DoubleToSmiInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* result = new LocationSummary( |
| @@ -3916,7 +4105,7 @@ |
| } |
| -LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { |
| +LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* result = |
| @@ -3946,7 +4135,7 @@ |
| } |
| -LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { |
| +LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { |
| // Calling convention on x64 uses XMM0 and XMM1 to pass the first two |
| // double arguments and XMM0 to return the result. Unfortunately |
| // currently we can't specify these registers because ParallelMoveResolver |
| @@ -4030,7 +4219,7 @@ |
| } |
| -LocationSummary* MergedMathInstr::MakeLocationSummary() const { |
| +LocationSummary* MergedMathInstr::MakeLocationSummary(bool opt) const { |
| if (kind() == MergedMathInstr::kTruncDivMod) { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 1; |
| @@ -4219,7 +4408,8 @@ |
| } |
| -LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { |
| +LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
| + bool opt) const { |
| return MakeCallSummary(); |
| } |
| @@ -4260,9 +4450,11 @@ |
| } |
| -LocationSummary* BranchInstr::MakeLocationSummary() const { |
| - UNREACHABLE(); |
| - return NULL; |
| +LocationSummary* BranchInstr::MakeLocationSummary(bool opt) const { |
| + comparison()->InitializeLocationSummary(optimizing); |
| + // Branches don't produce a result. |
| + comparison()->locs()->set_out(Location::NoLocation()); |
| + return comparison()->locs(); |
| } |
| @@ -4271,7 +4463,7 @@ |
| } |
| -LocationSummary* CheckClassInstr::MakeLocationSummary() const { |
| +LocationSummary* CheckClassInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -4330,7 +4522,7 @@ |
| } |
| -LocationSummary* CheckSmiInstr::MakeLocationSummary() const { |
| +LocationSummary* CheckSmiInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 1; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* summary = |
| @@ -4349,7 +4541,7 @@ |
| } |
| -LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { |
| +LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -4404,7 +4596,7 @@ |
| } |
| -LocationSummary* UnboxIntegerInstr::MakeLocationSummary() const { |
| +LocationSummary* UnboxIntegerInstr::MakeLocationSummary(bool opt) const { |
| UNIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -4415,7 +4607,7 @@ |
| } |
| -LocationSummary* BoxIntegerInstr::MakeLocationSummary() const { |
| +LocationSummary* BoxIntegerInstr::MakeLocationSummary(bool opt) const { |
| UNIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -4426,7 +4618,7 @@ |
| } |
| -LocationSummary* BinaryMintOpInstr::MakeLocationSummary() const { |
| +LocationSummary* BinaryMintOpInstr::MakeLocationSummary(bool opt) const { |
| UNIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -4437,7 +4629,7 @@ |
| } |
| -LocationSummary* UnaryMintOpInstr::MakeLocationSummary() const { |
| +LocationSummary* UnaryMintOpInstr::MakeLocationSummary(bool opt) const { |
| UNIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -4448,7 +4640,7 @@ |
| } |
| -LocationSummary* ShiftMintOpInstr::MakeLocationSummary() const { |
| +LocationSummary* ShiftMintOpInstr::MakeLocationSummary(bool opt) const { |
| UNIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -4459,7 +4651,7 @@ |
| } |
| -LocationSummary* ThrowInstr::MakeLocationSummary() const { |
| +LocationSummary* ThrowInstr::MakeLocationSummary(bool opt) const { |
| return new LocationSummary(0, 0, LocationSummary::kCall); |
| } |
| @@ -4474,7 +4666,7 @@ |
| } |
| -LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| +LocationSummary* ReThrowInstr::MakeLocationSummary(bool opt) const { |
| return new LocationSummary(0, 0, LocationSummary::kCall); |
| } |
| @@ -4514,7 +4706,7 @@ |
| } |
| -LocationSummary* GotoInstr::MakeLocationSummary() const { |
| +LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { |
| return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| } |
| @@ -4543,7 +4735,7 @@ |
| } |
| -LocationSummary* CurrentContextInstr::MakeLocationSummary() const { |
| +LocationSummary* CurrentContextInstr::MakeLocationSummary(bool opt) const { |
| return LocationSummary::Make(0, |
| Location::RequiresRegister(), |
| LocationSummary::kNoCall); |
| @@ -4555,7 +4747,7 @@ |
| } |
| -LocationSummary* StrictCompareInstr::MakeLocationSummary() const { |
| +LocationSummary* StrictCompareInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| if (needs_number_check()) { |
| @@ -4636,7 +4828,7 @@ |
| } |
| -LocationSummary* ClosureCallInstr::MakeLocationSummary() const { |
| +LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 0; |
| const intptr_t kNumTemps = 1; |
| LocationSummary* result = |
| @@ -4666,7 +4858,7 @@ |
| } |
| -LocationSummary* BooleanNegateInstr::MakeLocationSummary() const { |
| +LocationSummary* BooleanNegateInstr::MakeLocationSummary(bool opt) const { |
| return LocationSummary::Make(1, |
| Location::RequiresRegister(), |
| LocationSummary::kNoCall); |
| @@ -4686,7 +4878,7 @@ |
| } |
| -LocationSummary* StoreVMFieldInstr::MakeLocationSummary() const { |
| +LocationSummary* StoreVMFieldInstr::MakeLocationSummary(bool opt) const { |
| const intptr_t kNumInputs = 2; |
| const intptr_t kNumTemps = 0; |
| LocationSummary* locs = |
| @@ -4712,7 +4904,7 @@ |
| } |
| -LocationSummary* AllocateObjectInstr::MakeLocationSummary() const { |
| +LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { |
| return MakeCallSummary(); |
| } |
| @@ -4728,7 +4920,7 @@ |
| } |
| -LocationSummary* CreateClosureInstr::MakeLocationSummary() const { |
| +LocationSummary* CreateClosureInstr::MakeLocationSummary(bool opt) const { |
| return MakeCallSummary(); |
| } |