Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: src/bootstrapper.cc

Issue 2697013009: Move ArrayBuffer.prototype.slice implementation to C++ (Closed)
Patch Set: merge master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 29d0a7e4cdae2fd95ba600c7db45863eff80c73c..3e5264dd94ab154bdbd2f775e75175f0164df2c7 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -223,7 +223,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);
@@ -2550,7 +2550,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);
@@ -3688,7 +3688,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");
@@ -3867,7 +3867,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 =
@@ -3897,6 +3898,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;
}
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698