Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 6944dc8d948cb3b99b990f2ff9c47f96b2fd98b7..0eec51f077dc855e525441908d418cb387969d77 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -221,7 +221,7 @@ class Genesis BASE_EMBEDDED { |
Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
const char* name, Builtins::Name call, |
- BuiltinFunctionId id); |
+ BuiltinFunctionId id, bool is_shared); |
Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
const char* name, |
ElementsKind elements_kind); |
@@ -2429,7 +2429,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
{ // -- A r r a y B u f f e r |
Handle<JSFunction> array_buffer_fun = InstallArrayBuffer( |
global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength, |
- BuiltinFunctionId::kArrayBufferByteLength); |
+ BuiltinFunctionId::kArrayBufferByteLength, false); |
InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, |
Context::ARRAY_BUFFER_FUN_INDEX); |
InstallSpeciesGetter(array_buffer_fun); |
@@ -3562,7 +3562,7 @@ void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
Handle<JSFunction> shared_array_buffer_fun = |
InstallArrayBuffer(global, "SharedArrayBuffer", |
Builtins::kSharedArrayBufferPrototypeGetByteLength, |
- BuiltinFunctionId::kSharedArrayBufferByteLength); |
+ BuiltinFunctionId::kSharedArrayBufferByteLength, true); |
native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
Handle<String> name = factory->InternalizeUtf8String("Atomics"); |
@@ -3680,7 +3680,8 @@ void Genesis::InitializeGlobal_icu_case_mapping() { |
Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, |
const char* name, |
Builtins::Name call, |
- BuiltinFunctionId id) { |
+ BuiltinFunctionId id, |
+ bool is_shared) { |
// Create the %ArrayBufferPrototype% |
// Setup the {prototype} with the given {name} for @@toStringTag. |
Handle<JSObject> prototype = |
@@ -3710,6 +3711,12 @@ Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, |
SimpleInstallGetter(prototype, factory()->byte_length_string(), call, false, |
id); |
+ // TODO(binji): support SharedArrayBuffer.prototype.slice as well. |
+ if (!is_shared) { |
+ SimpleInstallFunction(prototype, "slice", |
+ Builtins::kArrayBufferPrototypeSlice, 2, true); |
+ } |
+ |
return array_buffer_fun; |
} |