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

Side by Side Diff: src/compiler/typer.cc

Issue 2296593002: [turbofan] Sanitize typing of Date builtins. (Closed)
Patch Set: Fix comment. 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/compiler/type-cache.h ('k') | src/objects.h » ('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 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/compiler/typer.h" 5 #include "src/compiler/typer.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/flags.h" 9 #include "src/base/flags.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 case kMathAtan2: 1329 case kMathAtan2:
1330 case kMathPow: 1330 case kMathPow:
1331 case kMathMax: 1331 case kMathMax:
1332 case kMathMin: 1332 case kMathMin:
1333 return Type::Number(); 1333 return Type::Number();
1334 case kMathImul: 1334 case kMathImul:
1335 return Type::Signed32(); 1335 return Type::Signed32();
1336 case kMathClz32: 1336 case kMathClz32:
1337 return t->cache_.kZeroToThirtyTwo; 1337 return t->cache_.kZeroToThirtyTwo;
1338 // Date functions. 1338 // Date functions.
1339 case kDateGetDate:
1340 return t->cache_.kJSDateDayType;
1341 case kDateGetDay:
1342 return t->cache_.kJSDateWeekdayType;
1339 case kDateGetFullYear: 1343 case kDateGetFullYear:
1340 return Type::Union(Type::Range(-271821.0, 275760.0, t->zone()), 1344 return t->cache_.kJSDateYearType;
1341 Type::NaN(), t->zone()); 1345 case kDateGetHours:
1342 case kDateGetDate: 1346 return t->cache_.kJSDateHourType;
1343 return Type::Union(Type::Range(1.0, 31.0, t->zone()), Type::NaN(), 1347 case kDateGetMilliseconds:
1348 return Type::Union(Type::Range(0.0, 999.0, t->zone()), Type::NaN(),
1344 t->zone()); 1349 t->zone());
1345 case kDateGetHours: 1350 case kDateGetMinutes:
1346 return Type::Union(Type::Range(0.0, 23.0, t->zone()), Type::NaN(), 1351 return t->cache_.kJSDateMinuteType;
1347 t->zone());
1348 case kDateGetMilliseconds:
1349 return Type::Union(Type::Range(0.0, 59.0, t->zone()), Type::NaN(),
1350 t->zone());
1351 case kDateGetMonth: 1352 case kDateGetMonth:
1352 return Type::Union(Type::Range(0.0, 11.0, t->zone()), Type::NaN(), 1353 return t->cache_.kJSDateMonthType;
1353 t->zone());
1354 case kDateGetSeconds: 1354 case kDateGetSeconds:
1355 return Type::Union(Type::Range(0.0, 59.0, t->zone()), Type::NaN(), 1355 return t->cache_.kJSDateSecondType;
1356 t->zone());
1357 case kDateGetTime: 1356 case kDateGetTime:
1358 return t->cache_.kJSDateValueType; 1357 return t->cache_.kJSDateValueType;
1359 // Number functions. 1358 // Number functions.
1360 case kNumberParseInt: 1359 case kNumberParseInt:
1361 return t->cache_.kIntegerOrMinusZeroOrNaN; 1360 return t->cache_.kIntegerOrMinusZeroOrNaN;
1362 case kNumberToString: 1361 case kNumberToString:
1363 return Type::String(); 1362 return Type::String();
1364 // String functions. 1363 // String functions.
1365 case kStringCharCodeAt: 1364 case kStringCharCodeAt:
1366 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(), 1365 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1720 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1722 if (Type::IsInteger(*value)) { 1721 if (Type::IsInteger(*value)) {
1723 return Type::Range(value->Number(), value->Number(), zone()); 1722 return Type::Range(value->Number(), value->Number(), zone());
1724 } 1723 }
1725 return Type::Constant(value, zone()); 1724 return Type::Constant(value, zone());
1726 } 1725 }
1727 1726
1728 } // namespace compiler 1727 } // namespace compiler
1729 } // namespace internal 1728 } // namespace internal
1730 } // namespace v8 1729 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/type-cache.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698