Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 9ed3c441dade430bf0e099d42695829d74b49238..a40dbd7111b87431ef017ddc94763da024544a5c 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -404,10 +404,12 @@ Handle<JSGlobalPropertyCell> Factory::NewJSGlobalPropertyCell( |
} |
-Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { |
+Handle<Map> Factory::NewMap(InstanceType type, |
+ int instance_size, |
+ ElementsKind elements_kind) { |
CALL_HEAP_FUNCTION( |
isolate(), |
- isolate()->heap()->AllocateMap(type, instance_size), |
+ isolate()->heap()->AllocateMap(type, instance_size, elements_kind), |
Map); |
} |
@@ -710,7 +712,12 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, |
if (force_initial_map || |
type != JS_OBJECT_TYPE || |
instance_size != JSObject::kHeaderSize) { |
- Handle<Map> initial_map = NewMap(type, instance_size); |
+ ElementsKind default_elements_kind = FLAG_smi_only_arrays |
+ ? FAST_SMI_ONLY_ELEMENTS |
+ : FAST_ELEMENTS; |
+ Handle<Map> initial_map = NewMap(type, |
+ instance_size, |
+ default_elements_kind); |
function->set_initial_map(*initial_map); |
initial_map->set_constructor(*function); |
} |
@@ -896,11 +903,26 @@ Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, |
Handle<JSArray> result = |
Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), |
pretenure)); |
- result->SetContent(*elements); |
+ SetContent(result, elements); |
return result; |
} |
+void Factory::SetContent(Handle<JSArray> array, |
+ Handle<FixedArray> elements) { |
+ CALL_HEAP_FUNCTION_VOID( |
+ isolate(), |
+ array->SetContent(*elements)); |
+} |
+ |
+ |
+void Factory::EnsureCanContainNonSmiElements(Handle<JSArray> array) { |
+ CALL_HEAP_FUNCTION_VOID( |
+ isolate(), |
+ array->EnsureCanContainNonSmiElements()); |
+} |
+ |
+ |
Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, |
Handle<Object> prototype) { |
CALL_HEAP_FUNCTION( |