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

Side by Side Diff: src/bootstrapper.cc

Issue 2775203002: [builtins] Implement %TypedArray%.prototype.{some,every} in the CSA (Closed)
Patch Set: fix switching backing store bug Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | src/builtins/builtins-array-gen.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void ConfigureUtilsObject(GlobalContextType context_type); 209 void ConfigureUtilsObject(GlobalContextType context_type);
210 210
211 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ 211 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \
212 void InitializeGlobal_##id(); 212 void InitializeGlobal_##id();
213 213
214 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) 214 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
215 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) 215 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
216 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) 216 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
217 #undef DECLARE_FEATURE_INITIALIZATION 217 #undef DECLARE_FEATURE_INITIALIZATION
218 218
219 void InstallOneBuiltinFunction(const char* object, const char* method, 219 void InstallOneBuiltinFunction(Handle<Object> prototype, const char* method,
220 Builtins::Name name); 220 Builtins::Name name);
221 void InitializeGlobal_experimental_fast_array_builtins(); 221 void InitializeGlobal_experimental_fast_array_builtins();
222 222
223 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, 223 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target,
224 const char* name, 224 const char* name,
225 Builtins::Name call_byteLength, 225 Builtins::Name call_byteLength,
226 BuiltinFunctionId byteLength_id, 226 BuiltinFunctionId byteLength_id,
227 Builtins::Name call_slice); 227 Builtins::Name call_slice);
228 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, 228 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target,
229 const char* name, 229 const char* name,
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3685 JSGlobalObject::cast(native_context->global_object())); 3685 JSGlobalObject::cast(native_context->global_object()));
3686 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); 3686 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol");
3687 Handle<JSObject> symbol = Handle<JSObject>::cast( 3687 Handle<JSObject> symbol = Handle<JSObject>::cast(
3688 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); 3688 JSObject::GetProperty(global, symbol_string).ToHandleChecked());
3689 Handle<String> name_string = factory->InternalizeUtf8String(name); 3689 Handle<String> name_string = factory->InternalizeUtf8String(name);
3690 PropertyAttributes attributes = 3690 PropertyAttributes attributes =
3691 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 3691 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
3692 JSObject::AddProperty(symbol, name_string, value, attributes); 3692 JSObject::AddProperty(symbol, name_string, value, attributes);
3693 } 3693 }
3694 3694
3695 void Genesis::InstallOneBuiltinFunction(const char* object_name, 3695 void Genesis::InstallOneBuiltinFunction(Handle<Object> prototype,
3696 const char* method_name, 3696 const char* method_name,
3697 Builtins::Name builtin_name) { 3697 Builtins::Name builtin_name) {
3698 Handle<JSGlobalObject> global(native_context()->global_object()); 3698 LookupIterator it(
3699 Isolate* isolate = global->GetIsolate(); 3699 prototype, isolate()->factory()->NewStringFromAsciiChecked(method_name),
3700 Factory* factory = isolate->factory(); 3700 LookupIterator::OWN_SKIP_INTERCEPTOR);
3701 3701 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked();
3702 LookupIterator it1(global, factory->NewStringFromAsciiChecked(object_name),
3703 LookupIterator::OWN_SKIP_INTERCEPTOR);
3704 Handle<Object> object = Object::GetProperty(&it1).ToHandleChecked();
3705 LookupIterator it2(object, factory->NewStringFromAsciiChecked("prototype"),
3706 LookupIterator::OWN_SKIP_INTERCEPTOR);
3707 Handle<Object> prototype = Object::GetProperty(&it2).ToHandleChecked();
3708
3709 LookupIterator it3(prototype, factory->NewStringFromAsciiChecked(method_name),
3710 LookupIterator::OWN_SKIP_INTERCEPTOR);
3711 Handle<Object> function = Object::GetProperty(&it3).ToHandleChecked();
3712 Handle<JSFunction>::cast(function)->set_code( 3702 Handle<JSFunction>::cast(function)->set_code(
3713 isolate->builtins()->builtin(builtin_name)); 3703 isolate()->builtins()->builtin(builtin_name));
3714 Handle<JSFunction>::cast(function)->shared()->set_code( 3704 Handle<JSFunction>::cast(function)->shared()->set_code(
3715 isolate->builtins()->builtin(builtin_name)); 3705 isolate()->builtins()->builtin(builtin_name));
3716 } 3706 }
3717 3707
3718 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { 3708 void Genesis::InitializeGlobal_experimental_fast_array_builtins() {
3719 if (!FLAG_experimental_fast_array_builtins) return; 3709 if (!FLAG_experimental_fast_array_builtins) return;
3720 3710 {
3721 // Insert experimental fast array builtins here. 3711 Handle<JSFunction> array_constructor(native_context()->array_function());
3722 InstallOneBuiltinFunction("Array", "filter", Builtins::kArrayFilter); 3712 Handle<Object> array_prototype(array_constructor->prototype(), isolate());
3723 InstallOneBuiltinFunction("Array", "map", Builtins::kArrayMap); 3713 // Insert experimental fast Array builtins here.
3714 InstallOneBuiltinFunction(array_prototype, "filter",
3715 Builtins::kArrayFilter);
3716 InstallOneBuiltinFunction(array_prototype, "map", Builtins::kArrayMap);
3717 }
3718 {
3719 Handle<Object> typed_array_prototype(
3720 native_context()->typed_array_prototype(), isolate());
3721 // Insert experimental fast TypedArray builtins here.
3722 InstallOneBuiltinFunction(typed_array_prototype, "every",
3723 Builtins::kTypedArrayPrototypeEvery);
3724 InstallOneBuiltinFunction(typed_array_prototype, "some",
3725 Builtins::kTypedArrayPrototypeSome);
3726 }
3724 } 3727 }
3725 3728
3726 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { 3729 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
3727 if (!FLAG_harmony_sharedarraybuffer) return; 3730 if (!FLAG_harmony_sharedarraybuffer) return;
3728 3731
3729 Handle<JSGlobalObject> global(native_context()->global_object()); 3732 Handle<JSGlobalObject> global(native_context()->global_object());
3730 Isolate* isolate = global->GetIsolate(); 3733 Isolate* isolate = global->GetIsolate();
3731 Factory* factory = isolate->factory(); 3734 Factory* factory = isolate->factory();
3732 3735
3733 Handle<JSFunction> shared_array_buffer_fun = 3736 Handle<JSFunction> shared_array_buffer_fun =
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
5106 } 5109 }
5107 5110
5108 5111
5109 // Called when the top-level V8 mutex is destroyed. 5112 // Called when the top-level V8 mutex is destroyed.
5110 void Bootstrapper::FreeThreadResources() { 5113 void Bootstrapper::FreeThreadResources() {
5111 DCHECK(!IsActive()); 5114 DCHECK(!IsActive());
5112 } 5115 }
5113 5116
5114 } // namespace internal 5117 } // namespace internal
5115 } // namespace v8 5118 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | src/builtins/builtins-array-gen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698