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 3611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3622 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 3622 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
3623 | 3623 |
3624 Handle<JSFunction> fun; | 3624 Handle<JSFunction> fun; |
3625 for (const FunctionInfo& info : infos) { | 3625 for (const FunctionInfo& info : infos) { |
3626 SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs); | 3626 SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs); |
3627 } | 3627 } |
3628 | 3628 |
3629 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); | 3629 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); |
3630 } | 3630 } |
3631 } | 3631 } |
| 3632 |
| 3633 { // I n t l P l u r a l R u l e s |
| 3634 Handle<JSObject> plural_rules_prototype = |
| 3635 factory->NewJSObject(isolate->object_function(), TENURED); |
| 3636 // Install the @@toStringTag property on the {prototype}. |
| 3637 JSObject::AddProperty( |
| 3638 plural_rules_prototype, factory->to_string_tag_symbol(), |
| 3639 factory->Object_string(), |
| 3640 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 3641 Handle<JSFunction> plural_rules_constructor = InstallFunction( |
| 3642 container, "PluralRules", JS_OBJECT_TYPE, PluralRules::kSize, |
| 3643 plural_rules_prototype, Builtins::kIllegal); |
| 3644 JSObject::AddProperty(plural_rules_prototype, factory->constructor_string(), |
| 3645 plural_rules_constructor, DONT_ENUM); |
| 3646 InstallWithIntrinsicDefaultProto(isolate, plural_rules_constructor, |
| 3647 Context::INTL_PLURAL_RULES_FUNCTION_INDEX); |
| 3648 } |
| 3649 |
3632 isolate->native_context()->set_exports_container(*container); | 3650 isolate->native_context()->set_exports_container(*container); |
3633 } | 3651 } |
3634 | 3652 |
3635 | 3653 |
3636 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 3654 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
3637 void Genesis::InitializeGlobal_##id() {} | 3655 void Genesis::InitializeGlobal_##id() {} |
3638 | 3656 |
3639 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 3657 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
3640 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 3658 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
3641 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) | 3659 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 factory()->InternalizeUtf8String("toLocaleLowerCase")); | 3884 factory()->InternalizeUtf8String("toLocaleLowerCase")); |
3867 | 3885 |
3868 Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast( | 3886 Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast( |
3869 JSReceiver::GetProperty( | 3887 JSReceiver::GetProperty( |
3870 exports_container, | 3888 exports_container, |
3871 factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N")) | 3889 factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N")) |
3872 .ToHandleChecked()); | 3890 .ToHandleChecked()); |
3873 SetFunction(string_prototype, to_locale_upper_case, | 3891 SetFunction(string_prototype, to_locale_upper_case, |
3874 factory()->InternalizeUtf8String("toLocaleUpperCase")); | 3892 factory()->InternalizeUtf8String("toLocaleUpperCase")); |
3875 } | 3893 } |
| 3894 |
| 3895 void Genesis::InitializeGlobal_harmony_plural_rules() { |
| 3896 if (!FLAG_harmony_plural_rules) return; |
| 3897 |
| 3898 Handle<JSReceiver> exports_container( |
| 3899 JSReceiver::cast(native_context()->exports_container())); |
| 3900 Handle<JSFunction> plural_rules( |
| 3901 native_context()->intl_plural_rules_function()); |
| 3902 Handle<JSObject> intl = Handle<JSObject>::cast( |
| 3903 JSReceiver::GetProperty( |
| 3904 Handle<JSReceiver>(native_context()->global_object()), |
| 3905 factory()->InternalizeUtf8String("Intl")) |
| 3906 .ToHandleChecked()); |
| 3907 JSObject::AddProperty(intl, factory()->InternalizeUtf8String("PluralRules"), |
| 3908 plural_rules, DONT_ENUM); |
| 3909 } |
3876 #endif | 3910 #endif |
3877 | 3911 |
3878 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, | 3912 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, |
3879 const char* name, | 3913 const char* name, |
3880 Builtins::Name call, | 3914 Builtins::Name call, |
3881 BuiltinFunctionId id, | 3915 BuiltinFunctionId id, |
3882 bool is_shared) { | 3916 bool is_shared) { |
3883 // Create the %ArrayBufferPrototype% | 3917 // Create the %ArrayBufferPrototype% |
3884 // Setup the {prototype} with the given {name} for @@toStringTag. | 3918 // Setup the {prototype} with the given {name} for @@toStringTag. |
3885 Handle<JSObject> prototype = | 3919 Handle<JSObject> prototype = |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4332 "native harmony-atomics.js", NULL}; | 4366 "native harmony-atomics.js", NULL}; |
4333 static const char* harmony_do_expressions_natives[] = {nullptr}; | 4367 static const char* harmony_do_expressions_natives[] = {nullptr}; |
4334 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 4368 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
4335 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; | 4369 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; |
4336 static const char* harmony_regexp_property_natives[] = {nullptr}; | 4370 static const char* harmony_regexp_property_natives[] = {nullptr}; |
4337 static const char* harmony_function_sent_natives[] = {nullptr}; | 4371 static const char* harmony_function_sent_natives[] = {nullptr}; |
4338 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 4372 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
4339 #ifdef V8_I18N_SUPPORT | 4373 #ifdef V8_I18N_SUPPORT |
4340 static const char* icu_case_mapping_natives[] = {nullptr}; | 4374 static const char* icu_case_mapping_natives[] = {nullptr}; |
4341 static const char* datetime_format_to_parts_natives[] = {nullptr}; | 4375 static const char* datetime_format_to_parts_natives[] = {nullptr}; |
| 4376 static const char* harmony_plural_rules_natives[] = {nullptr}; |
4342 #endif | 4377 #endif |
4343 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | 4378 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
4344 static const char* harmony_trailing_commas_natives[] = {nullptr}; | 4379 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
4345 static const char* harmony_function_tostring_natives[] = {nullptr}; | 4380 static const char* harmony_function_tostring_natives[] = {nullptr}; |
4346 static const char* harmony_class_fields_natives[] = {nullptr}; | 4381 static const char* harmony_class_fields_natives[] = {nullptr}; |
4347 static const char* harmony_object_rest_spread_natives[] = {nullptr}; | 4382 static const char* harmony_object_rest_spread_natives[] = {nullptr}; |
4348 static const char* harmony_async_iteration_natives[] = {nullptr}; | 4383 static const char* harmony_async_iteration_natives[] = {nullptr}; |
4349 static const char* harmony_dynamic_import_natives[] = {nullptr}; | 4384 static const char* harmony_dynamic_import_natives[] = {nullptr}; |
4350 static const char* harmony_promise_finally_natives[] = {nullptr}; | 4385 static const char* harmony_promise_finally_natives[] = {nullptr}; |
4351 static const char* harmony_template_escapes_natives[] = {nullptr}; | 4386 static const char* harmony_template_escapes_natives[] = {nullptr}; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5107 } | 5142 } |
5108 | 5143 |
5109 | 5144 |
5110 // Called when the top-level V8 mutex is destroyed. | 5145 // Called when the top-level V8 mutex is destroyed. |
5111 void Bootstrapper::FreeThreadResources() { | 5146 void Bootstrapper::FreeThreadResources() { |
5112 DCHECK(!IsActive()); | 5147 DCHECK(!IsActive()); |
5113 } | 5148 } |
5114 | 5149 |
5115 } // namespace internal | 5150 } // namespace internal |
5116 } // namespace v8 | 5151 } // namespace v8 |
OLD | NEW |