Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index dfa5ecd8cf840a75086eb5b0d5bac86b839aceb3..4a29db6747af7129891875a6847db5d2715badb6 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -695,27 +695,7 @@ HValue* CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor( |
HInstruction* argument = Add<HAccessArgumentsAt>( |
elements, constant_one, constant_zero); |
- HConstant* max_alloc_length = |
- Add<HConstant>(JSObject::kInitialMaxFastElementArray); |
- const int initial_capacity = JSArray::kPreallocatedArrayElements; |
- HConstant* initial_capacity_node = Add<HConstant>(initial_capacity); |
- |
- HInstruction* checked_arg = Add<HBoundsCheck>(argument, max_alloc_length); |
- IfBuilder if_builder(this); |
- if_builder.If<HCompareNumericAndBranch>(checked_arg, constant_zero, |
- Token::EQ); |
- if_builder.Then(); |
- Push(initial_capacity_node); // capacity |
- Push(constant_zero); // length |
- if_builder.Else(); |
- Push(checked_arg); // capacity |
- Push(checked_arg); // length |
- if_builder.End(); |
- |
- // Figure out total size |
- HValue* length = Pop(); |
- HValue* capacity = Pop(); |
- return array_builder->AllocateArray(capacity, length, true); |
+ return BuildAllocateArrayFromLength(array_builder, argument); |
} |
@@ -727,10 +707,12 @@ HValue* CodeStubGraphBuilderBase::BuildArrayNArgumentsConstructor( |
// If it's a double array, no problem, and if it's fast then no |
// problem either because doubles are boxed. |
HValue* length = GetArgumentsLength(); |
- bool fill_with_hole = IsFastSmiElementsKind(kind); |
+ JSArrayBuilder::FillMode fill_mode = IsFastSmiElementsKind(kind) |
+ ? JSArrayBuilder::FILL_WITH_HOLE |
+ : JSArrayBuilder::DONT_FILL_WITH_HOLE; |
Toon Verwaest
2013/11/11 13:59:28
Technically we don't need to fill this in with the
mvstanton
2013/11/13 14:12:52
I've added a TODO for this, it's a neat idea.
|
HValue* new_object = array_builder->AllocateArray(length, |
length, |
- fill_with_hole); |
+ fill_mode); |
HValue* elements = array_builder->GetElementsLocation(); |
ASSERT(elements != NULL); |