Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1236)

Unified Diff: src/code-stubs-hydrogen.cc

Issue 609463003: Hydrogenize (and share) part of StoreTransition handler as a StoreTransitionStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <>
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698