| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index 70dabb594b14ad0e3e0c2d160ee3158ebaadc92a..b3bb4f37b087f4355c089bbe979a122ec599b492 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -776,44 +776,56 @@ Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); }
|
|
|
|
|
| template <>
|
| -HValue* CodeStubGraphBuilder<ExtendStorageStub>::BuildCodeStub() {
|
| - HValue* object = GetParameter(ExtendStorageDescriptor::kReceiverIndex);
|
| - HValue* properties =
|
| - Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
|
| - HObjectAccess::ForPropertiesPointer());
|
| - HValue* length = AddLoadFixedArrayLength(properties);
|
| - HValue* delta = Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded));
|
| - HValue* new_capacity = AddUncasted<HAdd>(length, delta);
|
| -
|
| - // Grow properties array.
|
| - ElementsKind kind = FAST_ELEMENTS;
|
| - Add<HBoundsCheck>(new_capacity,
|
| - Add<HConstant>((Page::kMaxRegularHeapObjectSize -
|
| - FixedArray::kHeaderSize) >>
|
| - ElementsKindToShiftSize(kind)));
|
| -
|
| - // Reuse this code for properties backing store allocation.
|
| - HValue* new_properties = BuildAllocateAndInitializeArray(kind, new_capacity);
|
| -
|
| - BuildCopyProperties(properties, new_properties, length, new_capacity);
|
| -
|
| - // Store the new value into the "extended" object.
|
| - Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(),
|
| - new_properties);
|
| -
|
| - BuildStoreNamedField(
|
| - object, GetParameter(ExtendStorageDescriptor::kValueIndex),
|
| - casted_stub()->index(), casted_stub()->representation(), true);
|
| -
|
| - // And finally update the map after the new field is added.
|
| - Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
|
| - GetParameter(ExtendStorageDescriptor::kMapIndex));
|
| -
|
| - return GetParameter(ExtendStorageDescriptor::kValueIndex);
|
| +HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() {
|
| + HValue* object = GetParameter(StoreTransitionDescriptor::kReceiverIndex);
|
| +
|
| + switch (casted_stub()->store_mode()) {
|
| + case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: {
|
| + HValue* properties =
|
| + Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
|
| + HObjectAccess::ForPropertiesPointer());
|
| + HValue* length = AddLoadFixedArrayLength(properties);
|
| + HValue* delta =
|
| + Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded));
|
| + HValue* new_capacity = AddUncasted<HAdd>(length, delta);
|
| +
|
| + // Grow properties array.
|
| + ElementsKind kind = FAST_ELEMENTS;
|
| + Add<HBoundsCheck>(new_capacity,
|
| + Add<HConstant>((Page::kMaxRegularHeapObjectSize -
|
| + FixedArray::kHeaderSize) >>
|
| + ElementsKindToShiftSize(kind)));
|
| +
|
| + // Reuse this code for properties backing store allocation.
|
| + HValue* new_properties =
|
| + BuildAllocateAndInitializeArray(kind, new_capacity);
|
| +
|
| + BuildCopyProperties(properties, new_properties, length, new_capacity);
|
| +
|
| + // Store the new value into the "extended" object.
|
| + Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(),
|
| + new_properties);
|
| + }
|
| + // Fall through.
|
| + case StoreTransitionStub::StoreMapAndValue:
|
| + BuildStoreNamedField(
|
| + object, GetParameter(StoreTransitionDescriptor::kValueIndex),
|
| + casted_stub()->index(), casted_stub()->representation(), true);
|
| + // Fall through.
|
| +
|
| + case StoreTransitionStub::StoreMapOnly:
|
| + // And finally update the map.
|
| + Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
|
| + GetParameter(StoreTransitionDescriptor::kMapIndex));
|
| + break;
|
| + }
|
| + return GetParameter(StoreTransitionDescriptor::kValueIndex);
|
| }
|
|
|
|
|
| -Handle<Code> ExtendStorageStub::GenerateCode() { return DoGenerateCode(this); }
|
| +Handle<Code> StoreTransitionStub::GenerateCode() {
|
| + return DoGenerateCode(this);
|
| +}
|
|
|
|
|
| template <>
|
|
|