| Index: src/runtime/runtime-array.cc
|
| diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
|
| index da8898f4e999526325d86bde58b482072d45be39..fa0d91bf230c26e463ac22b826cec73f411dd630 100644
|
| --- a/src/runtime/runtime-array.cc
|
| +++ b/src/runtime/runtime-array.cc
|
| @@ -25,6 +25,35 @@
|
| // on Array.prototype and below.
|
| prototype->set_elements(isolate->heap()->empty_fixed_array());
|
| return Smi::FromInt(0);
|
| +}
|
| +
|
| +
|
| +static void InstallBuiltin(Isolate* isolate, Handle<JSObject> holder,
|
| + const char* name, Builtins::Name builtin_name) {
|
| + Handle<String> key = isolate->factory()->InternalizeUtf8String(name);
|
| + Handle<Code> code(isolate->builtins()->builtin(builtin_name));
|
| + Handle<JSFunction> optimized =
|
| + isolate->factory()->NewFunctionWithoutPrototype(key, code);
|
| + optimized->shared()->DontAdaptArguments();
|
| + JSObject::AddProperty(holder, key, optimized, NONE);
|
| +}
|
| +
|
| +
|
| +RUNTIME_FUNCTION(Runtime_SpecialArrayFunctions) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 0);
|
| + Handle<JSObject> holder =
|
| + isolate->factory()->NewJSObject(isolate->object_function());
|
| +
|
| + InstallBuiltin(isolate, holder, "pop", Builtins::kArrayPop);
|
| + InstallBuiltin(isolate, holder, "push", Builtins::kArrayPush);
|
| + InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift);
|
| + InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift);
|
| + InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice);
|
| + InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice);
|
| + InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat);
|
| +
|
| + return *holder;
|
| }
|
|
|
|
|
|
|