| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 // ECMAScript 402 API implementation. | 5 // ECMAScript 402 API implementation. |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Intl object is a single object that has some named properties, | 8 * Intl object is a single object that has some named properties, |
| 9 * all of which are constructors. | 9 * all of which are constructors. |
| 10 */ | 10 */ |
| (...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 if (normalizationForm === -1) { | 2114 if (normalizationForm === -1) { |
| 2115 throw %make_range_error(kNormalizationForm, | 2115 throw %make_range_error(kNormalizationForm, |
| 2116 %_Call(ArrayJoin, NORMALIZATION_FORMS, ', ')); | 2116 %_Call(ArrayJoin, NORMALIZATION_FORMS, ', ')); |
| 2117 } | 2117 } |
| 2118 | 2118 |
| 2119 return %StringNormalize(s, normalizationForm); | 2119 return %StringNormalize(s, normalizationForm); |
| 2120 } | 2120 } |
| 2121 ); | 2121 ); |
| 2122 | 2122 |
| 2123 function ToLowerCaseI18N() { | 2123 function ToLowerCaseI18N() { |
| 2124 if (!IS_UNDEFINED(new.target)) { | |
| 2125 throw %make_type_error(kOrdinaryFunctionCalledAsConstructor); | |
| 2126 } | |
| 2127 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLowerCase"); | 2124 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLowerCase"); |
| 2128 var s = TO_STRING(this); | 2125 return %StringToLowerCaseI18N(TO_STRING(this)); |
| 2129 return %StringToLowerCaseI18N(s); | |
| 2130 } | 2126 } |
| 2131 | 2127 |
| 2132 function ToUpperCaseI18N() { | 2128 function ToUpperCaseI18N() { |
| 2133 if (!IS_UNDEFINED(new.target)) { | |
| 2134 throw %make_type_error(kOrdinaryFunctionCalledAsConstructor); | |
| 2135 } | |
| 2136 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toUpperCase"); | 2129 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toUpperCase"); |
| 2137 var s = TO_STRING(this); | 2130 return %StringToUpperCaseI18N(TO_STRING(this)); |
| 2138 return %StringToUpperCaseI18N(s); | |
| 2139 } | 2131 } |
| 2140 | 2132 |
| 2141 function ToLocaleLowerCaseI18N(locales) { | 2133 function ToLocaleLowerCaseI18N(locales) { |
| 2142 if (!IS_UNDEFINED(new.target)) { | |
| 2143 throw %make_type_error(kOrdinaryFunctionCalledAsConstructor); | |
| 2144 } | |
| 2145 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase"); | 2134 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase"); |
| 2146 return LocaleConvertCase(TO_STRING(this), locales, false); | 2135 return LocaleConvertCase(TO_STRING(this), locales, false); |
| 2147 } | 2136 } |
| 2148 | 2137 |
| 2149 %FunctionSetLength(ToLocaleLowerCaseI18N, 0); | 2138 %FunctionSetLength(ToLocaleLowerCaseI18N, 0); |
| 2150 | 2139 |
| 2151 function ToLocaleUpperCaseI18N(locales) { | 2140 function ToLocaleUpperCaseI18N(locales) { |
| 2152 if (!IS_UNDEFINED(new.target)) { | |
| 2153 throw %make_type_error(kOrdinaryFunctionCalledAsConstructor); | |
| 2154 } | |
| 2155 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); | 2141 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); |
| 2156 return LocaleConvertCase(TO_STRING(this), locales, true); | 2142 return LocaleConvertCase(TO_STRING(this), locales, true); |
| 2157 } | 2143 } |
| 2158 | 2144 |
| 2159 %FunctionSetLength(ToLocaleUpperCaseI18N, 0); | 2145 %FunctionSetLength(ToLocaleUpperCaseI18N, 0); |
| 2160 | 2146 |
| 2161 %FunctionRemovePrototype(ToLowerCaseI18N); | 2147 %FunctionRemovePrototype(ToLowerCaseI18N); |
| 2162 %FunctionRemovePrototype(ToUpperCaseI18N); | 2148 %FunctionRemovePrototype(ToUpperCaseI18N); |
| 2163 %FunctionRemovePrototype(ToLocaleLowerCaseI18N); | 2149 %FunctionRemovePrototype(ToLocaleLowerCaseI18N); |
| 2164 %FunctionRemovePrototype(ToLocaleUpperCaseI18N); | 2150 %FunctionRemovePrototype(ToLocaleUpperCaseI18N); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 } | 2251 } |
| 2266 ); | 2252 ); |
| 2267 | 2253 |
| 2268 %FunctionRemovePrototype(FormatDateToParts); | 2254 %FunctionRemovePrototype(FormatDateToParts); |
| 2269 | 2255 |
| 2270 utils.Export(function(to) { | 2256 utils.Export(function(to) { |
| 2271 to.FormatDateToParts = FormatDateToParts; | 2257 to.FormatDateToParts = FormatDateToParts; |
| 2272 }); | 2258 }); |
| 2273 | 2259 |
| 2274 }) | 2260 }) |
| OLD | NEW |