Commit ff309a23 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: VectorICs: Lithium support for vector-based stores.

Port 8a3cf4ec

R=mvstanton@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1212613003

Cr-Commit-Position: refs/heads/master@{#29335}
parent 47dd45c0
......@@ -3012,7 +3012,21 @@ void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
// No need to allocate this register.
FeedbackVectorICSlot slot = instr->hydrogen()->slot();
int index = vector->GetIndex(slot);
__ mov(slot_register, Operand(Smi::FromInt(index)));
__ LoadSmiLiteral(slot_register, Smi::FromInt(index));
}
template <class T>
void LCodeGen::EmitVectorStoreICRegisters(T* instr) {
Register vector_register = ToRegister(instr->temp_vector());
Register slot_register = ToRegister(instr->temp_slot());
AllowDeferredHandleDereference vector_structure_check;
Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector();
__ Move(vector_register, vector);
FeedbackVectorICSlot slot = instr->hydrogen()->slot();
int index = vector->GetIndex(slot);
__ LoadSmiLiteral(slot_register, Smi::FromInt(index));
}
......@@ -4420,10 +4434,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<LStoreNamedGeneric>(instr);
}
__ mov(StoreDescriptor::NameRegister(), Operand(instr->name()));
Handle<Code> ic =
StoreIC::initialize_stub(isolate(), instr->language_mode(),
instr->hydrogen()->initialization_state());
Handle<Code> ic = CodeFactory::StoreICInOptimizedCode(
isolate(), instr->language_mode(),
instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
......@@ -4687,6 +4705,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<LStoreKeyedGeneric>(instr);
}
Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
isolate(), instr->language_mode(),
instr->hydrogen()->initialization_state()).code();
......
......@@ -285,6 +285,8 @@ class LCodeGen : public LCodeGenBase {
template <class T>
void EmitVectorLoadICRegisters(T* instr);
template <class T>
void EmitVectorStoreICRegisters(T* instr);
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
......
......@@ -2275,8 +2275,16 @@ LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
DCHECK(instr->key()->representation().IsTagged());
DCHECK(instr->value()->representation().IsTagged());
return MarkAsCall(new (zone()) LStoreKeyedGeneric(context, obj, key, val),
instr);
LOperand* slot = NULL;
LOperand* vector = NULL;
if (instr->HasVectorAndSlot()) {
slot = FixedTemp(VectorStoreICDescriptor::SlotRegister());
vector = FixedTemp(VectorStoreICDescriptor::VectorRegister());
}
LStoreKeyedGeneric* result =
new (zone()) LStoreKeyedGeneric(context, obj, key, val, slot, vector);
return MarkAsCall(result, instr);
}
......@@ -2359,8 +2367,15 @@ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
LOperand* obj =
UseFixed(instr->object(), StoreDescriptor::ReceiverRegister());
LOperand* val = UseFixed(instr->value(), StoreDescriptor::ValueRegister());
LOperand* slot = NULL;
LOperand* vector = NULL;
if (instr->HasVectorAndSlot()) {
slot = FixedTemp(VectorStoreICDescriptor::SlotRegister());
vector = FixedTemp(VectorStoreICDescriptor::VectorRegister());
}
LInstruction* result = new (zone()) LStoreNamedGeneric(context, obj, val);
LStoreNamedGeneric* result =
new (zone()) LStoreNamedGeneric(context, obj, val, slot, vector);
return MarkAsCall(result, instr);
}
......
......@@ -2083,17 +2083,22 @@ class LStoreNamedField final : public LTemplateInstruction<0, 2, 1> {
};
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)
......@@ -2140,20 +2145,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* obj, LOperand* key,
LOperand* value) {
LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
LOperand* value, LOperand* slot, LOperand* vector) {
inputs_[0] = context;
inputs_[1] = obj;
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment