Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index ba1de7aa2258a308927c90f937d5d1e6beccd841..2fab7adf9235ae99204af7d4d5f5465de31e8999 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1679,14 +1679,6 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate, |
if (mode == TRACK_ALLOCATION_SITE) { |
size += AllocationMemento::kSize; |
} |
- int elems_offset = size; |
- InstanceType instance_type = IsFastDoubleElementsKind(kind) ? |
- FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE; |
- if (length > 0) { |
- size += IsFastDoubleElementsKind(kind) |
- ? FixedDoubleArray::SizeFor(length) |
- : FixedArray::SizeFor(length); |
- } |
// Allocate both the JS array and the elements array in one big |
Michael Starzinger
2013/08/16 20:02:11
nit: Comment is outdated.
Hannes Payer (out of office)
2013/08/28 13:10:59
Done.
|
// allocation. This avoids multiple limit checks. |
@@ -1694,7 +1686,7 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate, |
HInstruction* object = Add<HAllocate>(size_in_bytes, |
HType::JSObject(), |
NOT_TENURED, |
- instance_type); |
+ JS_OBJECT_TYPE); |
Michael Starzinger
2013/08/16 20:02:11
Nice, that would have been a disaster once we woul
|
// Copy the JS array part. |
for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
@@ -1714,7 +1706,16 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate, |
// Get hold of the elements array of the boilerplate and setup the |
Michael Starzinger
2013/08/16 20:02:11
nit: Comment is outdated.
Hannes Payer (out of office)
2013/08/28 13:10:59
Done.
|
// elements pointer in the resulting object. |
HValue* boilerplate_elements = AddLoadElements(boilerplate, NULL); |
- HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset); |
+ HValue* object_elements; |
+ if (IsFastDoubleElementsKind(kind)) { |
+ HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length)); |
+ object_elements = Add<HAllocate>(elems_size, HType::JSArray(), |
+ NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE); |
+ } else { |
+ HValue* elems_size = Add<HConstant>(FixedArray::SizeFor(length)); |
+ object_elements = Add<HAllocate>(elems_size, HType::JSArray(), |
+ NOT_TENURED, FIXED_ARRAY_TYPE); |
+ } |
Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
object_elements); |