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

Unified Diff: src/bootstrapper.cc

Issue 2683083003: [bootstrapper] Remove Intl experimental natives files (Closed)
Patch Set: Fix a couple minor issues 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/bootstrapper.h ('k') | src/contexts.h » ('j') | src/js/prologue.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 915b2e6a694107351fc160cb8d88cd3eb5e9eaaa..940a3eb65124b385e4724820e5058797c46e6b82 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -3496,24 +3496,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);
Yang 2017/02/15 12:40:15 Please clear this context field where we clear uti
Dan Ehrenberg 2017/02/15 16:43:26 Done.
}
@@ -3526,10 +3509,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)
@@ -3660,6 +3639,73 @@ 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<JSObject> exports_container(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<JSObject> exports_container(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"))
Yang 2017/02/15 12:40:15 We could also implement these functions as builtin
Dan Ehrenberg 2017/02/15 16:43:27 Yes, I plan to do that in a follow-on patch, but w
+ .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,
@@ -4116,10 +4162,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};
@@ -4244,7 +4288,6 @@ void Genesis::InstallExperimentalBuiltinFunctionIds() {
}
}
-
#undef INSTALL_BUILTIN_ID
« no previous file with comments | « src/bootstrapper.h ('k') | src/contexts.h » ('j') | src/js/prologue.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698