diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 8d769f76bd..93dc94d842 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -3107,6 +3107,20 @@ void LCodeGen::EmitVectorLoadICRegisters(T* instr) { } +template +void LCodeGen::EmitVectorStoreICRegisters(T* instr) { + Register vector_register = ToRegister(instr->temp_vector()); + Register slot_register = ToRegister(instr->temp_slot()); + + AllowDeferredHandleDereference vector_structure_check; + Handle vector = instr->hydrogen()->feedback_vector(); + __ mov(vector_register, vector); + FeedbackVectorICSlot slot = instr->hydrogen()->slot(); + int index = vector->GetIndex(slot); + __ mov(slot_register, Immediate(Smi::FromInt(index))); +} + + void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); DCHECK(ToRegister(instr->global_object()) @@ -4488,10 +4502,14 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); + if (instr->hydrogen()->HasVectorAndSlot()) { + EmitVectorStoreICRegisters(instr); + } + __ mov(StoreDescriptor::NameRegister(), instr->name()); - Handle ic = - StoreIC::initialize_stub(isolate(), instr->language_mode(), - instr->hydrogen()->initialization_state()); + Handle ic = CodeFactory::StoreICInOptimizedCode( + isolate(), instr->language_mode(), + instr->hydrogen()->initialization_state()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); } @@ -4721,6 +4739,10 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); + if (instr->hydrogen()->HasVectorAndSlot()) { + EmitVectorStoreICRegisters(instr); + } + Handle ic = CodeFactory::KeyedStoreICInOptimizedCode( isolate(), instr->language_mode(), instr->hydrogen()->initialization_state()).code(); diff --git a/src/x87/lithium-codegen-x87.h b/src/x87/lithium-codegen-x87.h index 4376f756e7..9157779a95 100644 --- a/src/x87/lithium-codegen-x87.h +++ b/src/x87/lithium-codegen-x87.h @@ -336,6 +336,8 @@ class LCodeGen: public LCodeGenBase { template void EmitVectorLoadICRegisters(T* instr); + template + void EmitVectorStoreICRegisters(T* instr); void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc index c0424e7431..d4cf64fa47 100644 --- a/src/x87/lithium-x87.cc +++ b/src/x87/lithium-x87.cc @@ -2347,8 +2347,15 @@ LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { DCHECK(instr->key()->representation().IsTagged()); DCHECK(instr->value()->representation().IsTagged()); - LStoreKeyedGeneric* result = - new(zone()) LStoreKeyedGeneric(context, object, key, value); + LOperand* slot = NULL; + LOperand* vector = NULL; + if (instr->HasVectorAndSlot()) { + slot = FixedTemp(VectorStoreICDescriptor::SlotRegister()); + vector = FixedTemp(VectorStoreICDescriptor::VectorRegister()); + } + + LStoreKeyedGeneric* result = new (zone()) + LStoreKeyedGeneric(context, object, key, value, slot, vector); return MarkAsCall(result, instr); } @@ -2459,9 +2466,15 @@ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { LOperand* object = UseFixed(instr->object(), StoreDescriptor::ReceiverRegister()); LOperand* value = UseFixed(instr->value(), StoreDescriptor::ValueRegister()); + LOperand* slot = NULL; + LOperand* vector = NULL; + if (instr->HasVectorAndSlot()) { + slot = FixedTemp(VectorStoreICDescriptor::SlotRegister()); + vector = FixedTemp(VectorStoreICDescriptor::VectorRegister()); + } LStoreNamedGeneric* result = - new(zone()) LStoreNamedGeneric(context, object, value); + new (zone()) LStoreNamedGeneric(context, object, value, slot, vector); return MarkAsCall(result, instr); } diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h index 2e95cab4ab..2edc63b833 100644 --- a/src/x87/lithium-x87.h +++ b/src/x87/lithium-x87.h @@ -2179,17 +2179,22 @@ class LStoreNamedField final : public LTemplateInstruction<0, 2, 2> { }; -class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 0> { +class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 2> { public: - LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) { + LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value, + LOperand* slot, LOperand* vector) { inputs_[0] = context; inputs_[1] = object; inputs_[2] = value; + temps_[0] = slot; + temps_[1] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } LOperand* value() { return inputs_[2]; } + LOperand* temp_slot() { return temps_[0]; } + LOperand* temp_vector() { return temps_[1]; } DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) @@ -2231,22 +2236,24 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> { }; -class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 0> { +class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 2> { public: - LStoreKeyedGeneric(LOperand* context, - LOperand* object, - LOperand* key, - LOperand* value) { + LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key, + LOperand* value, LOperand* slot, LOperand* vector) { inputs_[0] = context; inputs_[1] = object; inputs_[2] = key; inputs_[3] = value; + temps_[0] = slot; + temps_[1] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } LOperand* key() { return inputs_[2]; } LOperand* value() { return inputs_[3]; } + LOperand* temp_slot() { return temps_[0]; } + LOperand* temp_vector() { return temps_[1]; } DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)