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

Side by Side Diff: src/bootstrapper.cc

Issue 2683083003: [bootstrapper] Remove Intl experimental natives files (Closed)
Patch Set: Changes based on review 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 unified diff | Download patch
« no previous file with comments | « src/bootstrapper.h ('k') | src/contexts.h » ('j') | no next file with comments »
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 3123 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 Handle<Object> utils = isolate()->natives_utils_object(); 3134 Handle<Object> utils = isolate()->natives_utils_object();
3135 Handle<JSObject> global = isolate()->global_object(); 3135 Handle<JSObject> global = isolate()->global_object();
3136 JSObject::AddProperty(global, natives_key, utils, DONT_ENUM); 3136 JSObject::AddProperty(global, natives_key, utils, DONT_ENUM);
3137 break; 3137 break;
3138 } 3138 }
3139 } 3139 }
3140 3140
3141 // The utils object can be removed for cases that reach this point. 3141 // The utils object can be removed for cases that reach this point.
3142 native_context()->set_natives_utils_object(heap()->undefined_value()); 3142 native_context()->set_natives_utils_object(heap()->undefined_value());
3143 native_context()->set_extras_utils_object(heap()->undefined_value()); 3143 native_context()->set_extras_utils_object(heap()->undefined_value());
3144 native_context()->set_exports_container(heap()->undefined_value());
3144 } 3145 }
3145 3146
3146 3147
3147 void Bootstrapper::ExportFromRuntime(Isolate* isolate, 3148 void Bootstrapper::ExportFromRuntime(Isolate* isolate,
3148 Handle<JSObject> container) { 3149 Handle<JSObject> container) {
3149 Factory* factory = isolate->factory(); 3150 Factory* factory = isolate->factory();
3150 HandleScope scope(isolate); 3151 HandleScope scope(isolate);
3151 Handle<Context> native_context = isolate->native_context(); 3152 Handle<Context> native_context = isolate->native_context();
3152 #define EXPORT_PRIVATE_SYMBOL(NAME) \ 3153 #define EXPORT_PRIVATE_SYMBOL(NAME) \
3153 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \ 3154 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 3490 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
3490 3491
3491 Handle<JSFunction> fun; 3492 Handle<JSFunction> fun;
3492 for (const FunctionInfo& info : infos) { 3493 for (const FunctionInfo& info : infos) {
3493 SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs); 3494 SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs);
3494 } 3495 }
3495 3496
3496 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); 3497 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert();
3497 } 3498 }
3498 } 3499 }
3500 isolate->native_context()->set_exports_container(*container);
3499 } 3501 }
3500 3502
3501 3503
3502 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate,
3503 Handle<JSObject> container) {
3504 HandleScope scope(isolate);
3505
3506 #ifdef V8_I18N_SUPPORT
3507 #define INITIALIZE_FLAG(FLAG) \
3508 { \
3509 Handle<String> name = \
3510 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \
3511 JSObject::AddProperty(container, name, \
3512 isolate->factory()->ToBoolean(FLAG), NONE); \
3513 }
3514
3515 #undef INITIALIZE_FLAG
3516 #endif
3517 }
3518
3519
3520 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ 3504 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
3521 void Genesis::InitializeGlobal_##id() {} 3505 void Genesis::InitializeGlobal_##id() {}
3522 3506
3523 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) 3507 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
3524 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) 3508 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind)
3525 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) 3509 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
3526 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) 3510 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
3527 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) 3511 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
3528 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) 3512 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
3529 #ifdef V8_I18N_SUPPORT
3530 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts)
3531 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping)
3532 #endif
3533 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) 3513 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators)
3534 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) 3514 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas)
3535 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) 3515 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
3536 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_rest_spread) 3516 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_rest_spread)
3537 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import) 3517 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
3538 3518
3539 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, 3519 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
3540 const char* name, Handle<Symbol> value) { 3520 const char* name, Handle<Symbol> value) {
3541 Handle<JSGlobalObject> global( 3521 Handle<JSGlobalObject> global(
3542 JSGlobalObject::cast(native_context->global_object())); 3522 JSGlobalObject::cast(native_context->global_object()));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 NONE); 3601 NONE);
3622 } 3602 }
3623 3603
3624 void Genesis::InitializeGlobal_harmony_async_iteration() { 3604 void Genesis::InitializeGlobal_harmony_async_iteration() {
3625 if (!FLAG_harmony_async_iteration) return; 3605 if (!FLAG_harmony_async_iteration) return;
3626 Handle<JSFunction> symbol_fun(native_context()->symbol_function()); 3606 Handle<JSFunction> symbol_fun(native_context()->symbol_function());
3627 InstallConstant(isolate(), symbol_fun, "asyncIterator", 3607 InstallConstant(isolate(), symbol_fun, "asyncIterator",
3628 factory()->async_iterator_symbol()); 3608 factory()->async_iterator_symbol());
3629 } 3609 }
3630 3610
3611 #ifdef V8_I18N_SUPPORT
3612 void Genesis::InitializeGlobal_datetime_format_to_parts() {
3613 if (!FLAG_datetime_format_to_parts) return;
3614 Handle<JSReceiver> exports_container(
3615 JSReceiver::cast(native_context()->exports_container()));
3616 Handle<JSObject> date_time_format_prototype(JSObject::cast(
3617 native_context()->intl_date_time_format_function()->prototype()));
3618 Handle<JSFunction> format_date_to_parts = Handle<JSFunction>::cast(
3619 JSReceiver::GetProperty(
3620 exports_container,
3621 factory()->InternalizeUtf8String("FormatDateToParts"))
3622 .ToHandleChecked());
3623 InstallFunction(date_time_format_prototype, format_date_to_parts,
3624 factory()->InternalizeUtf8String("formatToParts"));
3625 }
3626
3627 namespace {
3628
3629 void SetFunction(Handle<JSObject> target, Handle<JSFunction> function,
3630 Handle<Name> name, PropertyAttributes attributes = DONT_ENUM) {
3631 JSObject::SetOwnPropertyIgnoreAttributes(target, name, function, attributes)
3632 .ToHandleChecked();
3633 }
3634
3635 } // namespace
3636
3637 void Genesis::InitializeGlobal_icu_case_mapping() {
3638 if (!FLAG_icu_case_mapping) return;
3639
3640 Handle<JSReceiver> exports_container(
3641 JSReceiver::cast(native_context()->exports_container()));
3642
3643 Handle<JSObject> string_prototype(
3644 JSObject::cast(native_context()->string_function()->prototype()));
3645
3646 Handle<JSFunction> to_lower_case = Handle<JSFunction>::cast(
3647 JSReceiver::GetProperty(
3648 exports_container,
3649 factory()->InternalizeUtf8String("ToLowerCaseI18N"))
3650 .ToHandleChecked());
3651 SetFunction(string_prototype, to_lower_case,
3652 factory()->InternalizeUtf8String("toLowerCase"));
3653
3654 Handle<JSFunction> to_upper_case = Handle<JSFunction>::cast(
3655 JSReceiver::GetProperty(
3656 exports_container,
3657 factory()->InternalizeUtf8String("ToUpperCaseI18N"))
3658 .ToHandleChecked());
3659 SetFunction(string_prototype, to_upper_case,
3660 factory()->InternalizeUtf8String("toUpperCase"));
3661
3662 Handle<JSFunction> to_locale_lower_case = Handle<JSFunction>::cast(
3663 JSReceiver::GetProperty(
3664 exports_container,
3665 factory()->InternalizeUtf8String("ToLocaleLowerCaseI18N"))
3666 .ToHandleChecked());
3667 SetFunction(string_prototype, to_locale_lower_case,
3668 factory()->InternalizeUtf8String("toLocaleLowerCase"));
3669
3670 Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast(
3671 JSReceiver::GetProperty(
3672 exports_container,
3673 factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N"))
3674 .ToHandleChecked());
3675 SetFunction(string_prototype, to_locale_upper_case,
3676 factory()->InternalizeUtf8String("toLocaleUpperCase"));
3677 }
3678 #endif
3679
3631 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, 3680 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
3632 const char* name, 3681 const char* name,
3633 Builtins::Name call, 3682 Builtins::Name call,
3634 BuiltinFunctionId id) { 3683 BuiltinFunctionId id) {
3635 // Create the %ArrayBufferPrototype% 3684 // Create the %ArrayBufferPrototype%
3636 // Setup the {prototype} with the given {name} for @@toStringTag. 3685 // Setup the {prototype} with the given {name} for @@toStringTag.
3637 Handle<JSObject> prototype = 3686 Handle<JSObject> prototype =
3638 factory()->NewJSObject(isolate()->object_function(), TENURED); 3687 factory()->NewJSObject(isolate()->object_function(), TENURED);
3639 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), 3688 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(),
3640 factory()->NewStringFromAsciiChecked(name), 3689 factory()->NewStringFromAsciiChecked(name),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 static const char* harmony_tailcalls_natives[] = {nullptr}; 4125 static const char* harmony_tailcalls_natives[] = {nullptr};
4077 static const char* harmony_sharedarraybuffer_natives[] = { 4126 static const char* harmony_sharedarraybuffer_natives[] = {
4078 "native harmony-atomics.js", NULL}; 4127 "native harmony-atomics.js", NULL};
4079 static const char* harmony_do_expressions_natives[] = {nullptr}; 4128 static const char* harmony_do_expressions_natives[] = {nullptr};
4080 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; 4129 static const char* harmony_regexp_lookbehind_natives[] = {nullptr};
4081 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; 4130 static const char* harmony_regexp_named_captures_natives[] = {nullptr};
4082 static const char* harmony_regexp_property_natives[] = {nullptr}; 4131 static const char* harmony_regexp_property_natives[] = {nullptr};
4083 static const char* harmony_function_sent_natives[] = {nullptr}; 4132 static const char* harmony_function_sent_natives[] = {nullptr};
4084 static const char* harmony_array_prototype_values_natives[] = {nullptr}; 4133 static const char* harmony_array_prototype_values_natives[] = {nullptr};
4085 #ifdef V8_I18N_SUPPORT 4134 #ifdef V8_I18N_SUPPORT
4086 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", 4135 static const char* icu_case_mapping_natives[] = {nullptr};
4087 nullptr}; 4136 static const char* datetime_format_to_parts_natives[] = {nullptr};
4088 static const char* datetime_format_to_parts_natives[] = {
4089 "native datetime-format-to-parts.js", nullptr};
4090 #endif 4137 #endif
4091 static const char* harmony_restrictive_generators_natives[] = {nullptr}; 4138 static const char* harmony_restrictive_generators_natives[] = {nullptr};
4092 static const char* harmony_trailing_commas_natives[] = {nullptr}; 4139 static const char* harmony_trailing_commas_natives[] = {nullptr};
4093 static const char* harmony_class_fields_natives[] = {nullptr}; 4140 static const char* harmony_class_fields_natives[] = {nullptr};
4094 static const char* harmony_object_rest_spread_natives[] = {nullptr}; 4141 static const char* harmony_object_rest_spread_natives[] = {nullptr};
4095 static const char* harmony_async_iteration_natives[] = {nullptr}; 4142 static const char* harmony_async_iteration_natives[] = {nullptr};
4096 static const char* harmony_dynamic_import_natives[] = {nullptr}; 4143 static const char* harmony_dynamic_import_natives[] = {nullptr};
4097 4144
4098 for (int i = ExperimentalNatives::GetDebuggerCount(); 4145 for (int i = ExperimentalNatives::GetDebuggerCount();
4099 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 4146 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 ATOMIC_FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; 4251 ATOMIC_FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)};
4205 4252
4206 for (const BuiltinFunctionIds& builtin : atomic_builtins) { 4253 for (const BuiltinFunctionIds& builtin : atomic_builtins) {
4207 Handle<JSObject> holder = 4254 Handle<JSObject> holder =
4208 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); 4255 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr);
4209 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); 4256 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id);
4210 } 4257 }
4211 } 4258 }
4212 } 4259 }
4213 4260
4214
4215 #undef INSTALL_BUILTIN_ID 4261 #undef INSTALL_BUILTIN_ID
4216 4262
4217 4263
4218 void Genesis::InitializeNormalizedMapCaches() { 4264 void Genesis::InitializeNormalizedMapCaches() {
4219 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate()); 4265 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate());
4220 native_context()->set_normalized_map_cache(*cache); 4266 native_context()->set_normalized_map_cache(*cache);
4221 } 4267 }
4222 4268
4223 4269
4224 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, 4270 bool Bootstrapper::InstallExtensions(Handle<Context> native_context,
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
4843 } 4889 }
4844 4890
4845 4891
4846 // Called when the top-level V8 mutex is destroyed. 4892 // Called when the top-level V8 mutex is destroyed.
4847 void Bootstrapper::FreeThreadResources() { 4893 void Bootstrapper::FreeThreadResources() {
4848 DCHECK(!IsActive()); 4894 DCHECK(!IsActive());
4849 } 4895 }
4850 4896
4851 } // namespace internal 4897 } // namespace internal
4852 } // namespace v8 4898 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698