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

Unified Diff: src/hydrogen.cc

Issue 587203002: ExtendStorageStub added, it is aimed for extending objects backing store when it runs out of space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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/hydrogen.h ('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/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e5a93a7bd5b1f4ec513e0427d54f033b0fdf5dce..fa05518365e690870bb16e532e28208482b0bbd3 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2626,16 +2626,15 @@ void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements,
}
-HValue* HGraphBuilder::BuildAllocateElementsAndInitializeElementsHeader(
- ElementsKind kind,
- HValue* capacity) {
+HValue* HGraphBuilder::BuildAllocateAndInitializeArray(ElementsKind kind,
+ HValue* capacity) {
// The HForceRepresentation is to prevent possible deopt on int-smi
// conversion after allocation but before the new object fields are set.
capacity = AddUncasted<HForceRepresentation>(capacity, Representation::Smi());
HValue* size_in_bytes = BuildCalculateElementsSize(kind, capacity);
- HValue* new_elements = BuildAllocateElements(kind, size_in_bytes);
- BuildInitializeElementsHeader(new_elements, kind, capacity);
- return new_elements;
+ HValue* new_array = BuildAllocateElements(kind, size_in_bytes);
+ BuildInitializeElementsHeader(new_array, kind, capacity);
+ return new_array;
}
@@ -2754,8 +2753,8 @@ HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
(Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) >>
ElementsKindToShiftSize(new_kind)));
- HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
- new_kind, new_capacity);
+ HValue* new_elements =
+ BuildAllocateAndInitializeArray(new_kind, new_capacity);
BuildCopyElements(elements, kind, new_elements,
new_kind, length, new_capacity);
@@ -2789,12 +2788,6 @@ void HGraphBuilder::BuildFillElementsWithValue(HValue* elements,
}
}
- // Since we're about to store a hole value, the store instruction below must
- // assume an elements kind that supports heap object values.
- if (IsFastSmiOrObjectElementsKind(elements_kind)) {
- elements_kind = FAST_HOLEY_ELEMENTS;
- }
-
if (initial_capacity >= 0) {
for (int i = 0; i < initial_capacity; i++) {
HInstruction* key = Add<HConstant>(i);
@@ -2832,10 +2825,40 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
? Add<HConstant>(factory->the_hole_value())
: Add<HConstant>(nan_double);
+ // Since we're about to store a hole value, the store instruction below must
+ // assume an elements kind that supports heap object values.
+ if (IsFastSmiOrObjectElementsKind(elements_kind)) {
+ elements_kind = FAST_HOLEY_ELEMENTS;
+ }
+
BuildFillElementsWithValue(elements, elements_kind, from, to, hole);
}
+void HGraphBuilder::BuildCopyProperties(HValue* from_properties,
+ HValue* to_properties, HValue* length,
+ HValue* capacity) {
+ ElementsKind kind = FAST_ELEMENTS;
+
+ BuildFillElementsWithValue(to_properties, kind, length, capacity,
+ graph()->GetConstantUndefined());
+
+ LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement);
+
+ HValue* key = builder.BeginBody(length, graph()->GetConstant0(), Token::GT);
+
+ key = AddUncasted<HSub>(key, graph()->GetConstant1());
+ key->ClearFlag(HValue::kCanOverflow);
+
+ HValue* element =
+ Add<HLoadKeyed>(from_properties, key, static_cast<HValue*>(NULL), kind);
+
+ Add<HStoreKeyed>(to_properties, key, element, kind);
+
+ builder.EndBody();
+}
+
+
void HGraphBuilder::BuildCopyElements(HValue* from_elements,
ElementsKind from_elements_kind,
HValue* to_elements,
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698