| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 V(Constant) \ | 104 V(Constant) \ |
| 105 V(Context) \ | 105 V(Context) \ |
| 106 V(DebugBreak) \ | 106 V(DebugBreak) \ |
| 107 V(DeclareGlobals) \ | 107 V(DeclareGlobals) \ |
| 108 V(DeleteProperty) \ | 108 V(DeleteProperty) \ |
| 109 V(Deoptimize) \ | 109 V(Deoptimize) \ |
| 110 V(Div) \ | 110 V(Div) \ |
| 111 V(DummyUse) \ | 111 V(DummyUse) \ |
| 112 V(ElementsKind) \ | 112 V(ElementsKind) \ |
| 113 V(EnterInlined) \ | 113 V(EnterInlined) \ |
| 114 V(EnvironmentBind) \ |
| 115 V(EnvironmentLookup) \ |
| 114 V(FixedArrayBaseLength) \ | 116 V(FixedArrayBaseLength) \ |
| 115 V(ForceRepresentation) \ | 117 V(ForceRepresentation) \ |
| 116 V(FunctionLiteral) \ | 118 V(FunctionLiteral) \ |
| 117 V(GetCachedArrayIndex) \ | 119 V(GetCachedArrayIndex) \ |
| 118 V(GlobalObject) \ | 120 V(GlobalObject) \ |
| 119 V(GlobalReceiver) \ | 121 V(GlobalReceiver) \ |
| 120 V(Goto) \ | 122 V(Goto) \ |
| 121 V(HasCachedArrayIndexAndBranch) \ | 123 V(HasCachedArrayIndexAndBranch) \ |
| 122 V(HasInstanceTypeAndBranch) \ | 124 V(HasInstanceTypeAndBranch) \ |
| 123 V(InductionVariableAnnotation) \ | 125 V(InductionVariableAnnotation) \ |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 virtual Representation RequiredInputRepresentation(int index) { | 1400 virtual Representation RequiredInputRepresentation(int index) { |
| 1399 return Representation::None(); | 1401 return Representation::None(); |
| 1400 } | 1402 } |
| 1401 | 1403 |
| 1402 virtual void PrintDataTo(StringStream* stream); | 1404 virtual void PrintDataTo(StringStream* stream); |
| 1403 | 1405 |
| 1404 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1406 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
| 1405 }; | 1407 }; |
| 1406 | 1408 |
| 1407 | 1409 |
| 1410 class HEnvironmentBind: public HTemplateInstruction<1> { |
| 1411 public: |
| 1412 explicit HEnvironmentBind(int index) |
| 1413 : index_(index) { } |
| 1414 |
| 1415 int index() { return index_; } |
| 1416 |
| 1417 virtual Representation RequiredInputRepresentation(int index) { |
| 1418 return Representation::None(); |
| 1419 } |
| 1420 |
| 1421 virtual void PrintDataTo(StringStream* stream); |
| 1422 |
| 1423 #ifdef DEBUG |
| 1424 void set_closure(Handle<JSFunction> closure) { |
| 1425 ASSERT(closure_.is_null()); |
| 1426 ASSERT(!closure.is_null()); |
| 1427 closure_ = closure; |
| 1428 } |
| 1429 Handle<JSFunction> closure() const { return closure_; } |
| 1430 #endif |
| 1431 |
| 1432 DECLARE_CONCRETE_INSTRUCTION(EnvironmentBind); |
| 1433 |
| 1434 private: |
| 1435 int index_; |
| 1436 |
| 1437 #ifdef DEBUG |
| 1438 Handle<JSFunction> closure_; |
| 1439 #endif |
| 1440 }; |
| 1441 |
| 1442 |
| 1443 class HEnvironmentLookup: public HTemplateInstruction<1> { |
| 1444 public: |
| 1445 explicit HEnvironmentLookup(int index) |
| 1446 : index_(index) { } |
| 1447 |
| 1448 int index() { return index_; } |
| 1449 |
| 1450 virtual Representation RequiredInputRepresentation(int index) { |
| 1451 return Representation::None(); |
| 1452 } |
| 1453 |
| 1454 virtual void PrintDataTo(StringStream* stream); |
| 1455 |
| 1456 #ifdef DEBUG |
| 1457 void set_closure(Handle<JSFunction> closure) { |
| 1458 ASSERT(closure_.is_null()); |
| 1459 ASSERT(!closure.is_null()); |
| 1460 closure_ = closure; |
| 1461 } |
| 1462 Handle<JSFunction> closure() const { return closure_; } |
| 1463 #endif |
| 1464 |
| 1465 DECLARE_CONCRETE_INSTRUCTION(EnvironmentLookup); |
| 1466 |
| 1467 private: |
| 1468 int index_; |
| 1469 |
| 1470 #ifdef DEBUG |
| 1471 Handle<JSFunction> closure_; |
| 1472 #endif |
| 1473 }; |
| 1474 |
| 1475 |
| 1408 class HNumericConstraint : public HTemplateInstruction<2> { | 1476 class HNumericConstraint : public HTemplateInstruction<2> { |
| 1409 public: | 1477 public: |
| 1410 static HNumericConstraint* AddToGraph(HValue* constrained_value, | 1478 static HNumericConstraint* AddToGraph(HValue* constrained_value, |
| 1411 NumericRelation relation, | 1479 NumericRelation relation, |
| 1412 HValue* related_value, | 1480 HValue* related_value, |
| 1413 HInstruction* insertion_point = NULL); | 1481 HInstruction* insertion_point = NULL); |
| 1414 | 1482 |
| 1415 HValue* constrained_value() { return OperandAt(0); } | 1483 HValue* constrained_value() { return OperandAt(0); } |
| 1416 HValue* related_value() { return OperandAt(1); } | 1484 HValue* related_value() { return OperandAt(1); } |
| 1417 NumericRelation relation() { return relation_; } | 1485 NumericRelation relation() { return relation_; } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 virtual Representation RequiredInputRepresentation(int index) { | 1538 virtual Representation RequiredInputRepresentation(int index) { |
| 1471 return Representation::None(); | 1539 return Representation::None(); |
| 1472 } | 1540 } |
| 1473 | 1541 |
| 1474 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1542 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
| 1475 }; | 1543 }; |
| 1476 | 1544 |
| 1477 | 1545 |
| 1478 class HDeoptimize: public HControlInstruction { | 1546 class HDeoptimize: public HControlInstruction { |
| 1479 public: | 1547 public: |
| 1480 HDeoptimize(int environment_length, Zone* zone) | 1548 HDeoptimize(int environment_length, |
| 1481 : values_(environment_length, zone) { } | 1549 int first_local_index, |
| 1550 int first_expression_index, |
| 1551 Zone* zone) |
| 1552 : values_(environment_length, zone), |
| 1553 first_local_index_(first_local_index), |
| 1554 first_expression_index_(first_expression_index) { } |
| 1482 | 1555 |
| 1483 virtual Representation RequiredInputRepresentation(int index) { | 1556 virtual Representation RequiredInputRepresentation(int index) { |
| 1484 return Representation::None(); | 1557 return Representation::None(); |
| 1485 } | 1558 } |
| 1486 | 1559 |
| 1487 virtual int OperandCount() { return values_.length(); } | 1560 virtual int OperandCount() { return values_.length(); } |
| 1488 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1561 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 1489 virtual void PrintDataTo(StringStream* stream); | 1562 virtual void PrintDataTo(StringStream* stream); |
| 1490 | 1563 |
| 1491 virtual int SuccessorCount() { return 0; } | 1564 virtual int SuccessorCount() { return 0; } |
| 1492 virtual HBasicBlock* SuccessorAt(int i) { | 1565 virtual HBasicBlock* SuccessorAt(int i) { |
| 1493 UNREACHABLE(); | 1566 UNREACHABLE(); |
| 1494 return NULL; | 1567 return NULL; |
| 1495 } | 1568 } |
| 1496 virtual void SetSuccessorAt(int i, HBasicBlock* block) { | 1569 virtual void SetSuccessorAt(int i, HBasicBlock* block) { |
| 1497 UNREACHABLE(); | 1570 UNREACHABLE(); |
| 1498 } | 1571 } |
| 1499 | 1572 |
| 1500 void AddEnvironmentValue(HValue* value, Zone* zone) { | 1573 void AddEnvironmentValue(HValue* value, Zone* zone) { |
| 1501 values_.Add(NULL, zone); | 1574 values_.Add(NULL, zone); |
| 1502 SetOperandAt(values_.length() - 1, value); | 1575 SetOperandAt(values_.length() - 1, value); |
| 1503 } | 1576 } |
| 1577 int first_local_index() { return first_local_index_; } |
| 1578 int first_expression_index() { return first_expression_index_; } |
| 1504 | 1579 |
| 1505 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1580 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 1506 | 1581 |
| 1507 enum UseEnvironment { | 1582 enum UseEnvironment { |
| 1508 kNoUses, | 1583 kNoUses, |
| 1509 kUseAll | 1584 kUseAll |
| 1510 }; | 1585 }; |
| 1511 | 1586 |
| 1512 protected: | 1587 protected: |
| 1513 virtual void InternalSetOperandAt(int index, HValue* value) { | 1588 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 1514 values_[index] = value; | 1589 values_[index] = value; |
| 1515 } | 1590 } |
| 1516 | 1591 |
| 1517 private: | 1592 private: |
| 1518 ZoneList<HValue*> values_; | 1593 ZoneList<HValue*> values_; |
| 1594 int first_local_index_; |
| 1595 int first_expression_index_; |
| 1519 }; | 1596 }; |
| 1520 | 1597 |
| 1521 | 1598 |
| 1522 class HGoto: public HTemplateControlInstruction<1, 0> { | 1599 class HGoto: public HTemplateControlInstruction<1, 0> { |
| 1523 public: | 1600 public: |
| 1524 explicit HGoto(HBasicBlock* target) { | 1601 explicit HGoto(HBasicBlock* target) { |
| 1525 SetSuccessorAt(0, target); | 1602 SetSuccessorAt(0, target); |
| 1526 } | 1603 } |
| 1527 | 1604 |
| 1528 virtual Representation RequiredInputRepresentation(int index) { | 1605 virtual Representation RequiredInputRepresentation(int index) { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 } | 1897 } |
| 1821 bool HasAssignedIndexAt(int index) const { | 1898 bool HasAssignedIndexAt(int index) const { |
| 1822 return assigned_indexes_[index] != kNoIndex; | 1899 return assigned_indexes_[index] != kNoIndex; |
| 1823 } | 1900 } |
| 1824 void AddAssignedValue(int index, HValue* value) { | 1901 void AddAssignedValue(int index, HValue* value) { |
| 1825 AddValue(index, value); | 1902 AddValue(index, value); |
| 1826 } | 1903 } |
| 1827 void AddPushedValue(HValue* value) { | 1904 void AddPushedValue(HValue* value) { |
| 1828 AddValue(kNoIndex, value); | 1905 AddValue(kNoIndex, value); |
| 1829 } | 1906 } |
| 1907 int ToOperandIndex(int environment_index) { |
| 1908 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
| 1909 if (assigned_indexes_[i] == environment_index) return i; |
| 1910 } |
| 1911 return -1; |
| 1912 } |
| 1830 virtual int OperandCount() { return values_.length(); } | 1913 virtual int OperandCount() { return values_.length(); } |
| 1831 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1914 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 1832 | 1915 |
| 1833 virtual Representation RequiredInputRepresentation(int index) { | 1916 virtual Representation RequiredInputRepresentation(int index) { |
| 1834 return Representation::None(); | 1917 return Representation::None(); |
| 1835 } | 1918 } |
| 1836 | 1919 |
| 1837 void MergeWith(ZoneList<HSimulate*>* list); | 1920 void MergeWith(ZoneList<HSimulate*>* list); |
| 1838 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } | 1921 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } |
| 1839 | 1922 |
| 1840 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1923 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
| 1841 | 1924 |
| 1842 #ifdef DEBUG | 1925 #ifdef DEBUG |
| 1843 virtual void Verify(); | 1926 virtual void Verify(); |
| 1927 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } |
| 1928 Handle<JSFunction> closure() const { return closure_; } |
| 1844 #endif | 1929 #endif |
| 1845 | 1930 |
| 1846 protected: | 1931 protected: |
| 1847 virtual void InternalSetOperandAt(int index, HValue* value) { | 1932 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 1848 values_[index] = value; | 1933 values_[index] = value; |
| 1849 } | 1934 } |
| 1850 | 1935 |
| 1851 private: | 1936 private: |
| 1852 static const int kNoIndex = -1; | 1937 static const int kNoIndex = -1; |
| 1853 void AddValue(int index, HValue* value) { | 1938 void AddValue(int index, HValue* value) { |
| 1854 assigned_indexes_.Add(index, zone_); | 1939 assigned_indexes_.Add(index, zone_); |
| 1855 // Resize the list of pushed values. | 1940 // Resize the list of pushed values. |
| 1856 values_.Add(NULL, zone_); | 1941 values_.Add(NULL, zone_); |
| 1857 // Set the operand through the base method in HValue to make sure that the | 1942 // Set the operand through the base method in HValue to make sure that the |
| 1858 // use lists are correctly updated. | 1943 // use lists are correctly updated. |
| 1859 SetOperandAt(values_.length() - 1, value); | 1944 SetOperandAt(values_.length() - 1, value); |
| 1860 } | 1945 } |
| 1861 BailoutId ast_id_; | 1946 BailoutId ast_id_; |
| 1862 int pop_count_; | 1947 int pop_count_; |
| 1863 ZoneList<HValue*> values_; | 1948 ZoneList<HValue*> values_; |
| 1864 ZoneList<int> assigned_indexes_; | 1949 ZoneList<int> assigned_indexes_; |
| 1865 Zone* zone_; | 1950 Zone* zone_; |
| 1866 RemovableSimulate removable_; | 1951 RemovableSimulate removable_; |
| 1952 |
| 1953 #ifdef DEBUG |
| 1954 Handle<JSFunction> closure_; |
| 1955 #endif |
| 1867 }; | 1956 }; |
| 1868 | 1957 |
| 1869 | 1958 |
| 1870 class HStackCheck: public HTemplateInstruction<1> { | 1959 class HStackCheck: public HTemplateInstruction<1> { |
| 1871 public: | 1960 public: |
| 1872 enum Type { | 1961 enum Type { |
| 1873 kFunctionEntry, | 1962 kFunctionEntry, |
| 1874 kBackwardsBranch | 1963 kBackwardsBranch |
| 1875 }; | 1964 }; |
| 1876 | 1965 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 2002 |
| 1914 | 2003 |
| 1915 class HEnterInlined: public HTemplateInstruction<0> { | 2004 class HEnterInlined: public HTemplateInstruction<0> { |
| 1916 public: | 2005 public: |
| 1917 HEnterInlined(Handle<JSFunction> closure, | 2006 HEnterInlined(Handle<JSFunction> closure, |
| 1918 int arguments_count, | 2007 int arguments_count, |
| 1919 FunctionLiteral* function, | 2008 FunctionLiteral* function, |
| 1920 InliningKind inlining_kind, | 2009 InliningKind inlining_kind, |
| 1921 Variable* arguments_var, | 2010 Variable* arguments_var, |
| 1922 ZoneList<HValue*>* arguments_values, | 2011 ZoneList<HValue*>* arguments_values, |
| 1923 bool undefined_receiver) | 2012 bool undefined_receiver, |
| 2013 Zone* zone) |
| 1924 : closure_(closure), | 2014 : closure_(closure), |
| 1925 arguments_count_(arguments_count), | 2015 arguments_count_(arguments_count), |
| 1926 arguments_pushed_(false), | 2016 arguments_pushed_(false), |
| 1927 function_(function), | 2017 function_(function), |
| 1928 inlining_kind_(inlining_kind), | 2018 inlining_kind_(inlining_kind), |
| 1929 arguments_var_(arguments_var), | 2019 arguments_var_(arguments_var), |
| 1930 arguments_values_(arguments_values), | 2020 arguments_values_(arguments_values), |
| 1931 undefined_receiver_(undefined_receiver) { | 2021 undefined_receiver_(undefined_receiver), |
| 2022 return_targets_(2, zone) { |
| 1932 } | 2023 } |
| 1933 | 2024 |
| 2025 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
| 2026 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
| 2027 |
| 1934 virtual void PrintDataTo(StringStream* stream); | 2028 virtual void PrintDataTo(StringStream* stream); |
| 1935 | 2029 |
| 1936 Handle<JSFunction> closure() const { return closure_; } | 2030 Handle<JSFunction> closure() const { return closure_; } |
| 1937 int arguments_count() const { return arguments_count_; } | 2031 int arguments_count() const { return arguments_count_; } |
| 1938 bool arguments_pushed() const { return arguments_pushed_; } | 2032 bool arguments_pushed() const { return arguments_pushed_; } |
| 1939 void set_arguments_pushed() { arguments_pushed_ = true; } | 2033 void set_arguments_pushed() { arguments_pushed_ = true; } |
| 1940 FunctionLiteral* function() const { return function_; } | 2034 FunctionLiteral* function() const { return function_; } |
| 1941 InliningKind inlining_kind() const { return inlining_kind_; } | 2035 InliningKind inlining_kind() const { return inlining_kind_; } |
| 1942 bool undefined_receiver() const { return undefined_receiver_; } | 2036 bool undefined_receiver() const { return undefined_receiver_; } |
| 1943 | 2037 |
| 1944 virtual Representation RequiredInputRepresentation(int index) { | 2038 virtual Representation RequiredInputRepresentation(int index) { |
| 1945 return Representation::None(); | 2039 return Representation::None(); |
| 1946 } | 2040 } |
| 1947 | 2041 |
| 1948 Variable* arguments_var() { return arguments_var_; } | 2042 Variable* arguments_var() { return arguments_var_; } |
| 1949 ZoneList<HValue*>* arguments_values() { return arguments_values_; } | 2043 ZoneList<HValue*>* arguments_values() { return arguments_values_; } |
| 1950 | 2044 |
| 1951 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 2045 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
| 1952 | 2046 |
| 1953 private: | 2047 private: |
| 1954 Handle<JSFunction> closure_; | 2048 Handle<JSFunction> closure_; |
| 1955 int arguments_count_; | 2049 int arguments_count_; |
| 1956 bool arguments_pushed_; | 2050 bool arguments_pushed_; |
| 1957 FunctionLiteral* function_; | 2051 FunctionLiteral* function_; |
| 1958 InliningKind inlining_kind_; | 2052 InliningKind inlining_kind_; |
| 1959 Variable* arguments_var_; | 2053 Variable* arguments_var_; |
| 1960 ZoneList<HValue*>* arguments_values_; | 2054 ZoneList<HValue*>* arguments_values_; |
| 1961 bool undefined_receiver_; | 2055 bool undefined_receiver_; |
| 2056 ZoneList<HBasicBlock*> return_targets_; |
| 1962 }; | 2057 }; |
| 1963 | 2058 |
| 1964 | 2059 |
| 1965 class HLeaveInlined: public HTemplateInstruction<0> { | 2060 class HLeaveInlined: public HTemplateInstruction<0> { |
| 1966 public: | 2061 public: |
| 1967 HLeaveInlined() { } | 2062 HLeaveInlined() { } |
| 1968 | 2063 |
| 1969 virtual Representation RequiredInputRepresentation(int index) { | 2064 virtual Representation RequiredInputRepresentation(int index) { |
| 1970 return Representation::None(); | 2065 return Representation::None(); |
| 1971 } | 2066 } |
| (...skipping 4489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6461 virtual bool IsDeletable() const { return true; } | 6556 virtual bool IsDeletable() const { return true; } |
| 6462 }; | 6557 }; |
| 6463 | 6558 |
| 6464 | 6559 |
| 6465 #undef DECLARE_INSTRUCTION | 6560 #undef DECLARE_INSTRUCTION |
| 6466 #undef DECLARE_CONCRETE_INSTRUCTION | 6561 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6467 | 6562 |
| 6468 } } // namespace v8::internal | 6563 } } // namespace v8::internal |
| 6469 | 6564 |
| 6470 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6565 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |