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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 SimpleInstallFunction(prototype, "trimLeft", | 1717 SimpleInstallFunction(prototype, "trimLeft", |
1718 Builtins::kStringPrototypeTrimLeft, 0, false); | 1718 Builtins::kStringPrototypeTrimLeft, 0, false); |
1719 SimpleInstallFunction(prototype, "trimRight", | 1719 SimpleInstallFunction(prototype, "trimRight", |
1720 Builtins::kStringPrototypeTrimRight, 0, false); | 1720 Builtins::kStringPrototypeTrimRight, 0, false); |
1721 SimpleInstallFunction(prototype, "toLocaleLowerCase", | 1721 SimpleInstallFunction(prototype, "toLocaleLowerCase", |
1722 Builtins::kStringPrototypeToLocaleLowerCase, 0, | 1722 Builtins::kStringPrototypeToLocaleLowerCase, 0, |
1723 false); | 1723 false); |
1724 SimpleInstallFunction(prototype, "toLocaleUpperCase", | 1724 SimpleInstallFunction(prototype, "toLocaleUpperCase", |
1725 Builtins::kStringPrototypeToLocaleUpperCase, 0, | 1725 Builtins::kStringPrototypeToLocaleUpperCase, 0, |
1726 false); | 1726 false); |
1727 SimpleInstallFunction(prototype, "toLowerCase", | 1727 |
1728 Builtins::kStringPrototypeToLowerCase, 0, false); | |
1729 SimpleInstallFunction(prototype, "toUpperCase", | |
1730 Builtins::kStringPrototypeToUpperCase, 0, false); | |
1731 SimpleInstallFunction(prototype, "valueOf", | 1728 SimpleInstallFunction(prototype, "valueOf", |
1732 Builtins::kStringPrototypeValueOf, 0, true); | 1729 Builtins::kStringPrototypeValueOf, 0, true); |
1733 | 1730 |
1734 Handle<JSFunction> iterator = SimpleCreateFunction( | 1731 Handle<JSFunction> iterator = SimpleCreateFunction( |
1735 isolate, factory->NewStringFromAsciiChecked("[Symbol.iterator]"), | 1732 isolate, factory->NewStringFromAsciiChecked("[Symbol.iterator]"), |
1736 Builtins::kStringPrototypeIterator, 0, true); | 1733 Builtins::kStringPrototypeIterator, 0, true); |
1737 iterator->shared()->set_builtin_function_id(kStringIterator); | 1734 iterator->shared()->set_builtin_function_id(kStringIterator); |
1738 JSObject::AddProperty(prototype, factory->iterator_symbol(), iterator, | 1735 JSObject::AddProperty(prototype, factory->iterator_symbol(), iterator, |
1739 static_cast<PropertyAttributes>(DONT_ENUM)); | 1736 static_cast<PropertyAttributes>(DONT_ENUM)); |
1740 } | 1737 } |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3822 | 3819 |
3823 void SetFunction(Handle<JSObject> target, Handle<JSFunction> function, | 3820 void SetFunction(Handle<JSObject> target, Handle<JSFunction> function, |
3824 Handle<Name> name, PropertyAttributes attributes = DONT_ENUM) { | 3821 Handle<Name> name, PropertyAttributes attributes = DONT_ENUM) { |
3825 JSObject::SetOwnPropertyIgnoreAttributes(target, name, function, attributes) | 3822 JSObject::SetOwnPropertyIgnoreAttributes(target, name, function, attributes) |
3826 .ToHandleChecked(); | 3823 .ToHandleChecked(); |
3827 } | 3824 } |
3828 | 3825 |
3829 } // namespace | 3826 } // namespace |
3830 | 3827 |
3831 void Genesis::InitializeGlobal_icu_case_mapping() { | 3828 void Genesis::InitializeGlobal_icu_case_mapping() { |
3832 if (!FLAG_icu_case_mapping) return; | |
3833 | |
3834 Handle<JSReceiver> exports_container( | |
3835 JSReceiver::cast(native_context()->exports_container())); | |
3836 | |
3837 Handle<JSObject> string_prototype( | 3829 Handle<JSObject> string_prototype( |
3838 JSObject::cast(native_context()->string_function()->prototype())); | 3830 JSObject::cast(native_context()->string_function()->prototype())); |
3839 | 3831 |
3840 Handle<JSFunction> to_lower_case = Handle<JSFunction>::cast( | 3832 if (FLAG_icu_case_mapping) { |
3841 JSReceiver::GetProperty( | 3833 // ICU |
3842 exports_container, | 3834 Handle<JSReceiver> exports_container( |
3843 factory()->InternalizeUtf8String("ToLowerCaseI18N")) | 3835 JSReceiver::cast(native_context()->exports_container())); |
3844 .ToHandleChecked()); | |
3845 SetFunction(string_prototype, to_lower_case, | |
3846 factory()->InternalizeUtf8String("toLowerCase")); | |
3847 | 3836 |
3848 Handle<JSFunction> to_upper_case = Handle<JSFunction>::cast( | 3837 SimpleInstallFunction(string_prototype, "toLowerCase", |
3849 JSReceiver::GetProperty( | 3838 Builtins::kStringPrototypeToLowerCaseI18N, 0, false); |
3850 exports_container, | 3839 SimpleInstallFunction(string_prototype, "toUpperCase", |
3851 factory()->InternalizeUtf8String("ToUpperCaseI18N")) | 3840 Builtins::kStringPrototypeToUpperCaseI18N, 0, false); |
3852 .ToHandleChecked()); | |
3853 SetFunction(string_prototype, to_upper_case, | |
3854 factory()->InternalizeUtf8String("toUpperCase")); | |
3855 | 3841 |
3856 Handle<JSFunction> to_locale_lower_case = Handle<JSFunction>::cast( | 3842 Handle<JSFunction> to_locale_lower_case = Handle<JSFunction>::cast( |
3857 JSReceiver::GetProperty( | 3843 JSReceiver::GetProperty( |
3858 exports_container, | 3844 exports_container, |
3859 factory()->InternalizeUtf8String("ToLocaleLowerCaseI18N")) | 3845 factory()->InternalizeUtf8String("ToLocaleLowerCaseI18N")) |
3860 .ToHandleChecked()); | 3846 .ToHandleChecked()); |
3861 SetFunction(string_prototype, to_locale_lower_case, | 3847 SetFunction(string_prototype, to_locale_lower_case, |
3862 factory()->InternalizeUtf8String("toLocaleLowerCase")); | 3848 factory()->InternalizeUtf8String("toLocaleLowerCase")); |
3863 | 3849 |
3864 Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast( | 3850 Handle<JSFunction> to_locale_upper_case = Handle<JSFunction>::cast( |
3865 JSReceiver::GetProperty( | 3851 JSReceiver::GetProperty( |
3866 exports_container, | 3852 exports_container, |
3867 factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N")) | 3853 factory()->InternalizeUtf8String("ToLocaleUpperCaseI18N")) |
3868 .ToHandleChecked()); | 3854 .ToHandleChecked()); |
3869 SetFunction(string_prototype, to_locale_upper_case, | 3855 SetFunction(string_prototype, to_locale_upper_case, |
3870 factory()->InternalizeUtf8String("toLocaleUpperCase")); | 3856 factory()->InternalizeUtf8String("toLocaleUpperCase")); |
| 3857 |
| 3858 } else { |
| 3859 // Unibrow |
| 3860 SimpleInstallFunction(string_prototype, "toLowerCase", |
| 3861 Builtins::kStringPrototypeToLowerCase, 0, false); |
| 3862 SimpleInstallFunction(string_prototype, "toUpperCase", |
| 3863 Builtins::kStringPrototypeToUpperCase, 0, false); |
| 3864 } |
3871 } | 3865 } |
3872 #endif | 3866 #endif |
3873 | 3867 |
3874 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, | 3868 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, |
3875 const char* name, | 3869 const char* name, |
3876 Builtins::Name call, | 3870 Builtins::Name call, |
3877 BuiltinFunctionId id, | 3871 BuiltinFunctionId id, |
3878 bool is_shared) { | 3872 bool is_shared) { |
3879 // Create the %ArrayBufferPrototype% | 3873 // Create the %ArrayBufferPrototype% |
3880 // Setup the {prototype} with the given {name} for @@toStringTag. | 3874 // Setup the {prototype} with the given {name} for @@toStringTag. |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5103 } | 5097 } |
5104 | 5098 |
5105 | 5099 |
5106 // Called when the top-level V8 mutex is destroyed. | 5100 // Called when the top-level V8 mutex is destroyed. |
5107 void Bootstrapper::FreeThreadResources() { | 5101 void Bootstrapper::FreeThreadResources() { |
5108 DCHECK(!IsActive()); | 5102 DCHECK(!IsActive()); |
5109 } | 5103 } |
5110 | 5104 |
5111 } // namespace internal | 5105 } // namespace internal |
5112 } // namespace v8 | 5106 } // namespace v8 |
OLD | NEW |