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

Side by Side Diff: src/js/i18n.js

Issue 2313073002: [builtins] Migrate Number predicates and make them optimizable. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/js/collection.js ('k') | src/js/prologue.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 var FLAG_intl_extra; 22 var FLAG_intl_extra;
23 var GlobalDate = global.Date; 23 var GlobalDate = global.Date;
24 var GlobalNumber = global.Number; 24 var GlobalNumber = global.Number;
25 var GlobalRegExp = global.RegExp; 25 var GlobalRegExp = global.RegExp;
26 var GlobalString = global.String; 26 var GlobalString = global.String;
27 var InstallFunctions = utils.InstallFunctions; 27 var InstallFunctions = utils.InstallFunctions;
28 var InstallGetter = utils.InstallGetter; 28 var InstallGetter = utils.InstallGetter;
29 var InternalArray = utils.InternalArray; 29 var InternalArray = utils.InternalArray;
30 var InternalRegExpMatch; 30 var InternalRegExpMatch;
31 var InternalRegExpReplace 31 var InternalRegExpReplace
32 var IsNaN;
33 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); 32 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty");
34 var OverrideFunction = utils.OverrideFunction; 33 var OverrideFunction = utils.OverrideFunction;
35 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); 34 var patternSymbol = utils.ImportNow("intl_pattern_symbol");
36 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); 35 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol");
37 var SetFunctionName = utils.SetFunctionName; 36 var SetFunctionName = utils.SetFunctionName;
38 var StringIndexOf; 37 var StringIndexOf;
39 var StringLastIndexOf; 38 var StringLastIndexOf;
40 var StringSubstr; 39 var StringSubstr;
41 var StringSubstring; 40 var StringSubstring;
42 41
43 utils.Import(function(from) { 42 utils.Import(function(from) {
44 ArrayJoin = from.ArrayJoin; 43 ArrayJoin = from.ArrayJoin;
45 ArrayPush = from.ArrayPush; 44 ArrayPush = from.ArrayPush;
46 IsNaN = from.IsNaN;
47 InternalRegExpMatch = from.InternalRegExpMatch; 45 InternalRegExpMatch = from.InternalRegExpMatch;
48 InternalRegExpReplace = from.InternalRegExpReplace; 46 InternalRegExpReplace = from.InternalRegExpReplace;
49 StringIndexOf = from.StringIndexOf; 47 StringIndexOf = from.StringIndexOf;
50 StringLastIndexOf = from.StringLastIndexOf; 48 StringLastIndexOf = from.StringLastIndexOf;
51 StringSubstr = from.StringSubstr; 49 StringSubstr = from.StringSubstr;
52 StringSubstring = from.StringSubstring; 50 StringSubstring = from.StringSubstring;
53 }); 51 });
54 52
55 utils.ImportFromExperimental(function(from) { 53 utils.ImportFromExperimental(function(from) {
56 FLAG_intl_extra = from.FLAG_intl_extra; 54 FLAG_intl_extra = from.FLAG_intl_extra;
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 2218
2221 2219
2222 /** 2220 /**
2223 * Returns actual formatted date or fails if date parameter is invalid. 2221 * Returns actual formatted date or fails if date parameter is invalid.
2224 */ 2222 */
2225 function toLocaleDateTime(date, locales, options, required, defaults, service) { 2223 function toLocaleDateTime(date, locales, options, required, defaults, service) {
2226 if (!(date instanceof GlobalDate)) { 2224 if (!(date instanceof GlobalDate)) {
2227 throw %make_type_error(kMethodInvokedOnWrongType, "Date"); 2225 throw %make_type_error(kMethodInvokedOnWrongType, "Date");
2228 } 2226 }
2229 2227
2230 if (IsNaN(date)) return 'Invalid Date'; 2228 var dateValue = TO_NUMBER(date);
2229 if (NUMBER_IS_NAN(dateValue)) return 'Invalid Date';
2231 2230
2232 var internalOptions = toDateTimeOptions(options, required, defaults); 2231 var internalOptions = toDateTimeOptions(options, required, defaults);
2233 2232
2234 var dateFormat = 2233 var dateFormat =
2235 cachedOrNewService(service, locales, options, internalOptions); 2234 cachedOrNewService(service, locales, options, internalOptions);
2236 2235
2237 return formatDate(dateFormat, date); 2236 return formatDate(dateFormat, date);
2238 } 2237 }
2239 2238
2240 2239
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 } 2290 }
2292 ); 2291 );
2293 2292
2294 utils.Export(function(to) { 2293 utils.Export(function(to) {
2295 to.AddBoundMethod = AddBoundMethod; 2294 to.AddBoundMethod = AddBoundMethod;
2296 to.IntlParseDate = IntlParseDate; 2295 to.IntlParseDate = IntlParseDate;
2297 to.IntlParseNumber = IntlParseNumber; 2296 to.IntlParseNumber = IntlParseNumber;
2298 }); 2297 });
2299 2298
2300 }) 2299 })
OLDNEW
« no previous file with comments | « src/js/collection.js ('k') | src/js/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698