Index: src/full-codegen/ia32/full-codegen-ia32.cc |
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc |
index a7715707f19eaab5f97daf90838152de251b556c..42c12b3773fb90b5b53b03b0908bec3f7f9aaa0f 100644 |
--- a/src/full-codegen/ia32/full-codegen-ia32.cc |
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc |
@@ -1180,18 +1180,27 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
} |
-void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
- int offset, |
- FeedbackVectorICSlot slot) { |
- if (NeedsHomeObject(initializer)) { |
- __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
- __ mov(StoreDescriptor::NameRegister(), |
- Immediate(isolate()->factory()->home_object_symbol())); |
- __ mov(StoreDescriptor::ValueRegister(), |
- Operand(esp, offset * kPointerSize)); |
- if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
- CallStoreIC(); |
- } |
+void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, |
+ FeedbackVectorICSlot slot) { |
+ DCHECK(NeedsHomeObject(initializer)); |
+ __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
+ __ mov(StoreDescriptor::NameRegister(), |
+ Immediate(isolate()->factory()->home_object_symbol())); |
+ __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize)); |
+ if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
+ CallStoreIC(); |
+} |
+ |
+ |
+void FullCodeGenerator::EmitSetHomeObjectAccumulator( |
+ Expression* initializer, int offset, FeedbackVectorICSlot slot) { |
+ DCHECK(NeedsHomeObject(initializer)); |
+ __ mov(StoreDescriptor::ReceiverRegister(), eax); |
+ __ mov(StoreDescriptor::NameRegister(), |
+ Immediate(isolate()->factory()->home_object_symbol())); |
+ __ mov(StoreDescriptor::ValueRegister(), Operand(esp, offset * kPointerSize)); |
+ if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
+ CallStoreIC(); |
} |
@@ -1463,11 +1472,18 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
} |
-void FullCodeGenerator::EmitAccessor(Expression* expression) { |
+void FullCodeGenerator::EmitAccessor(ObjectLiteralProperty* property) { |
+ Expression* expression = (property == NULL) ? NULL : property->value(); |
if (expression == NULL) { |
__ push(Immediate(isolate()->factory()->null_value())); |
} else { |
VisitForStackValue(expression); |
+ if (NeedsHomeObject(expression)) { |
+ DCHECK(property->kind() == ObjectLiteral::Property::GETTER || |
+ property->kind() == ObjectLiteral::Property::SETTER); |
+ int offset = property->kind() == ObjectLiteral::Property::GETTER ? 2 : 3; |
+ EmitSetHomeObject(expression, offset, property->GetSlot()); |
+ } |
} |
} |
@@ -1503,10 +1519,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
AccessorTable accessor_table(zone()); |
int property_index = 0; |
- // store_slot_index points to the vector IC slot for the next store IC used. |
- // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
- // and must be updated if the number of store ICs emitted here changes. |
- int store_slot_index = 0; |
for (; property_index < expr->properties()->length(); property_index++) { |
ObjectLiteral::Property* property = expr->properties()->at(property_index); |
if (property->is_computed_name()) break; |
@@ -1534,22 +1546,14 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
__ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); |
__ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
if (FLAG_vector_stores) { |
- EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++)); |
+ EmitLoadStoreICSlot(property->GetSlot(0)); |
CallStoreIC(); |
} else { |
CallStoreIC(key->LiteralFeedbackId()); |
} |
PrepareForBailoutForId(key->id(), NO_REGISTERS); |
- |
if (NeedsHomeObject(value)) { |
- __ mov(StoreDescriptor::ReceiverRegister(), eax); |
- __ mov(StoreDescriptor::NameRegister(), |
- Immediate(isolate()->factory()->home_object_symbol())); |
- __ mov(StoreDescriptor::ValueRegister(), Operand(esp, 0)); |
- if (FLAG_vector_stores) { |
- EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++)); |
- } |
- CallStoreIC(); |
+ EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1)); |
} |
} else { |
VisitForEffect(value); |
@@ -1560,8 +1564,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
VisitForStackValue(key); |
VisitForStackValue(value); |
if (property->emit_store()) { |
- EmitSetHomeObjectIfNeeded( |
- value, 2, expr->SlotForHomeObject(value, &store_slot_index)); |
+ if (NeedsHomeObject(value)) { |
+ EmitSetHomeObject(value, 2, property->GetSlot()); |
+ } |
__ push(Immediate(Smi::FromInt(SLOPPY))); // Language mode |
__ CallRuntime(Runtime::kSetProperty, 4); |
} else { |
@@ -1576,12 +1581,12 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
break; |
case ObjectLiteral::Property::GETTER: |
if (property->emit_store()) { |
- accessor_table.lookup(key)->second->getter = value; |
+ accessor_table.lookup(key)->second->getter = property; |
} |
break; |
case ObjectLiteral::Property::SETTER: |
if (property->emit_store()) { |
- accessor_table.lookup(key)->second->setter = value; |
+ accessor_table.lookup(key)->second->setter = property; |
} |
break; |
} |
@@ -1594,15 +1599,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
++it) { |
__ push(Operand(esp, 0)); // Duplicate receiver. |
VisitForStackValue(it->first); |
- EmitAccessor(it->second->getter); |
- EmitSetHomeObjectIfNeeded( |
- it->second->getter, 2, |
- expr->SlotForHomeObject(it->second->getter, &store_slot_index)); |
+ EmitAccessor(it->second->getter); |
EmitAccessor(it->second->setter); |
- EmitSetHomeObjectIfNeeded( |
- it->second->setter, 3, |
- expr->SlotForHomeObject(it->second->setter, &store_slot_index)); |
__ push(Immediate(Smi::FromInt(NONE))); |
__ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
@@ -1636,8 +1635,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
} else { |
EmitPropertyKey(property, expr->GetIdForProperty(property_index)); |
VisitForStackValue(value); |
- EmitSetHomeObjectIfNeeded( |
- value, 2, expr->SlotForHomeObject(value, &store_slot_index)); |
+ if (NeedsHomeObject(value)) { |
+ EmitSetHomeObject(value, 2, property->GetSlot()); |
+ } |
switch (property->kind()) { |
case ObjectLiteral::Property::CONSTANT: |
@@ -1679,10 +1679,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
} else { |
context()->Plug(eax); |
} |
- |
- // Verify that compilation exactly consumed the number of store ic slots that |
- // the ObjectLiteral node had to offer. |
- DCHECK(!FLAG_vector_stores || store_slot_index == expr->slot_count()); |
} |
@@ -2353,8 +2349,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
} |
-void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
- int* used_store_slots) { |
+void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
// Constructor is in eax. |
DCHECK(lit != NULL); |
__ push(eax); |
@@ -2386,8 +2381,9 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
} |
VisitForStackValue(value); |
- EmitSetHomeObjectIfNeeded(value, 2, |
- lit->SlotForHomeObject(value, used_store_slots)); |
+ if (NeedsHomeObject(value)) { |
+ EmitSetHomeObject(value, 2, property->GetSlot()); |
+ } |
switch (property->kind()) { |
case ObjectLiteral::Property::CONSTANT: |