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

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

Issue 2222053002: [turbofan] Improve typing rules for various builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/bootstrapper.cc ('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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 case kMathRandom: 1285 case kMathRandom:
1286 return Type::OrderedNumber(); 1286 return Type::OrderedNumber();
1287 case kMathFloor: 1287 case kMathFloor:
1288 case kMathCeil: 1288 case kMathCeil:
1289 case kMathRound: 1289 case kMathRound:
1290 case kMathTrunc: 1290 case kMathTrunc:
1291 return t->cache_.kIntegerOrMinusZeroOrNaN; 1291 return t->cache_.kIntegerOrMinusZeroOrNaN;
1292 // Unary math functions. 1292 // Unary math functions.
1293 case kMathAbs: 1293 case kMathAbs:
1294 case kMathExp: 1294 case kMathExp:
1295 case kMathExpm1:
1295 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); 1296 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone());
1296 case kMathLog:
1297 case kMathSqrt:
1298 case kMathCos:
1299 case kMathSin:
1300 case kMathTan:
1301 case kMathAcos: 1297 case kMathAcos:
1302 case kMathAcosh: 1298 case kMathAcosh:
1303 case kMathAsin: 1299 case kMathAsin:
1304 case kMathAsinh: 1300 case kMathAsinh:
1305 case kMathAtan: 1301 case kMathAtan:
1306 case kMathAtanh: 1302 case kMathAtanh:
1303 case kMathCbrt:
1304 case kMathCos:
1307 case kMathFround: 1305 case kMathFround:
1306 case kMathLog:
1307 case kMathLog1p:
1308 case kMathLog10:
1309 case kMathLog2:
1310 case kMathSin:
1311 case kMathSqrt:
1312 case kMathTan:
1313 return Type::Number();
1308 case kMathSign: 1314 case kMathSign:
1309 return Type::Number(); 1315 return t->cache_.kMinusOneToOne;
1310 // Binary math functions. 1316 // Binary math functions.
1311 case kMathAtan2: 1317 case kMathAtan2:
1312 case kMathPow: 1318 case kMathPow:
1313 case kMathMax: 1319 case kMathMax:
1314 case kMathMin: 1320 case kMathMin:
1315 return Type::Number(); 1321 return Type::Number();
1316 case kMathImul: 1322 case kMathImul:
1317 return Type::Signed32(); 1323 return Type::Signed32();
1318 case kMathClz32: 1324 case kMathClz32:
1319 return t->cache_.kZeroToThirtyTwo; 1325 return t->cache_.kZeroToThirtyTwo;
1326 // Number functions.
1327 case kNumberParseInt:
1328 return t->cache_.kIntegerOrMinusZeroOrNaN;
1329 case kNumberToString:
1330 return Type::String();
1320 // String functions. 1331 // String functions.
1321 case kStringCharCodeAt: 1332 case kStringCharCodeAt:
1322 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(), 1333 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(),
1323 t->zone()); 1334 t->zone());
1324 case kStringCharAt: 1335 case kStringCharAt:
1325 case kStringConcat: 1336 case kStringConcat:
1326 case kStringFromCharCode: 1337 case kStringFromCharCode:
1338 case kStringSubstr:
1327 case kStringToLowerCase: 1339 case kStringToLowerCase:
1328 case kStringToUpperCase: 1340 case kStringToUpperCase:
1329 return Type::String(); 1341 return Type::String();
1330 // Array functions. 1342 // Array functions.
1331 case kArrayIndexOf: 1343 case kArrayIndexOf:
1332 case kArrayLastIndexOf: 1344 case kArrayLastIndexOf:
1333 return Type::Number(); 1345 return Type::Range(-1, kMaxSafeInteger, t->zone());
1346 // Object functions.
1347 case kObjectHasOwnProperty:
1348 return Type::Boolean();
1349 // Global functions.
1350 case kGlobalDecodeURI:
1351 case kGlobalDecodeURIComponent:
1352 case kGlobalEncodeURI:
1353 case kGlobalEncodeURIComponent:
1354 case kGlobalEscape:
1355 case kGlobalUnescape:
1356 return Type::String();
1334 default: 1357 default:
1335 break; 1358 break;
1336 } 1359 }
1337 } 1360 }
1338 } 1361 }
1339 return Type::Any(); 1362 return Type::Any();
1340 } 1363 }
1341 1364
1342 1365
1343 Type* Typer::Visitor::TypeJSCallFunction(Node* node) { 1366 Type* Typer::Visitor::TypeJSCallFunction(Node* node) {
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 } 2324 }
2302 if (Type::IsInteger(*value)) { 2325 if (Type::IsInteger(*value)) {
2303 return Type::Range(value->Number(), value->Number(), zone()); 2326 return Type::Range(value->Number(), value->Number(), zone());
2304 } 2327 }
2305 return Type::Constant(value, zone()); 2328 return Type::Constant(value, zone());
2306 } 2329 }
2307 2330
2308 } // namespace compiler 2331 } // namespace compiler
2309 } // namespace internal 2332 } // namespace internal
2310 } // namespace v8 2333 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698