Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 8b1c88bf6d0b97e772f2b0285cdbd9b46d796a6f..6944dc8d948cb3b99b990f2ff9c47f96b2fd98b7 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -3141,6 +3141,7 @@ void Genesis::ConfigureUtilsObject(GlobalContextType context_type) { |
// The utils object can be removed for cases that reach this point. |
native_context()->set_natives_utils_object(heap()->undefined_value()); |
native_context()->set_extras_utils_object(heap()->undefined_value()); |
+ native_context()->set_exports_container(heap()->undefined_value()); |
} |
@@ -3496,24 +3497,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, |
Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); |
} |
} |
-} |
- |
- |
-void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, |
- Handle<JSObject> container) { |
- HandleScope scope(isolate); |
- |
-#ifdef V8_I18N_SUPPORT |
-#define INITIALIZE_FLAG(FLAG) \ |
- { \ |
- Handle<String> name = \ |
- isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
- JSObject::AddProperty(container, name, \ |
- isolate->factory()->ToBoolean(FLAG), NONE); \ |
- } |
- |
-#undef INITIALIZE_FLAG |
-#endif |
+ isolate->native_context()->set_exports_container(*container); |
} |
@@ -3526,10 +3510,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
-#ifdef V8_I18N_SUPPORT |
-EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) |
-EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) |
-#endif |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) |
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) |
@@ -3628,6 +3608,75 @@ void Genesis::InitializeGlobal_harmony_async_iteration() { |
factory()->async_iterator_symbol()); |
} |
+#ifdef V8_I18N_SUPPORT |
+void Genesis::InitializeGlobal_datetime_format_to_parts() { |
+ if (!FLAG_datetime_format_to_parts) return; |
+ Handle<JSReceiver> exports_container( |
+ JSReceiver::cast(native_context()->exports_container())); |
+ Handle<JSObject> date_time_format_prototype(JSObject::cast( |
+ native_context()->intl_date_time_format_function()->prototype())); |
+ Handle<JSFunction> format_date_to_parts = Handle<JSFunction>::cast( |
+ JSReceiver::GetProperty( |
+ exports_container, |
+ factory()->InternalizeUtf8String("FormatDateToParts")) |
+ .ToHandleChecked()); |
+ InstallFunction(date_time_format_prototype, format_date_to_parts, |
+ factory()->InternalizeUtf8String("formatToParts")); |
+} |
+ |
+namespace { |
+ |
+void SetFunction(Handle<JSObject> target, Handle<JSFunction> function, |
+ Handle<Name> name, PropertyAttributes attributes = DONT_ENUM) { |
+ JSObject::SetOwnPropertyIgnoreAttributes(target, name, function, attributes) |
+ .ToHandleChecked(); |
+} |
+ |
+} // namespace |
+ |
+void Genesis::InitializeGlobal_icu_case_mapping() { |
+ if (!FLAG_icu_case_mapping) return; |
+ |
+ Handle<JSReceiver> exports_container( |
+ JSReceiver::cast(native_context()->exports_container())); |
+ |
+ Handle<JSObject> string_prototype( |
+ JSObject::cast(native_context()->string_function()->prototype())); |
+ |
+ Handle<JSFunction> to_lower_case = Handle<JSFunction>::cast( |
+ JSReceiver::GetProperty( |
+ exports_container, |
+ factory()->InternalizeUtf8String("ToLowerCaseI18N")) |
+ .ToHandleChecked()); |
+ SetFunction(string_prototype, to_lower_case, |
+ factory()->InternalizeUtf8String("toLowerCase")); |
+ |
+ Handle<JSFunction> to_upper_case = Handle<JSFunction>::cast( |
+ JSReceiver::GetProperty( |
+ exports_container, |
+ factory()->InternalizeUtf8String("ToUpperCaseI18N")) |
+ .ToHandleChecked()); |
+ SetFunction(string_prototype, to_upper_case, |
+ factory()->InternalizeUtf8String("toUpperCase")); |
+ |
+ Handle<JSFunction> to_locale_lower_case = Handle<JSFunction>::cast( |
+ JSReceiver::GetProperty( |
+ exports_container, |
+ factory()->InternalizeUtf8String("ToLocaleLowerCaseI18N")) |
+ .ToHandleChecked()); |
+ SetFunction(string_prototype, to_locale_lower_case, |
+ factory()->InternalizeUtf8String("toLocaleLowerCase")); |
+ |
+ Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast( |
+ JSReceiver::GetProperty( |
+ exports_container, |
+ factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N")) |
+ .ToHandleChecked()); |
+ SetFunction(string_prototype, to_locale_upper_case, |
+ factory()->InternalizeUtf8String("toLocaleUpperCase")); |
+} |
+#endif |
+ |
Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, |
const char* name, |
Builtins::Name call, |
@@ -4083,10 +4132,8 @@ bool Genesis::InstallExperimentalNatives() { |
static const char* harmony_function_sent_natives[] = {nullptr}; |
static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
#ifdef V8_I18N_SUPPORT |
- static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", |
- nullptr}; |
- static const char* datetime_format_to_parts_natives[] = { |
- "native datetime-format-to-parts.js", nullptr}; |
+ static const char* icu_case_mapping_natives[] = {nullptr}; |
+ static const char* datetime_format_to_parts_natives[] = {nullptr}; |
#endif |
static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
static const char* harmony_trailing_commas_natives[] = {nullptr}; |
@@ -4211,7 +4258,6 @@ void Genesis::InstallExperimentalBuiltinFunctionIds() { |
} |
} |
- |
#undef INSTALL_BUILTIN_ID |