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

Unified Diff: src/bootstrapper.cc

Issue 2775203002: [builtins] Implement %TypedArray%.prototype.{some,every} in the CSA (Closed)
Patch Set: small improvements Created 3 years, 9 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 | « no previous file | 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 3dc58eb901d518e698593e019f9b896bde8a987d..cbeb28b4e11f49fb253637665e80df4fe25d3e4b 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -218,6 +218,8 @@ class Genesis BASE_EMBEDDED {
void InstallOneBuiltinFunction(const char* object, const char* method,
Builtins::Name name);
+ void InstallOneBuiltinFunction(Handle<Object> prototype, const char* method,
+ Builtins::Name name);
void InitializeGlobal_experimental_fast_array_builtins();
Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target,
@@ -3690,8 +3692,7 @@ void Genesis::InstallOneBuiltinFunction(const char* object_name,
const char* method_name,
Builtins::Name builtin_name) {
Handle<JSGlobalObject> global(native_context()->global_object());
- Isolate* isolate = global->GetIsolate();
- Factory* factory = isolate->factory();
+ Factory* factory = isolate()->factory();
LookupIterator it1(global, factory->NewStringFromAsciiChecked(object_name),
LookupIterator::OWN_SKIP_INTERCEPTOR);
@@ -3699,14 +3700,20 @@ void Genesis::InstallOneBuiltinFunction(const char* object_name,
LookupIterator it2(object, factory->NewStringFromAsciiChecked("prototype"),
LookupIterator::OWN_SKIP_INTERCEPTOR);
Handle<Object> prototype = Object::GetProperty(&it2).ToHandleChecked();
+ InstallOneBuiltinFunction(prototype, method_name, builtin_name);
+}
- LookupIterator it3(prototype, factory->NewStringFromAsciiChecked(method_name),
- LookupIterator::OWN_SKIP_INTERCEPTOR);
- Handle<Object> function = Object::GetProperty(&it3).ToHandleChecked();
+void Genesis::InstallOneBuiltinFunction(Handle<Object> prototype,
+ const char* method_name,
+ Builtins::Name builtin_name) {
+ LookupIterator it(
+ prototype, isolate()->factory()->NewStringFromAsciiChecked(method_name),
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
+ Handle<Object> function = Object::GetProperty(&it).ToHandleChecked();
Handle<JSFunction>::cast(function)->set_code(
- isolate->builtins()->builtin(builtin_name));
+ isolate()->builtins()->builtin(builtin_name));
Handle<JSFunction>::cast(function)->shared()->set_code(
- isolate->builtins()->builtin(builtin_name));
+ isolate()->builtins()->builtin(builtin_name));
}
void Genesis::InitializeGlobal_experimental_fast_array_builtins() {
@@ -3715,6 +3722,12 @@ void Genesis::InitializeGlobal_experimental_fast_array_builtins() {
// Insert experimental fast array builtins here.
InstallOneBuiltinFunction("Array", "filter", Builtins::kArrayFilter);
InstallOneBuiltinFunction("Array", "map", Builtins::kArrayMap);
+ Handle<Object> typed_array_prototype(
+ native_context()->typed_array_prototype(), isolate());
+ InstallOneBuiltinFunction(typed_array_prototype, "every",
mvstanton 2017/03/28 15:01:24 Maybe it makes sense to remove InstallOneBuiltinFu
+ Builtins::kTypedArrayPrototypeEvery);
+ InstallOneBuiltinFunction(typed_array_prototype, "some",
+ Builtins::kTypedArrayPrototypeSome);
}
void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698