-
-
Save caitp/5ec98cc73e091ff50a333c87a685e4c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From becdccdc2430cb639c632bffd2159953750f9cb6 Mon Sep 17 00:00:00 2001 | |
From: Caitlin Potter <caitp@igalia.com> | |
Date: Tue, 14 Mar 2017 10:54:08 -0400 | |
Subject: [PATCH] WIP | |
--- | |
src/bootstrapper.cc | 64 +++++++++++++++++++++++++++-------------------------- | |
1 file changed, 33 insertions(+), 31 deletions(-) | |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc | |
index ca8c1d3..8950004 100644 | |
--- a/src/bootstrapper.cc | |
+++ b/src/bootstrapper.cc | |
@@ -1724,7 +1724,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, | |
SimpleInstallFunction(prototype, "toLocaleUpperCase", | |
Builtins::kStringPrototypeToLocaleUpperCase, 0, | |
false); | |
- | |
+ SimpleInstallFunction(prototype, "toLowerCase", | |
+ Builtins::kStringPrototypeToLowerCase, 0, false); | |
+ SimpleInstallFunction(prototype, "toUpperCase", | |
+ Builtins::kStringPrototypeToUpperCase, 0, false); | |
SimpleInstallFunction(prototype, "valueOf", | |
Builtins::kStringPrototypeValueOf, 0, true); | |
@@ -3888,42 +3891,41 @@ void SetFunction(Handle<JSObject> target, Handle<JSFunction> function, | |
} // namespace | |
void Genesis::InitializeGlobal_icu_case_mapping() { | |
+ if (!FLAG_icu_case_mapping) return; | |
Handle<JSObject> string_prototype( | |
JSObject::cast(native_context()->string_function()->prototype())); | |
- if (FLAG_icu_case_mapping) { | |
- // ICU | |
- Handle<JSReceiver> exports_container( | |
- JSReceiver::cast(native_context()->exports_container())); | |
- | |
- SimpleInstallFunction(string_prototype, "toLowerCase", | |
- Builtins::kStringPrototypeToLowerCaseI18N, 0, false); | |
- SimpleInstallFunction(string_prototype, "toUpperCase", | |
- Builtins::kStringPrototypeToUpperCaseI18N, 0, false); | |
+ Handle<JSReceiver> exports_container( | |
+ JSReceiver::cast(native_context()->exports_container())); | |
- 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<String> name = factory()->InternalizeUtf8String("toLowerCase"); | |
+ Handle<JSFunction> func = SimpleCreateFunction( | |
+ isolate(), name, Builtins::kStringPrototypeToLowerCaseI18N, 0, false); | |
+ SetFunction(string_prototype, func, name); | |
+ } | |
+ { | |
+ Handle<String> name = factory()->InternalizeUtf8String("toUpperCase"); | |
+ Handle<JSFunction> func = SimpleCreateFunction( | |
+ isolate(), name, Builtins::kStringPrototypeToUpperCaseI18N, 0, false); | |
+ SetFunction(string_prototype, func, name); | |
+ } | |
- 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")); | |
+ 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")); | |
- } else { | |
- // Unibrow | |
- SimpleInstallFunction(string_prototype, "toLowerCase", | |
- Builtins::kStringPrototypeToLowerCase, 0, false); | |
- SimpleInstallFunction(string_prototype, "toUpperCase", | |
- Builtins::kStringPrototypeToUpperCase, 0, false); | |
- } | |
+ 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 | |
-- | |
2.10.1 (Apple Git-78) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment