| 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 DECLARE_CONCRETE_INSTRUCTION(EnvironmentBind); |
| 1424 |
| 1425 private: |
| 1426 int index_; |
| 1427 }; |
| 1428 |
| 1429 |
| 1430 class HEnvironmentLookup: public HTemplateInstruction<1> { |
| 1431 public: |
| 1432 explicit HEnvironmentLookup(int index) |
| 1433 : index_(index) { } |
| 1434 |
| 1435 int index() { return index_; } |
| 1436 |
| 1437 virtual Representation RequiredInputRepresentation(int index) { |
| 1438 return Representation::None(); |
| 1439 } |
| 1440 |
| 1441 virtual void PrintDataTo(StringStream* stream); |
| 1442 |
| 1443 DECLARE_CONCRETE_INSTRUCTION(EnvironmentLookup); |
| 1444 |
| 1445 private: |
| 1446 int index_; |
| 1447 }; |
| 1448 |
| 1449 |
| 1408 class HNumericConstraint : public HTemplateInstruction<2> { | 1450 class HNumericConstraint : public HTemplateInstruction<2> { |
| 1409 public: | 1451 public: |
| 1410 static HNumericConstraint* AddToGraph(HValue* constrained_value, | 1452 static HNumericConstraint* AddToGraph(HValue* constrained_value, |
| 1411 NumericRelation relation, | 1453 NumericRelation relation, |
| 1412 HValue* related_value, | 1454 HValue* related_value, |
| 1413 HInstruction* insertion_point = NULL); | 1455 HInstruction* insertion_point = NULL); |
| 1414 | 1456 |
| 1415 HValue* constrained_value() { return OperandAt(0); } | 1457 HValue* constrained_value() { return OperandAt(0); } |
| 1416 HValue* related_value() { return OperandAt(1); } | 1458 HValue* related_value() { return OperandAt(1); } |
| 1417 NumericRelation relation() { return relation_; } | 1459 NumericRelation relation() { return relation_; } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 virtual Representation RequiredInputRepresentation(int index) { | 1512 virtual Representation RequiredInputRepresentation(int index) { |
| 1471 return Representation::None(); | 1513 return Representation::None(); |
| 1472 } | 1514 } |
| 1473 | 1515 |
| 1474 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1516 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
| 1475 }; | 1517 }; |
| 1476 | 1518 |
| 1477 | 1519 |
| 1478 class HDeoptimize: public HControlInstruction { | 1520 class HDeoptimize: public HControlInstruction { |
| 1479 public: | 1521 public: |
| 1480 HDeoptimize(int environment_length, Zone* zone) | 1522 HDeoptimize(int environment_length, |
| 1481 : values_(environment_length, zone) { } | 1523 int first_local_index, |
| 1524 int first_expression_index, |
| 1525 Zone* zone) |
| 1526 : values_(environment_length, zone), |
| 1527 first_local_index_(first_local_index), |
| 1528 first_expression_index_(first_expression_index) { } |
| 1482 | 1529 |
| 1483 virtual Representation RequiredInputRepresentation(int index) { | 1530 virtual Representation RequiredInputRepresentation(int index) { |
| 1484 return Representation::None(); | 1531 return Representation::None(); |
| 1485 } | 1532 } |
| 1486 | 1533 |
| 1487 virtual int OperandCount() { return values_.length(); } | 1534 virtual int OperandCount() { return values_.length(); } |
| 1488 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1535 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 1489 virtual void PrintDataTo(StringStream* stream); | 1536 virtual void PrintDataTo(StringStream* stream); |
| 1490 | 1537 |
| 1491 virtual int SuccessorCount() { return 0; } | 1538 virtual int SuccessorCount() { return 0; } |
| 1492 virtual HBasicBlock* SuccessorAt(int i) { | 1539 virtual HBasicBlock* SuccessorAt(int i) { |
| 1493 UNREACHABLE(); | 1540 UNREACHABLE(); |
| 1494 return NULL; | 1541 return NULL; |
| 1495 } | 1542 } |
| 1496 virtual void SetSuccessorAt(int i, HBasicBlock* block) { | 1543 virtual void SetSuccessorAt(int i, HBasicBlock* block) { |
| 1497 UNREACHABLE(); | 1544 UNREACHABLE(); |
| 1498 } | 1545 } |
| 1499 | 1546 |
| 1500 void AddEnvironmentValue(HValue* value, Zone* zone) { | 1547 void AddEnvironmentValue(HValue* value, Zone* zone) { |
| 1501 values_.Add(NULL, zone); | 1548 values_.Add(NULL, zone); |
| 1502 SetOperandAt(values_.length() - 1, value); | 1549 SetOperandAt(values_.length() - 1, value); |
| 1503 } | 1550 } |
| 1551 int first_local_index() { return first_local_index_; } |
| 1552 int first_expression_index() { return first_expression_index_; } |
| 1504 | 1553 |
| 1505 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1554 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 1506 | 1555 |
| 1507 enum UseEnvironment { | 1556 enum UseEnvironment { |
| 1508 kNoUses, | 1557 kNoUses, |
| 1509 kUseAll | 1558 kUseAll |
| 1510 }; | 1559 }; |
| 1511 | 1560 |
| 1512 protected: | 1561 protected: |
| 1513 virtual void InternalSetOperandAt(int index, HValue* value) { | 1562 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 1514 values_[index] = value; | 1563 values_[index] = value; |
| 1515 } | 1564 } |
| 1516 | 1565 |
| 1517 private: | 1566 private: |
| 1518 ZoneList<HValue*> values_; | 1567 ZoneList<HValue*> values_; |
| 1568 int first_local_index_; |
| 1569 int first_expression_index_; |
| 1519 }; | 1570 }; |
| 1520 | 1571 |
| 1521 | 1572 |
| 1522 class HGoto: public HTemplateControlInstruction<1, 0> { | 1573 class HGoto: public HTemplateControlInstruction<1, 0> { |
| 1523 public: | 1574 public: |
| 1524 explicit HGoto(HBasicBlock* target) { | 1575 explicit HGoto(HBasicBlock* target) { |
| 1525 SetSuccessorAt(0, target); | 1576 SetSuccessorAt(0, target); |
| 1526 } | 1577 } |
| 1527 | 1578 |
| 1528 virtual Representation RequiredInputRepresentation(int index) { | 1579 virtual Representation RequiredInputRepresentation(int index) { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 } | 1871 } |
| 1821 bool HasAssignedIndexAt(int index) const { | 1872 bool HasAssignedIndexAt(int index) const { |
| 1822 return assigned_indexes_[index] != kNoIndex; | 1873 return assigned_indexes_[index] != kNoIndex; |
| 1823 } | 1874 } |
| 1824 void AddAssignedValue(int index, HValue* value) { | 1875 void AddAssignedValue(int index, HValue* value) { |
| 1825 AddValue(index, value); | 1876 AddValue(index, value); |
| 1826 } | 1877 } |
| 1827 void AddPushedValue(HValue* value) { | 1878 void AddPushedValue(HValue* value) { |
| 1828 AddValue(kNoIndex, value); | 1879 AddValue(kNoIndex, value); |
| 1829 } | 1880 } |
| 1881 int ToOperandIndex(int environment_index) { |
| 1882 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
| 1883 if (assigned_indexes_[i] == environment_index) return i; |
| 1884 } |
| 1885 return -1; |
| 1886 } |
| 1830 virtual int OperandCount() { return values_.length(); } | 1887 virtual int OperandCount() { return values_.length(); } |
| 1831 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1888 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 1832 | 1889 |
| 1833 virtual Representation RequiredInputRepresentation(int index) { | 1890 virtual Representation RequiredInputRepresentation(int index) { |
| 1834 return Representation::None(); | 1891 return Representation::None(); |
| 1835 } | 1892 } |
| 1836 | 1893 |
| 1837 void MergeWith(ZoneList<HSimulate*>* list); | 1894 void MergeWith(ZoneList<HSimulate*>* list); |
| 1838 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } | 1895 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } |
| 1839 | 1896 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 1970 |
| 1914 | 1971 |
| 1915 class HEnterInlined: public HTemplateInstruction<0> { | 1972 class HEnterInlined: public HTemplateInstruction<0> { |
| 1916 public: | 1973 public: |
| 1917 HEnterInlined(Handle<JSFunction> closure, | 1974 HEnterInlined(Handle<JSFunction> closure, |
| 1918 int arguments_count, | 1975 int arguments_count, |
| 1919 FunctionLiteral* function, | 1976 FunctionLiteral* function, |
| 1920 InliningKind inlining_kind, | 1977 InliningKind inlining_kind, |
| 1921 Variable* arguments_var, | 1978 Variable* arguments_var, |
| 1922 ZoneList<HValue*>* arguments_values, | 1979 ZoneList<HValue*>* arguments_values, |
| 1923 bool undefined_receiver) | 1980 bool undefined_receiver, |
| 1981 Zone* zone) |
| 1924 : closure_(closure), | 1982 : closure_(closure), |
| 1925 arguments_count_(arguments_count), | 1983 arguments_count_(arguments_count), |
| 1926 arguments_pushed_(false), | 1984 arguments_pushed_(false), |
| 1927 function_(function), | 1985 function_(function), |
| 1928 inlining_kind_(inlining_kind), | 1986 inlining_kind_(inlining_kind), |
| 1929 arguments_var_(arguments_var), | 1987 arguments_var_(arguments_var), |
| 1930 arguments_values_(arguments_values), | 1988 arguments_values_(arguments_values), |
| 1931 undefined_receiver_(undefined_receiver) { | 1989 undefined_receiver_(undefined_receiver), |
| 1990 return_targets_(2, zone) { |
| 1932 } | 1991 } |
| 1933 | 1992 |
| 1993 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
| 1994 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
| 1995 |
| 1934 virtual void PrintDataTo(StringStream* stream); | 1996 virtual void PrintDataTo(StringStream* stream); |
| 1935 | 1997 |
| 1936 Handle<JSFunction> closure() const { return closure_; } | 1998 Handle<JSFunction> closure() const { return closure_; } |
| 1937 int arguments_count() const { return arguments_count_; } | 1999 int arguments_count() const { return arguments_count_; } |
| 1938 bool arguments_pushed() const { return arguments_pushed_; } | 2000 bool arguments_pushed() const { return arguments_pushed_; } |
| 1939 void set_arguments_pushed() { arguments_pushed_ = true; } | 2001 void set_arguments_pushed() { arguments_pushed_ = true; } |
| 1940 FunctionLiteral* function() const { return function_; } | 2002 FunctionLiteral* function() const { return function_; } |
| 1941 InliningKind inlining_kind() const { return inlining_kind_; } | 2003 InliningKind inlining_kind() const { return inlining_kind_; } |
| 1942 bool undefined_receiver() const { return undefined_receiver_; } | 2004 bool undefined_receiver() const { return undefined_receiver_; } |
| 1943 | 2005 |
| 1944 virtual Representation RequiredInputRepresentation(int index) { | 2006 virtual Representation RequiredInputRepresentation(int index) { |
| 1945 return Representation::None(); | 2007 return Representation::None(); |
| 1946 } | 2008 } |
| 1947 | 2009 |
| 1948 Variable* arguments_var() { return arguments_var_; } | 2010 Variable* arguments_var() { return arguments_var_; } |
| 1949 ZoneList<HValue*>* arguments_values() { return arguments_values_; } | 2011 ZoneList<HValue*>* arguments_values() { return arguments_values_; } |
| 1950 | 2012 |
| 1951 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 2013 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
| 1952 | 2014 |
| 1953 private: | 2015 private: |
| 1954 Handle<JSFunction> closure_; | 2016 Handle<JSFunction> closure_; |
| 1955 int arguments_count_; | 2017 int arguments_count_; |
| 1956 bool arguments_pushed_; | 2018 bool arguments_pushed_; |
| 1957 FunctionLiteral* function_; | 2019 FunctionLiteral* function_; |
| 1958 InliningKind inlining_kind_; | 2020 InliningKind inlining_kind_; |
| 1959 Variable* arguments_var_; | 2021 Variable* arguments_var_; |
| 1960 ZoneList<HValue*>* arguments_values_; | 2022 ZoneList<HValue*>* arguments_values_; |
| 1961 bool undefined_receiver_; | 2023 bool undefined_receiver_; |
| 2024 ZoneList<HBasicBlock*> return_targets_; |
| 1962 }; | 2025 }; |
| 1963 | 2026 |
| 1964 | 2027 |
| 1965 class HLeaveInlined: public HTemplateInstruction<0> { | 2028 class HLeaveInlined: public HTemplateInstruction<0> { |
| 1966 public: | 2029 public: |
| 1967 HLeaveInlined() { } | 2030 HLeaveInlined() { } |
| 1968 | 2031 |
| 1969 virtual Representation RequiredInputRepresentation(int index) { | 2032 virtual Representation RequiredInputRepresentation(int index) { |
| 1970 return Representation::None(); | 2033 return Representation::None(); |
| 1971 } | 2034 } |
| (...skipping 4489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6461 virtual bool IsDeletable() const { return true; } | 6524 virtual bool IsDeletable() const { return true; } |
| 6462 }; | 6525 }; |
| 6463 | 6526 |
| 6464 | 6527 |
| 6465 #undef DECLARE_INSTRUCTION | 6528 #undef DECLARE_INSTRUCTION |
| 6466 #undef DECLARE_CONCRETE_INSTRUCTION | 6529 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6467 | 6530 |
| 6468 } } // namespace v8::internal | 6531 } } // namespace v8::internal |
| 6469 | 6532 |
| 6470 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6533 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |