| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index b5a108159ad81bac2a1ef8a7e28a287751e712c0..39299267e2de9675e87d6435e0ce2a08822b47ae 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -554,27 +554,55 @@ static Handle<AllocationSite> GetLiteralAllocationSite(
|
| }
|
|
|
|
|
| -RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
|
| - HandleScope scope(isolate);
|
| - ASSERT(args.length() == 3);
|
| - CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
|
| - CONVERT_SMI_ARG_CHECKED(literals_index, 1);
|
| - CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
|
| -
|
| +static MaybeObject* CreateArrayLiteralImpl(Isolate* isolate,
|
| + Handle<FixedArray> literals,
|
| + int literals_index,
|
| + Handle<FixedArray> elements,
|
| + int flags) {
|
| Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
|
| literals_index, elements);
|
| RETURN_IF_EMPTY_HANDLE(isolate, site);
|
|
|
| + bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0;
|
| Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
|
| - AllocationSiteUsageContext usage_context(isolate, site, true);
|
| + AllocationSiteUsageContext usage_context(isolate, site, enable_mementos);
|
| usage_context.EnterNewScope();
|
| - Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context);
|
| + JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0
|
| + ? JSObject::kNoHints
|
| + : JSObject::kObjectIsShallowArray;
|
| + Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context,
|
| + hints);
|
| usage_context.ExitScope(site, boilerplate);
|
| RETURN_IF_EMPTY_HANDLE(isolate, copy);
|
| return *copy;
|
| }
|
|
|
|
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 4);
|
| + CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
|
| + CONVERT_SMI_ARG_CHECKED(literals_index, 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
|
| + CONVERT_SMI_ARG_CHECKED(flags, 3);
|
| +
|
| + return CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
|
| + flags);
|
| +}
|
| +
|
| +
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralStubBailout) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 3);
|
| + CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
|
| + CONVERT_SMI_ARG_CHECKED(literals_index, 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
|
| +
|
| + return CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
|
| + ArrayLiteral::kShallowElements);
|
| +}
|
| +
|
| +
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
|
| HandleScope scope(isolate);
|
| ASSERT(args.length() == 1);
|
|
|