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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 case kArrayEntries: | 1453 case kArrayEntries: |
1454 case kArrayKeys: | 1454 case kArrayKeys: |
1455 case kArrayValues: | 1455 case kArrayValues: |
1456 case kTypedArrayEntries: | 1456 case kTypedArrayEntries: |
1457 case kTypedArrayKeys: | 1457 case kTypedArrayKeys: |
1458 case kTypedArrayValues: | 1458 case kTypedArrayValues: |
1459 case kArrayIteratorNext: | 1459 case kArrayIteratorNext: |
1460 return Type::OtherObject(); | 1460 return Type::OtherObject(); |
1461 | 1461 |
1462 // Array functions. | 1462 // Array functions. |
| 1463 case kArrayIsArray: |
| 1464 return Type::Boolean(); |
1463 case kArrayConcat: | 1465 case kArrayConcat: |
1464 return Type::Receiver(); | 1466 return Type::Receiver(); |
1465 case kArrayEvery: | 1467 case kArrayEvery: |
1466 return Type::Boolean(); | 1468 return Type::Boolean(); |
1467 case kArrayFill: | 1469 case kArrayFill: |
1468 case kArrayFilter: | 1470 case kArrayFilter: |
1469 return Type::Receiver(); | 1471 return Type::Receiver(); |
1470 case kArrayFindIndex: | 1472 case kArrayFindIndex: |
1471 return Type::Range(-1, kMaxSafeInteger, t->zone()); | 1473 return Type::Range(-1, kMaxSafeInteger, t->zone()); |
1472 case kArrayForEach: | 1474 case kArrayForEach: |
(...skipping 14 matching lines...) Expand all Loading... |
1487 case kArraySlice: | 1489 case kArraySlice: |
1488 return Type::Receiver(); | 1490 return Type::Receiver(); |
1489 case kArraySome: | 1491 case kArraySome: |
1490 return Type::Boolean(); | 1492 return Type::Boolean(); |
1491 case kArraySplice: | 1493 case kArraySplice: |
1492 return Type::Receiver(); | 1494 return Type::Receiver(); |
1493 case kArrayUnshift: | 1495 case kArrayUnshift: |
1494 return t->cache_.kPositiveSafeInteger; | 1496 return t->cache_.kPositiveSafeInteger; |
1495 | 1497 |
1496 // Object functions. | 1498 // Object functions. |
| 1499 case kObjectAssign: |
| 1500 case kObjectCreate: |
| 1501 return Type::OtherObject(); |
1497 case kObjectHasOwnProperty: | 1502 case kObjectHasOwnProperty: |
1498 return Type::Boolean(); | 1503 return Type::Boolean(); |
1499 | 1504 |
1500 // RegExp functions. | 1505 // RegExp functions. |
1501 case kRegExpCompile: | 1506 case kRegExpCompile: |
1502 return Type::OtherObject(); | 1507 return Type::OtherObject(); |
1503 case kRegExpExec: | 1508 case kRegExpExec: |
1504 return Type::Union(Type::OtherObject(), Type::Null(), t->zone()); | 1509 return Type::Union(Type::OtherObject(), Type::Null(), t->zone()); |
1505 case kRegExpTest: | 1510 case kRegExpTest: |
1506 return Type::Boolean(); | 1511 return Type::Boolean(); |
1507 case kRegExpToString: | 1512 case kRegExpToString: |
1508 return Type::String(); | 1513 return Type::String(); |
1509 | 1514 |
1510 // Function functions. | 1515 // Function functions. |
1511 case kFunctionHasInstance: | 1516 case kFunctionHasInstance: |
1512 return Type::Boolean(); | 1517 return Type::Boolean(); |
1513 | 1518 |
1514 // Global functions. | 1519 // Global functions. |
1515 case kGlobalDecodeURI: | 1520 case kGlobalDecodeURI: |
1516 case kGlobalDecodeURIComponent: | 1521 case kGlobalDecodeURIComponent: |
1517 case kGlobalEncodeURI: | 1522 case kGlobalEncodeURI: |
1518 case kGlobalEncodeURIComponent: | 1523 case kGlobalEncodeURIComponent: |
1519 case kGlobalEscape: | 1524 case kGlobalEscape: |
1520 case kGlobalUnescape: | 1525 case kGlobalUnescape: |
1521 return Type::String(); | 1526 return Type::String(); |
1522 case kGlobalIsFinite: | 1527 case kGlobalIsFinite: |
1523 case kGlobalIsNaN: | 1528 case kGlobalIsNaN: |
1524 return Type::Boolean(); | 1529 return Type::Boolean(); |
| 1530 |
| 1531 // Map functions. |
| 1532 case kMapClear: |
| 1533 case kMapForEach: |
| 1534 return Type::Undefined(); |
| 1535 case kMapDelete: |
| 1536 case kMapHas: |
| 1537 return Type::Boolean(); |
| 1538 case kMapEntries: |
| 1539 case kMapKeys: |
| 1540 case kMapSet: |
| 1541 case kMapValues: |
| 1542 return Type::OtherObject(); |
| 1543 |
| 1544 // Set functions. |
| 1545 case kSetAdd: |
| 1546 case kSetEntries: |
| 1547 case kSetKeys: |
| 1548 case kSetValues: |
| 1549 return Type::OtherObject(); |
| 1550 case kSetClear: |
| 1551 case kSetForEach: |
| 1552 return Type::Undefined(); |
| 1553 case kSetDelete: |
| 1554 case kSetHas: |
| 1555 return Type::Boolean(); |
| 1556 |
| 1557 // WeakMap functions. |
| 1558 case kWeakMapDelete: |
| 1559 case kWeakMapHas: |
| 1560 return Type::Boolean(); |
| 1561 case kWeakMapSet: |
| 1562 return Type::OtherObject(); |
| 1563 |
| 1564 // WeakSet functions. |
| 1565 case kWeakSetAdd: |
| 1566 return Type::OtherObject(); |
| 1567 case kWeakSetDelete: |
| 1568 case kWeakSetHas: |
| 1569 return Type::Boolean(); |
1525 default: | 1570 default: |
1526 break; | 1571 break; |
1527 } | 1572 } |
1528 } | 1573 } |
1529 } | 1574 } |
1530 return Type::NonInternal(); | 1575 return Type::NonInternal(); |
1531 } | 1576 } |
1532 | 1577 |
1533 | 1578 |
1534 Type* Typer::Visitor::TypeJSCallFunction(Node* node) { | 1579 Type* Typer::Visitor::TypeJSCallFunction(Node* node) { |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1928 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1884 if (Type::IsInteger(*value)) { | 1929 if (Type::IsInteger(*value)) { |
1885 return Type::Range(value->Number(), value->Number(), zone()); | 1930 return Type::Range(value->Number(), value->Number(), zone()); |
1886 } | 1931 } |
1887 return Type::NewConstant(value, zone()); | 1932 return Type::NewConstant(value, zone()); |
1888 } | 1933 } |
1889 | 1934 |
1890 } // namespace compiler | 1935 } // namespace compiler |
1891 } // namespace internal | 1936 } // namespace internal |
1892 } // namespace v8 | 1937 } // namespace v8 |
OLD | NEW |