| Index: src/full-codegen/mips/full-codegen-mips.cc
|
| diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc
|
| index 9e72de905d1136921f25b9ce6fa7bab9f3de031c..35747a6087be9657c3e94e7a6759798c99d69198 100644
|
| --- a/src/full-codegen/mips/full-codegen-mips.cc
|
| +++ b/src/full-codegen/mips/full-codegen-mips.cc
|
| @@ -1249,18 +1249,29 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
|
| - int offset,
|
| - FeedbackVectorICSlot slot) {
|
| - if (NeedsHomeObject(initializer)) {
|
| - __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp));
|
| - __ li(StoreDescriptor::NameRegister(),
|
| - Operand(isolate()->factory()->home_object_symbol()));
|
| - __ lw(StoreDescriptor::ValueRegister(),
|
| - MemOperand(sp, offset * kPointerSize));
|
| - if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
|
| - CallStoreIC();
|
| - }
|
| +void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset,
|
| + FeedbackVectorICSlot slot) {
|
| + DCHECK(NeedsHomeObject(initializer));
|
| + __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp));
|
| + __ li(StoreDescriptor::NameRegister(),
|
| + Operand(isolate()->factory()->home_object_symbol()));
|
| + __ lw(StoreDescriptor::ValueRegister(),
|
| + MemOperand(sp, offset * kPointerSize));
|
| + if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
|
| + CallStoreIC();
|
| +}
|
| +
|
| +
|
| +void FullCodeGenerator::EmitSetHomeObjectAccumulator(
|
| + Expression* initializer, int offset, FeedbackVectorICSlot slot) {
|
| + DCHECK(NeedsHomeObject(initializer));
|
| + __ Move(StoreDescriptor::ReceiverRegister(), v0);
|
| + __ li(StoreDescriptor::NameRegister(),
|
| + Operand(isolate()->factory()->home_object_symbol()));
|
| + __ lw(StoreDescriptor::ValueRegister(),
|
| + MemOperand(sp, offset * kPointerSize));
|
| + if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
|
| + CallStoreIC();
|
| }
|
|
|
|
|
| @@ -1530,12 +1541,19 @@ 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) {
|
| __ LoadRoot(a1, Heap::kNullValueRootIndex);
|
| __ push(a1);
|
| } 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());
|
| + }
|
| }
|
| }
|
|
|
| @@ -1564,10 +1582,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;
|
| @@ -1596,7 +1610,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| __ li(StoreDescriptor::NameRegister(), Operand(key->value()));
|
| __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp));
|
| if (FLAG_vector_stores) {
|
| - EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++));
|
| + EmitLoadStoreICSlot(property->GetSlot(0));
|
| CallStoreIC();
|
| } else {
|
| CallStoreIC(key->LiteralFeedbackId());
|
| @@ -1604,14 +1618,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| PrepareForBailoutForId(key->id(), NO_REGISTERS);
|
|
|
| if (NeedsHomeObject(value)) {
|
| - __ Move(StoreDescriptor::ReceiverRegister(), v0);
|
| - __ li(StoreDescriptor::NameRegister(),
|
| - Operand(isolate()->factory()->home_object_symbol()));
|
| - __ lw(StoreDescriptor::ValueRegister(), MemOperand(sp));
|
| - if (FLAG_vector_stores) {
|
| - EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++));
|
| - }
|
| - CallStoreIC();
|
| + EmitSetHomeObjectAccumulator(value, 0, property->GetSlot(1));
|
| }
|
| } else {
|
| VisitForEffect(value);
|
| @@ -1624,8 +1631,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());
|
| + }
|
| __ li(a0, Operand(Smi::FromInt(SLOPPY))); // PropertyAttributes.
|
| __ push(a0);
|
| __ CallRuntime(Runtime::kSetProperty, 4);
|
| @@ -1643,12 +1651,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;
|
| }
|
| @@ -1663,13 +1671,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| __ push(a0);
|
| VisitForStackValue(it->first);
|
| EmitAccessor(it->second->getter);
|
| - EmitSetHomeObjectIfNeeded(
|
| - it->second->getter, 2,
|
| - expr->SlotForHomeObject(it->second->getter, &store_slot_index));
|
| EmitAccessor(it->second->setter);
|
| - EmitSetHomeObjectIfNeeded(
|
| - it->second->setter, 3,
|
| - expr->SlotForHomeObject(it->second->setter, &store_slot_index));
|
| __ li(a0, Operand(Smi::FromInt(NONE)));
|
| __ push(a0);
|
| __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
|
| @@ -1704,8 +1706,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:
|
| @@ -1751,10 +1754,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| } else {
|
| context()->Plug(v0);
|
| }
|
| -
|
| - // 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());
|
| }
|
|
|
|
|
| @@ -2426,8 +2425,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
|
| - int* used_store_slots) {
|
| +void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
|
| // Constructor is in v0.
|
| DCHECK(lit != NULL);
|
| __ push(v0);
|
| @@ -2461,8 +2459,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:
|
| @@ -3164,7 +3163,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
|
|
|
| // Push constructor on the stack. If it's not a function it's used as
|
| // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
|
| - // ignored.
|
| + // ignored.g
|
| DCHECK(!expr->expression()->IsSuperPropertyReference());
|
| VisitForStackValue(expr->expression());
|
|
|
|
|