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/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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 return Type::Union(Type::Range(0.0, 999.0, t->zone()), Type::NaN(), | 1362 return Type::Union(Type::Range(0.0, 999.0, t->zone()), Type::NaN(), |
1363 t->zone()); | 1363 t->zone()); |
1364 case kDateGetMinutes: | 1364 case kDateGetMinutes: |
1365 return t->cache_.kJSDateMinuteType; | 1365 return t->cache_.kJSDateMinuteType; |
1366 case kDateGetMonth: | 1366 case kDateGetMonth: |
1367 return t->cache_.kJSDateMonthType; | 1367 return t->cache_.kJSDateMonthType; |
1368 case kDateGetSeconds: | 1368 case kDateGetSeconds: |
1369 return t->cache_.kJSDateSecondType; | 1369 return t->cache_.kJSDateSecondType; |
1370 case kDateGetTime: | 1370 case kDateGetTime: |
1371 return t->cache_.kJSDateValueType; | 1371 return t->cache_.kJSDateValueType; |
| 1372 |
1372 // Number functions. | 1373 // Number functions. |
1373 case kNumberIsFinite: | 1374 case kNumberIsFinite: |
1374 case kNumberIsInteger: | 1375 case kNumberIsInteger: |
1375 case kNumberIsNaN: | 1376 case kNumberIsNaN: |
1376 case kNumberIsSafeInteger: | 1377 case kNumberIsSafeInteger: |
1377 return Type::Boolean(); | 1378 return Type::Boolean(); |
1378 case kNumberParseFloat: | 1379 case kNumberParseFloat: |
1379 return Type::Number(); | 1380 return Type::Number(); |
1380 case kNumberParseInt: | 1381 case kNumberParseInt: |
1381 return t->cache_.kIntegerOrMinusZeroOrNaN; | 1382 return t->cache_.kIntegerOrMinusZeroOrNaN; |
1382 case kNumberToString: | 1383 case kNumberToString: |
1383 return Type::String(); | 1384 return Type::String(); |
| 1385 |
1384 // String functions. | 1386 // String functions. |
1385 case kStringCharCodeAt: | 1387 case kStringCharCodeAt: |
1386 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(), | 1388 return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(), |
1387 t->zone()); | 1389 t->zone()); |
1388 case kStringCharAt: | 1390 case kStringCharAt: |
| 1391 return Type::String(); |
| 1392 case kStringCodePointAt: |
| 1393 return Type::Union(Type::Range(0.0, String::kMaxCodePoint, t->zone()), |
| 1394 Type::Undefined(), t->zone()); |
1389 case kStringConcat: | 1395 case kStringConcat: |
1390 case kStringFromCharCode: | 1396 case kStringFromCharCode: |
| 1397 case kStringFromCodePoint: |
| 1398 return Type::String(); |
| 1399 case kStringIndexOf: |
| 1400 case kStringLastIndexOf: |
| 1401 return Type::Range(-1.0, String::kMaxLength - 1.0, t->zone()); |
| 1402 case kStringEndsWith: |
| 1403 case kStringIncludes: |
| 1404 return Type::Boolean(); |
| 1405 case kStringRaw: |
| 1406 case kStringRepeat: |
| 1407 case kStringSlice: |
| 1408 return Type::String(); |
| 1409 case kStringStartsWith: |
| 1410 return Type::Boolean(); |
1391 case kStringSubstr: | 1411 case kStringSubstr: |
| 1412 case kStringSubstring: |
1392 case kStringToLowerCase: | 1413 case kStringToLowerCase: |
| 1414 case kStringToString: |
1393 case kStringToUpperCase: | 1415 case kStringToUpperCase: |
| 1416 case kStringTrim: |
| 1417 case kStringTrimLeft: |
| 1418 case kStringTrimRight: |
| 1419 case kStringValueOf: |
1394 return Type::String(); | 1420 return Type::String(); |
1395 | 1421 |
1396 case kStringIterator: | 1422 case kStringIterator: |
1397 case kStringIteratorNext: | 1423 case kStringIteratorNext: |
1398 return Type::OtherObject(); | 1424 return Type::OtherObject(); |
1399 | 1425 |
1400 case kArrayEntries: | 1426 case kArrayEntries: |
1401 case kArrayKeys: | 1427 case kArrayKeys: |
1402 case kArrayValues: | 1428 case kArrayValues: |
1403 case kTypedArrayEntries: | 1429 case kTypedArrayEntries: |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1803 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1778 if (Type::IsInteger(*value)) { | 1804 if (Type::IsInteger(*value)) { |
1779 return Type::Range(value->Number(), value->Number(), zone()); | 1805 return Type::Range(value->Number(), value->Number(), zone()); |
1780 } | 1806 } |
1781 return Type::NewConstant(value, zone()); | 1807 return Type::NewConstant(value, zone()); |
1782 } | 1808 } |
1783 | 1809 |
1784 } // namespace compiler | 1810 } // namespace compiler |
1785 } // namespace internal | 1811 } // namespace internal |
1786 } // namespace v8 | 1812 } // namespace v8 |
OLD | NEW |