Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 7b8fa38fb7c2d27956506d697c5e4e0af5a4c709..7c38873e5aaebc182c05816bbf9a369e4ba99546 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1370,6 +1370,15 @@ Handle<JSObject> Factory::NewJSObjectFromMap( |
Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
+ PretenureFlag pretenure) { |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateJSArray(elements_kind, |
+ pretenure), |
+ JSArray); |
+} |
+ |
+ |
+Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
int length, |
int capacity, |
ArrayStorageAllocationMode mode, |
@@ -1390,13 +1399,13 @@ Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
int length, |
PretenureFlag pretenure) { |
ASSERT(length <= elements->length()); |
- CALL_HEAP_FUNCTION( |
- isolate(), |
- isolate()->heap()->AllocateJSArrayWithElements(*elements, |
- elements_kind, |
- length, |
- pretenure), |
- JSArray); |
+ Handle<JSArray> array = |
+ isolate()->factory()->NewJSArray(elements_kind, pretenure); |
+ |
+ array->set_elements(*elements); |
+ array->set_length(Smi::FromInt(length)); |
+ JSObject::ValidateElements(array); |
+ return array; |
} |