OLD | NEW |
---|---|
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(const char* object, const char* method, |
220 Builtins::Name name); | 220 Builtins::Name name); |
221 void InstallOneBuiltinFunction(Handle<Object> prototype, const char* method, | |
222 Builtins::Name name); | |
221 void InitializeGlobal_experimental_fast_array_builtins(); | 223 void InitializeGlobal_experimental_fast_array_builtins(); |
222 | 224 |
223 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 225 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
224 const char* name, | 226 const char* name, |
225 Builtins::Name call_byteLength, | 227 Builtins::Name call_byteLength, |
226 BuiltinFunctionId byteLength_id, | 228 BuiltinFunctionId byteLength_id, |
227 Builtins::Name call_slice); | 229 Builtins::Name call_slice); |
228 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 230 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
229 const char* name, | 231 const char* name, |
230 ElementsKind elements_kind); | 232 ElementsKind elements_kind); |
(...skipping 3452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3683 Handle<String> name_string = factory->InternalizeUtf8String(name); | 3685 Handle<String> name_string = factory->InternalizeUtf8String(name); |
3684 PropertyAttributes attributes = | 3686 PropertyAttributes attributes = |
3685 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 3687 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
3686 JSObject::AddProperty(symbol, name_string, value, attributes); | 3688 JSObject::AddProperty(symbol, name_string, value, attributes); |
3687 } | 3689 } |
3688 | 3690 |
3689 void Genesis::InstallOneBuiltinFunction(const char* object_name, | 3691 void Genesis::InstallOneBuiltinFunction(const char* object_name, |
3690 const char* method_name, | 3692 const char* method_name, |
3691 Builtins::Name builtin_name) { | 3693 Builtins::Name builtin_name) { |
3692 Handle<JSGlobalObject> global(native_context()->global_object()); | 3694 Handle<JSGlobalObject> global(native_context()->global_object()); |
3693 Isolate* isolate = global->GetIsolate(); | 3695 Factory* factory = isolate()->factory(); |
3694 Factory* factory = isolate->factory(); | |
3695 | 3696 |
3696 LookupIterator it1(global, factory->NewStringFromAsciiChecked(object_name), | 3697 LookupIterator it1(global, factory->NewStringFromAsciiChecked(object_name), |
3697 LookupIterator::OWN_SKIP_INTERCEPTOR); | 3698 LookupIterator::OWN_SKIP_INTERCEPTOR); |
3698 Handle<Object> object = Object::GetProperty(&it1).ToHandleChecked(); | 3699 Handle<Object> object = Object::GetProperty(&it1).ToHandleChecked(); |
3699 LookupIterator it2(object, factory->NewStringFromAsciiChecked("prototype"), | 3700 LookupIterator it2(object, factory->NewStringFromAsciiChecked("prototype"), |
3700 LookupIterator::OWN_SKIP_INTERCEPTOR); | 3701 LookupIterator::OWN_SKIP_INTERCEPTOR); |
3701 Handle<Object> prototype = Object::GetProperty(&it2).ToHandleChecked(); | 3702 Handle<Object> prototype = Object::GetProperty(&it2).ToHandleChecked(); |
3703 InstallOneBuiltinFunction(prototype, method_name, builtin_name); | |
3704 } | |
3702 | 3705 |
3703 LookupIterator it3(prototype, factory->NewStringFromAsciiChecked(method_name), | 3706 void Genesis::InstallOneBuiltinFunction(Handle<Object> prototype, |
3704 LookupIterator::OWN_SKIP_INTERCEPTOR); | 3707 const char* method_name, |
3705 Handle<Object> function = Object::GetProperty(&it3).ToHandleChecked(); | 3708 Builtins::Name builtin_name) { |
3709 LookupIterator it( | |
3710 prototype, isolate()->factory()->NewStringFromAsciiChecked(method_name), | |
3711 LookupIterator::OWN_SKIP_INTERCEPTOR); | |
3712 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); | |
3706 Handle<JSFunction>::cast(function)->set_code( | 3713 Handle<JSFunction>::cast(function)->set_code( |
3707 isolate->builtins()->builtin(builtin_name)); | 3714 isolate()->builtins()->builtin(builtin_name)); |
3708 Handle<JSFunction>::cast(function)->shared()->set_code( | 3715 Handle<JSFunction>::cast(function)->shared()->set_code( |
3709 isolate->builtins()->builtin(builtin_name)); | 3716 isolate()->builtins()->builtin(builtin_name)); |
3710 } | 3717 } |
3711 | 3718 |
3712 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { | 3719 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { |
3713 if (!FLAG_experimental_fast_array_builtins) return; | 3720 if (!FLAG_experimental_fast_array_builtins) return; |
3714 | 3721 |
3715 // Insert experimental fast array builtins here. | 3722 // Insert experimental fast array builtins here. |
3716 InstallOneBuiltinFunction("Array", "filter", Builtins::kArrayFilter); | 3723 InstallOneBuiltinFunction("Array", "filter", Builtins::kArrayFilter); |
3717 InstallOneBuiltinFunction("Array", "map", Builtins::kArrayMap); | 3724 InstallOneBuiltinFunction("Array", "map", Builtins::kArrayMap); |
3725 Handle<Object> typed_array_prototype( | |
3726 native_context()->typed_array_prototype(), isolate()); | |
3727 InstallOneBuiltinFunction(typed_array_prototype, "every", | |
mvstanton
2017/03/28 15:01:24
Maybe it makes sense to remove InstallOneBuiltinFu
| |
3728 Builtins::kTypedArrayPrototypeEvery); | |
3729 InstallOneBuiltinFunction(typed_array_prototype, "some", | |
3730 Builtins::kTypedArrayPrototypeSome); | |
3718 } | 3731 } |
3719 | 3732 |
3720 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 3733 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
3721 if (!FLAG_harmony_sharedarraybuffer) return; | 3734 if (!FLAG_harmony_sharedarraybuffer) return; |
3722 | 3735 |
3723 Handle<JSGlobalObject> global(native_context()->global_object()); | 3736 Handle<JSGlobalObject> global(native_context()->global_object()); |
3724 Isolate* isolate = global->GetIsolate(); | 3737 Isolate* isolate = global->GetIsolate(); |
3725 Factory* factory = isolate->factory(); | 3738 Factory* factory = isolate->factory(); |
3726 | 3739 |
3727 Handle<JSFunction> shared_array_buffer_fun = | 3740 Handle<JSFunction> shared_array_buffer_fun = |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5096 } | 5109 } |
5097 | 5110 |
5098 | 5111 |
5099 // Called when the top-level V8 mutex is destroyed. | 5112 // Called when the top-level V8 mutex is destroyed. |
5100 void Bootstrapper::FreeThreadResources() { | 5113 void Bootstrapper::FreeThreadResources() { |
5101 DCHECK(!IsActive()); | 5114 DCHECK(!IsActive()); |
5102 } | 5115 } |
5103 | 5116 |
5104 } // namespace internal | 5117 } // namespace internal |
5105 } // namespace v8 | 5118 } // namespace v8 |
OLD | NEW |