| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 | 1014 |
| 1015 virtual bool CanTruncateToInt32() const { | 1015 virtual bool CanTruncateToInt32() const { |
| 1016 return CheckFlag(kTruncatingToInt32); | 1016 return CheckFlag(kTruncatingToInt32); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 HValue* value() { return OperandAt(0); } | 1019 HValue* value() { return OperandAt(0); } |
| 1020 virtual void PrintDataTo(StringStream* stream); | 1020 virtual void PrintDataTo(StringStream* stream); |
| 1021 }; | 1021 }; |
| 1022 | 1022 |
| 1023 | 1023 |
| 1024 class HThrow: public HUnaryOperation { | 1024 class HThrow: public HTemplateInstruction<2> { |
| 1025 public: | 1025 public: |
| 1026 explicit HThrow(HValue* value) : HUnaryOperation(value) { | 1026 HThrow(HValue* context, HValue* value) { |
| 1027 SetOperandAt(0, context); |
| 1028 SetOperandAt(1, value); |
| 1027 SetAllSideEffects(); | 1029 SetAllSideEffects(); |
| 1028 } | 1030 } |
| 1029 | 1031 |
| 1030 virtual Representation RequiredInputRepresentation(int index) const { | 1032 virtual Representation RequiredInputRepresentation(int index) const { |
| 1031 return Representation::Tagged(); | 1033 return Representation::Tagged(); |
| 1032 } | 1034 } |
| 1033 | 1035 |
| 1036 HValue* context() { return OperandAt(0); } |
| 1037 HValue* value() { return OperandAt(1); } |
| 1038 |
| 1034 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1039 DECLARE_CONCRETE_INSTRUCTION(Throw) |
| 1035 }; | 1040 }; |
| 1036 | 1041 |
| 1037 | 1042 |
| 1038 class HUseConst: public HUnaryOperation { | 1043 class HUseConst: public HUnaryOperation { |
| 1039 public: | 1044 public: |
| 1040 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1045 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
| 1041 | 1046 |
| 1042 virtual Representation RequiredInputRepresentation(int index) const { | 1047 virtual Representation RequiredInputRepresentation(int index) const { |
| 1043 return Representation::None(); | 1048 return Representation::None(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 } | 1102 } |
| 1098 | 1103 |
| 1099 virtual void PrintDataTo(StringStream* stream); | 1104 virtual void PrintDataTo(StringStream* stream); |
| 1100 | 1105 |
| 1101 DECLARE_CONCRETE_INSTRUCTION(Change) | 1106 DECLARE_CONCRETE_INSTRUCTION(Change) |
| 1102 | 1107 |
| 1103 protected: | 1108 protected: |
| 1104 virtual bool DataEquals(HValue* other) { | 1109 virtual bool DataEquals(HValue* other) { |
| 1105 if (!other->IsChange()) return false; | 1110 if (!other->IsChange()) return false; |
| 1106 HChange* change = HChange::cast(other); | 1111 HChange* change = HChange::cast(other); |
| 1107 return value() == change->value() | 1112 return to().Equals(change->to()) |
| 1108 && to().Equals(change->to()) | |
| 1109 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); | 1113 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
| 1110 } | 1114 } |
| 1111 | 1115 |
| 1112 private: | 1116 private: |
| 1113 Representation from_; | 1117 Representation from_; |
| 1114 bool deoptimize_on_undefined_; | 1118 bool deoptimize_on_undefined_; |
| 1115 }; | 1119 }; |
| 1116 | 1120 |
| 1117 | 1121 |
| 1118 class HClampToUint8: public HUnaryOperation { | 1122 class HClampToUint8: public HUnaryOperation { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 // use lists are correctly updated. | 1251 // use lists are correctly updated. |
| 1248 SetOperandAt(values_.length() - 1, value); | 1252 SetOperandAt(values_.length() - 1, value); |
| 1249 } | 1253 } |
| 1250 int ast_id_; | 1254 int ast_id_; |
| 1251 int pop_count_; | 1255 int pop_count_; |
| 1252 ZoneList<HValue*> values_; | 1256 ZoneList<HValue*> values_; |
| 1253 ZoneList<int> assigned_indexes_; | 1257 ZoneList<int> assigned_indexes_; |
| 1254 }; | 1258 }; |
| 1255 | 1259 |
| 1256 | 1260 |
| 1257 class HStackCheck: public HTemplateInstruction<0> { | 1261 class HStackCheck: public HTemplateInstruction<1> { |
| 1258 public: | 1262 public: |
| 1259 enum Type { | 1263 enum Type { |
| 1260 kFunctionEntry, | 1264 kFunctionEntry, |
| 1261 kBackwardsBranch | 1265 kBackwardsBranch |
| 1262 }; | 1266 }; |
| 1263 | 1267 |
| 1264 explicit HStackCheck(Type type) : type_(type) { } | 1268 HStackCheck(HValue* context, Type type) : type_(type) { |
| 1269 SetOperandAt(0, context); |
| 1270 } |
| 1271 |
| 1272 HValue* context() { return OperandAt(0); } |
| 1265 | 1273 |
| 1266 virtual Representation RequiredInputRepresentation(int index) const { | 1274 virtual Representation RequiredInputRepresentation(int index) const { |
| 1267 return Representation::None(); | 1275 return Representation::Tagged(); |
| 1268 } | 1276 } |
| 1269 | 1277 |
| 1270 void Eliminate() { | 1278 void Eliminate() { |
| 1271 // The stack check eliminator might try to eliminate the same stack | 1279 // The stack check eliminator might try to eliminate the same stack |
| 1272 // check instruction multiple times. | 1280 // check instruction multiple times. |
| 1273 if (IsLinked()) { | 1281 if (IsLinked()) { |
| 1274 DeleteFromGraph(); | 1282 DeleteFromGraph(); |
| 1275 } | 1283 } |
| 1276 } | 1284 } |
| 1277 | 1285 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 return Representation::Tagged(); | 1646 return Representation::Tagged(); |
| 1639 } | 1647 } |
| 1640 | 1648 |
| 1641 HValue* context() { return first(); } | 1649 HValue* context() { return first(); } |
| 1642 HValue* constructor() { return second(); } | 1650 HValue* constructor() { return second(); } |
| 1643 | 1651 |
| 1644 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 1652 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
| 1645 }; | 1653 }; |
| 1646 | 1654 |
| 1647 | 1655 |
| 1648 class HCallRuntime: public HCall<0> { | 1656 class HCallRuntime: public HCall<1> { |
| 1649 public: | 1657 public: |
| 1650 HCallRuntime(Handle<String> name, | 1658 HCallRuntime(HValue* context, |
| 1659 Handle<String> name, |
| 1651 const Runtime::Function* c_function, | 1660 const Runtime::Function* c_function, |
| 1652 int argument_count) | 1661 int argument_count) |
| 1653 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } | 1662 : HCall<1>(argument_count), c_function_(c_function), name_(name) { |
| 1663 SetOperandAt(0, context); |
| 1664 } |
| 1665 |
| 1654 virtual void PrintDataTo(StringStream* stream); | 1666 virtual void PrintDataTo(StringStream* stream); |
| 1655 | 1667 |
| 1668 HValue* context() { return OperandAt(0); } |
| 1656 const Runtime::Function* function() const { return c_function_; } | 1669 const Runtime::Function* function() const { return c_function_; } |
| 1657 Handle<String> name() const { return name_; } | 1670 Handle<String> name() const { return name_; } |
| 1658 | 1671 |
| 1659 virtual Representation RequiredInputRepresentation(int index) const { | 1672 virtual Representation RequiredInputRepresentation(int index) const { |
| 1660 return Representation::None(); | 1673 return Representation::Tagged(); |
| 1661 } | 1674 } |
| 1662 | 1675 |
| 1663 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 1676 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
| 1664 | 1677 |
| 1665 private: | 1678 private: |
| 1666 const Runtime::Function* c_function_; | 1679 const Runtime::Function* c_function_; |
| 1667 Handle<String> name_; | 1680 Handle<String> name_; |
| 1668 }; | 1681 }; |
| 1669 | 1682 |
| 1670 | 1683 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 } | 1776 } |
| 1764 virtual HType CalculateInferredType(); | 1777 virtual HType CalculateInferredType(); |
| 1765 | 1778 |
| 1766 DECLARE_CONCRETE_INSTRUCTION(BitNot) | 1779 DECLARE_CONCRETE_INSTRUCTION(BitNot) |
| 1767 | 1780 |
| 1768 protected: | 1781 protected: |
| 1769 virtual bool DataEquals(HValue* other) { return true; } | 1782 virtual bool DataEquals(HValue* other) { return true; } |
| 1770 }; | 1783 }; |
| 1771 | 1784 |
| 1772 | 1785 |
| 1773 class HUnaryMathOperation: public HUnaryOperation { | 1786 class HUnaryMathOperation: public HTemplateInstruction<2> { |
| 1774 public: | 1787 public: |
| 1775 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) | 1788 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
| 1776 : HUnaryOperation(value), op_(op) { | 1789 : op_(op) { |
| 1790 SetOperandAt(0, context); |
| 1791 SetOperandAt(1, value); |
| 1777 switch (op) { | 1792 switch (op) { |
| 1778 case kMathFloor: | 1793 case kMathFloor: |
| 1779 case kMathRound: | 1794 case kMathRound: |
| 1780 case kMathCeil: | 1795 case kMathCeil: |
| 1781 set_representation(Representation::Integer32()); | 1796 set_representation(Representation::Integer32()); |
| 1782 break; | 1797 break; |
| 1783 case kMathAbs: | 1798 case kMathAbs: |
| 1784 set_representation(Representation::Tagged()); | 1799 set_representation(Representation::Tagged()); |
| 1785 SetFlag(kFlexibleRepresentation); | 1800 SetFlag(kFlexibleRepresentation); |
| 1786 break; | 1801 break; |
| 1787 case kMathSqrt: | 1802 case kMathSqrt: |
| 1788 case kMathPowHalf: | 1803 case kMathPowHalf: |
| 1789 case kMathLog: | 1804 case kMathLog: |
| 1790 case kMathSin: | 1805 case kMathSin: |
| 1791 case kMathCos: | 1806 case kMathCos: |
| 1792 set_representation(Representation::Double()); | 1807 set_representation(Representation::Double()); |
| 1793 break; | 1808 break; |
| 1794 default: | 1809 default: |
| 1795 UNREACHABLE(); | 1810 UNREACHABLE(); |
| 1796 } | 1811 } |
| 1797 SetFlag(kUseGVN); | 1812 SetFlag(kUseGVN); |
| 1798 } | 1813 } |
| 1799 | 1814 |
| 1815 HValue* context() { return OperandAt(0); } |
| 1816 HValue* value() { return OperandAt(1); } |
| 1817 |
| 1800 virtual void PrintDataTo(StringStream* stream); | 1818 virtual void PrintDataTo(StringStream* stream); |
| 1801 | 1819 |
| 1802 virtual HType CalculateInferredType(); | 1820 virtual HType CalculateInferredType(); |
| 1803 | 1821 |
| 1804 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1822 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1805 | 1823 |
| 1806 virtual Representation RequiredInputRepresentation(int index) const { | 1824 virtual Representation RequiredInputRepresentation(int index) const { |
| 1807 switch (op_) { | 1825 if (index == 0) { |
| 1808 case kMathFloor: | 1826 return Representation::Tagged(); |
| 1809 case kMathRound: | 1827 } else { |
| 1810 case kMathCeil: | 1828 switch (op_) { |
| 1811 case kMathSqrt: | 1829 case kMathFloor: |
| 1812 case kMathPowHalf: | 1830 case kMathRound: |
| 1813 case kMathLog: | 1831 case kMathCeil: |
| 1814 case kMathSin: | 1832 case kMathSqrt: |
| 1815 case kMathCos: | 1833 case kMathPowHalf: |
| 1816 return Representation::Double(); | 1834 case kMathLog: |
| 1817 case kMathAbs: | 1835 case kMathSin: |
| 1818 return representation(); | 1836 case kMathCos: |
| 1819 default: | 1837 return Representation::Double(); |
| 1820 UNREACHABLE(); | 1838 case kMathAbs: |
| 1821 return Representation::None(); | 1839 return representation(); |
| 1840 default: |
| 1841 UNREACHABLE(); |
| 1842 return Representation::None(); |
| 1843 } |
| 1822 } | 1844 } |
| 1823 } | 1845 } |
| 1824 | 1846 |
| 1825 virtual HValue* Canonicalize() { | 1847 virtual HValue* Canonicalize() { |
| 1826 // If the input is integer32 then we replace the floor instruction | 1848 // If the input is integer32 then we replace the floor instruction |
| 1827 // with its inputs. This happens before the representation changes are | 1849 // with its inputs. This happens before the representation changes are |
| 1828 // introduced. | 1850 // introduced. |
| 1829 if (op() == kMathFloor) { | 1851 if (op() == kMathFloor) { |
| 1830 if (value()->representation().IsInteger32()) return value(); | 1852 if (value()->representation().IsInteger32()) return value(); |
| 1831 } | 1853 } |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 // The following two values represent the int32 and the double value of the | 2336 // The following two values represent the int32 and the double value of the |
| 2315 // given constant if there is a lossless conversion between the constant | 2337 // given constant if there is a lossless conversion between the constant |
| 2316 // and the specific representation. | 2338 // and the specific representation. |
| 2317 bool has_int32_value_ : 1; | 2339 bool has_int32_value_ : 1; |
| 2318 bool has_double_value_ : 1; | 2340 bool has_double_value_ : 1; |
| 2319 int32_t int32_value_; | 2341 int32_t int32_value_; |
| 2320 double double_value_; | 2342 double double_value_; |
| 2321 }; | 2343 }; |
| 2322 | 2344 |
| 2323 | 2345 |
| 2324 class HBinaryOperation: public HTemplateInstruction<2> { | 2346 class HBinaryOperation: public HTemplateInstruction<3> { |
| 2325 public: | 2347 public: |
| 2326 HBinaryOperation(HValue* left, HValue* right) { | 2348 HBinaryOperation(HValue* context, HValue* left, HValue* right) { |
| 2327 ASSERT(left != NULL && right != NULL); | 2349 ASSERT(left != NULL && right != NULL); |
| 2328 SetOperandAt(0, left); | 2350 SetOperandAt(0, context); |
| 2329 SetOperandAt(1, right); | 2351 SetOperandAt(1, left); |
| 2352 SetOperandAt(2, right); |
| 2330 } | 2353 } |
| 2331 | 2354 |
| 2332 HValue* left() { return OperandAt(0); } | 2355 HValue* context() { return OperandAt(0); } |
| 2333 HValue* right() { return OperandAt(1); } | 2356 HValue* left() { return OperandAt(1); } |
| 2357 HValue* right() { return OperandAt(2); } |
| 2334 | 2358 |
| 2335 // TODO(kasperl): Move these helpers to the IA-32 Lithium | 2359 // TODO(kasperl): Move these helpers to the IA-32 Lithium |
| 2336 // instruction sequence builder. | 2360 // instruction sequence builder. |
| 2337 HValue* LeastConstantOperand() { | 2361 HValue* LeastConstantOperand() { |
| 2338 if (IsCommutative() && left()->IsConstant()) return right(); | 2362 if (IsCommutative() && left()->IsConstant()) return right(); |
| 2339 return left(); | 2363 return left(); |
| 2340 } | 2364 } |
| 2341 HValue* MostConstantOperand() { | 2365 HValue* MostConstantOperand() { |
| 2342 if (IsCommutative() && left()->IsConstant()) return left(); | 2366 if (IsCommutative() && left()->IsConstant()) return left(); |
| 2343 return right(); | 2367 return right(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 HValue* arguments() { return OperandAt(0); } | 2463 HValue* arguments() { return OperandAt(0); } |
| 2440 HValue* length() { return OperandAt(1); } | 2464 HValue* length() { return OperandAt(1); } |
| 2441 HValue* index() { return OperandAt(2); } | 2465 HValue* index() { return OperandAt(2); } |
| 2442 | 2466 |
| 2443 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 2467 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
| 2444 | 2468 |
| 2445 virtual bool DataEquals(HValue* other) { return true; } | 2469 virtual bool DataEquals(HValue* other) { return true; } |
| 2446 }; | 2470 }; |
| 2447 | 2471 |
| 2448 | 2472 |
| 2449 class HBoundsCheck: public HBinaryOperation { | 2473 class HBoundsCheck: public HTemplateInstruction<2> { |
| 2450 public: | 2474 public: |
| 2451 HBoundsCheck(HValue* index, HValue* length) | 2475 HBoundsCheck(HValue* index, HValue* length) { |
| 2452 : HBinaryOperation(index, length) { | 2476 SetOperandAt(0, index); |
| 2477 SetOperandAt(1, length); |
| 2453 set_representation(Representation::Integer32()); | 2478 set_representation(Representation::Integer32()); |
| 2454 SetFlag(kUseGVN); | 2479 SetFlag(kUseGVN); |
| 2455 } | 2480 } |
| 2456 | 2481 |
| 2457 virtual Representation RequiredInputRepresentation(int index) const { | 2482 virtual Representation RequiredInputRepresentation(int index) const { |
| 2458 return Representation::Integer32(); | 2483 return Representation::Integer32(); |
| 2459 } | 2484 } |
| 2460 | 2485 |
| 2461 #ifdef DEBUG | 2486 #ifdef DEBUG |
| 2462 virtual void Verify(); | 2487 virtual void Verify(); |
| 2463 #endif | 2488 #endif |
| 2464 | 2489 |
| 2465 HValue* index() { return left(); } | 2490 HValue* index() { return OperandAt(0); } |
| 2466 HValue* length() { return right(); } | 2491 HValue* length() { return OperandAt(1); } |
| 2467 | 2492 |
| 2468 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 2493 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
| 2469 | 2494 |
| 2470 protected: | 2495 protected: |
| 2471 virtual bool DataEquals(HValue* other) { return true; } | 2496 virtual bool DataEquals(HValue* other) { return true; } |
| 2472 }; | 2497 }; |
| 2473 | 2498 |
| 2474 | 2499 |
| 2475 class HBitwiseBinaryOperation: public HBinaryOperation { | 2500 class HBitwiseBinaryOperation: public HBinaryOperation { |
| 2476 public: | 2501 public: |
| 2477 HBitwiseBinaryOperation(HValue* left, HValue* right) | 2502 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 2478 : HBinaryOperation(left, right) { | 2503 : HBinaryOperation(context, left, right) { |
| 2479 set_representation(Representation::Tagged()); | 2504 set_representation(Representation::Tagged()); |
| 2480 SetFlag(kFlexibleRepresentation); | 2505 SetFlag(kFlexibleRepresentation); |
| 2481 SetAllSideEffects(); | 2506 SetAllSideEffects(); |
| 2482 } | 2507 } |
| 2483 | 2508 |
| 2484 virtual Representation RequiredInputRepresentation(int index) const { | 2509 virtual Representation RequiredInputRepresentation(int index) const { |
| 2485 return representation(); | 2510 return index == 0 |
| 2511 ? Representation::Tagged() |
| 2512 : representation(); |
| 2486 } | 2513 } |
| 2487 | 2514 |
| 2488 virtual void RepresentationChanged(Representation to) { | 2515 virtual void RepresentationChanged(Representation to) { |
| 2489 if (!to.IsTagged()) { | 2516 if (!to.IsTagged()) { |
| 2490 ASSERT(to.IsInteger32()); | 2517 ASSERT(to.IsInteger32()); |
| 2491 ClearAllSideEffects(); | 2518 ClearAllSideEffects(); |
| 2492 SetFlag(kTruncatingToInt32); | 2519 SetFlag(kTruncatingToInt32); |
| 2493 SetFlag(kUseGVN); | 2520 SetFlag(kUseGVN); |
| 2494 } | 2521 } |
| 2495 } | 2522 } |
| 2496 | 2523 |
| 2497 virtual HType CalculateInferredType(); | 2524 virtual HType CalculateInferredType(); |
| 2498 | 2525 |
| 2499 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 2526 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
| 2500 }; | 2527 }; |
| 2501 | 2528 |
| 2502 | 2529 |
| 2503 class HArithmeticBinaryOperation: public HBinaryOperation { | 2530 class HArithmeticBinaryOperation: public HBinaryOperation { |
| 2504 public: | 2531 public: |
| 2505 HArithmeticBinaryOperation(HValue* left, HValue* right) | 2532 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 2506 : HBinaryOperation(left, right) { | 2533 : HBinaryOperation(context, left, right) { |
| 2507 set_representation(Representation::Tagged()); | 2534 set_representation(Representation::Tagged()); |
| 2508 SetFlag(kFlexibleRepresentation); | 2535 SetFlag(kFlexibleRepresentation); |
| 2509 SetAllSideEffects(); | 2536 SetAllSideEffects(); |
| 2510 } | 2537 } |
| 2511 | 2538 |
| 2512 virtual void RepresentationChanged(Representation to) { | 2539 virtual void RepresentationChanged(Representation to) { |
| 2513 if (!to.IsTagged()) { | 2540 if (!to.IsTagged()) { |
| 2514 ClearAllSideEffects(); | 2541 ClearAllSideEffects(); |
| 2515 SetFlag(kUseGVN); | 2542 SetFlag(kUseGVN); |
| 2516 } | 2543 } |
| 2517 } | 2544 } |
| 2518 | 2545 |
| 2519 virtual HType CalculateInferredType(); | 2546 virtual HType CalculateInferredType(); |
| 2520 virtual Representation RequiredInputRepresentation(int index) const { | 2547 virtual Representation RequiredInputRepresentation(int index) const { |
| 2521 return representation(); | 2548 return index == 0 |
| 2549 ? Representation::Tagged() |
| 2550 : representation(); |
| 2522 } | 2551 } |
| 2552 |
| 2523 virtual Representation InferredRepresentation() { | 2553 virtual Representation InferredRepresentation() { |
| 2524 if (left()->representation().Equals(right()->representation())) { | 2554 if (left()->representation().Equals(right()->representation())) { |
| 2525 return left()->representation(); | 2555 return left()->representation(); |
| 2526 } | 2556 } |
| 2527 return HValue::InferredRepresentation(); | 2557 return HValue::InferredRepresentation(); |
| 2528 } | 2558 } |
| 2529 }; | 2559 }; |
| 2530 | 2560 |
| 2531 | 2561 |
| 2532 class HCompareGeneric: public HBinaryOperation { | 2562 class HCompareGeneric: public HBinaryOperation { |
| 2533 public: | 2563 public: |
| 2534 HCompareGeneric(HValue* left, HValue* right, Token::Value token) | 2564 HCompareGeneric(HValue* context, |
| 2535 : HBinaryOperation(left, right), token_(token) { | 2565 HValue* left, |
| 2566 HValue* right, |
| 2567 Token::Value token) |
| 2568 : HBinaryOperation(context, left, right), token_(token) { |
| 2536 ASSERT(Token::IsCompareOp(token)); | 2569 ASSERT(Token::IsCompareOp(token)); |
| 2537 set_representation(Representation::Tagged()); | 2570 set_representation(Representation::Tagged()); |
| 2538 SetAllSideEffects(); | 2571 SetAllSideEffects(); |
| 2539 } | 2572 } |
| 2540 | 2573 |
| 2541 virtual Representation RequiredInputRepresentation(int index) const { | 2574 virtual Representation RequiredInputRepresentation(int index) const { |
| 2542 return Representation::Tagged(); | 2575 return Representation::Tagged(); |
| 2543 } | 2576 } |
| 2577 |
| 2544 Representation GetInputRepresentation() const { | 2578 Representation GetInputRepresentation() const { |
| 2545 return Representation::Tagged(); | 2579 return Representation::Tagged(); |
| 2546 } | 2580 } |
| 2547 | 2581 |
| 2548 Token::Value token() const { return token_; } | 2582 Token::Value token() const { return token_; } |
| 2549 virtual void PrintDataTo(StringStream* stream); | 2583 virtual void PrintDataTo(StringStream* stream); |
| 2550 | 2584 |
| 2551 virtual HType CalculateInferredType(); | 2585 virtual HType CalculateInferredType(); |
| 2552 | 2586 |
| 2553 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 2587 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 | 2641 |
| 2608 | 2642 |
| 2609 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { | 2643 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { |
| 2610 public: | 2644 public: |
| 2611 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) | 2645 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) |
| 2612 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { | 2646 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { |
| 2613 ASSERT(op == Token::EQ_STRICT); | 2647 ASSERT(op == Token::EQ_STRICT); |
| 2614 } | 2648 } |
| 2615 | 2649 |
| 2616 Token::Value op() const { return op_; } | 2650 Token::Value op() const { return op_; } |
| 2651 HValue* left() { return value(); } |
| 2617 int right() const { return right_; } | 2652 int right() const { return right_; } |
| 2618 | 2653 |
| 2619 virtual Representation RequiredInputRepresentation(int index) const { | 2654 virtual Representation RequiredInputRepresentation(int index) const { |
| 2620 return Representation::Integer32(); | 2655 return Representation::Integer32(); |
| 2621 } | 2656 } |
| 2622 | 2657 |
| 2623 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); | 2658 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); |
| 2624 | 2659 |
| 2625 private: | 2660 private: |
| 2626 const Token::Value op_; | 2661 const Token::Value op_; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 | 2824 |
| 2790 virtual Representation RequiredInputRepresentation(int index) const { | 2825 virtual Representation RequiredInputRepresentation(int index) const { |
| 2791 return Representation::Tagged(); | 2826 return Representation::Tagged(); |
| 2792 } | 2827 } |
| 2793 | 2828 |
| 2794 private: | 2829 private: |
| 2795 Handle<String> type_literal_; | 2830 Handle<String> type_literal_; |
| 2796 }; | 2831 }; |
| 2797 | 2832 |
| 2798 | 2833 |
| 2799 class HInstanceOf: public HTemplateInstruction<3> { | 2834 class HInstanceOf: public HBinaryOperation { |
| 2800 public: | 2835 public: |
| 2801 HInstanceOf(HValue* context, HValue* left, HValue* right) { | 2836 HInstanceOf(HValue* context, HValue* left, HValue* right) |
| 2802 SetOperandAt(0, context); | 2837 : HBinaryOperation(context, left, right) { |
| 2803 SetOperandAt(1, left); | |
| 2804 SetOperandAt(2, right); | |
| 2805 set_representation(Representation::Tagged()); | 2838 set_representation(Representation::Tagged()); |
| 2806 SetAllSideEffects(); | 2839 SetAllSideEffects(); |
| 2807 } | 2840 } |
| 2808 | 2841 |
| 2809 HValue* context() { return OperandAt(0); } | |
| 2810 HValue* left() { return OperandAt(1); } | |
| 2811 HValue* right() { return OperandAt(2); } | |
| 2812 | |
| 2813 virtual Representation RequiredInputRepresentation(int index) const { | 2842 virtual Representation RequiredInputRepresentation(int index) const { |
| 2814 return Representation::Tagged(); | 2843 return Representation::Tagged(); |
| 2815 } | 2844 } |
| 2816 | 2845 |
| 2817 virtual HType CalculateInferredType(); | 2846 virtual HType CalculateInferredType(); |
| 2818 | 2847 |
| 2819 virtual void PrintDataTo(StringStream* stream); | 2848 virtual void PrintDataTo(StringStream* stream); |
| 2820 | 2849 |
| 2821 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 2850 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
| 2822 }; | 2851 }; |
| 2823 | 2852 |
| 2824 | 2853 |
| 2825 class HInstanceOfKnownGlobal: public HUnaryOperation { | 2854 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { |
| 2826 public: | 2855 public: |
| 2827 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) | 2856 HInstanceOfKnownGlobal(HValue* context, |
| 2828 : HUnaryOperation(left), function_(right) { | 2857 HValue* left, |
| 2858 Handle<JSFunction> right) |
| 2859 : function_(right) { |
| 2860 SetOperandAt(0, context); |
| 2861 SetOperandAt(1, left); |
| 2829 set_representation(Representation::Tagged()); | 2862 set_representation(Representation::Tagged()); |
| 2830 SetAllSideEffects(); | 2863 SetAllSideEffects(); |
| 2831 } | 2864 } |
| 2832 | 2865 |
| 2866 HValue* context() { return OperandAt(0); } |
| 2867 HValue* left() { return OperandAt(1); } |
| 2833 Handle<JSFunction> function() { return function_; } | 2868 Handle<JSFunction> function() { return function_; } |
| 2834 | 2869 |
| 2835 virtual Representation RequiredInputRepresentation(int index) const { | 2870 virtual Representation RequiredInputRepresentation(int index) const { |
| 2836 return Representation::Tagged(); | 2871 return Representation::Tagged(); |
| 2837 } | 2872 } |
| 2838 | 2873 |
| 2839 virtual HType CalculateInferredType(); | 2874 virtual HType CalculateInferredType(); |
| 2840 | 2875 |
| 2841 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) | 2876 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
| 2842 | 2877 |
| 2843 private: | 2878 private: |
| 2844 Handle<JSFunction> function_; | 2879 Handle<JSFunction> function_; |
| 2845 }; | 2880 }; |
| 2846 | 2881 |
| 2847 | 2882 |
| 2848 class HPower: public HBinaryOperation { | 2883 class HPower: public HTemplateInstruction<2> { |
| 2849 public: | 2884 public: |
| 2850 HPower(HValue* left, HValue* right) | 2885 HPower(HValue* left, HValue* right) { |
| 2851 : HBinaryOperation(left, right) { | 2886 SetOperandAt(0, left); |
| 2887 SetOperandAt(1, right); |
| 2852 set_representation(Representation::Double()); | 2888 set_representation(Representation::Double()); |
| 2853 SetFlag(kUseGVN); | 2889 SetFlag(kUseGVN); |
| 2854 } | 2890 } |
| 2855 | 2891 |
| 2892 HValue* left() { return OperandAt(0); } |
| 2893 HValue* right() { return OperandAt(1); } |
| 2894 |
| 2856 virtual Representation RequiredInputRepresentation(int index) const { | 2895 virtual Representation RequiredInputRepresentation(int index) const { |
| 2857 return (index == 1) ? Representation::None() : Representation::Double(); | 2896 return index == 0 |
| 2897 ? Representation::Double() |
| 2898 : Representation::None(); |
| 2858 } | 2899 } |
| 2859 | 2900 |
| 2860 DECLARE_CONCRETE_INSTRUCTION(Power) | 2901 DECLARE_CONCRETE_INSTRUCTION(Power) |
| 2861 | 2902 |
| 2862 protected: | 2903 protected: |
| 2863 virtual bool DataEquals(HValue* other) { return true; } | 2904 virtual bool DataEquals(HValue* other) { return true; } |
| 2864 }; | 2905 }; |
| 2865 | 2906 |
| 2866 | 2907 |
| 2867 class HAdd: public HArithmeticBinaryOperation { | 2908 class HAdd: public HArithmeticBinaryOperation { |
| 2868 public: | 2909 public: |
| 2869 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2910 HAdd(HValue* context, HValue* left, HValue* right) |
| 2911 : HArithmeticBinaryOperation(context, left, right) { |
| 2870 SetFlag(kCanOverflow); | 2912 SetFlag(kCanOverflow); |
| 2871 } | 2913 } |
| 2872 | 2914 |
| 2873 // Add is only commutative if two integer values are added and not if two | 2915 // Add is only commutative if two integer values are added and not if two |
| 2874 // tagged values are added (because it might be a String concatenation). | 2916 // tagged values are added (because it might be a String concatenation). |
| 2875 virtual bool IsCommutative() const { | 2917 virtual bool IsCommutative() const { |
| 2876 return !representation().IsTagged(); | 2918 return !representation().IsTagged(); |
| 2877 } | 2919 } |
| 2878 | 2920 |
| 2879 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2921 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2880 | 2922 |
| 2881 virtual HType CalculateInferredType(); | 2923 virtual HType CalculateInferredType(); |
| 2882 | 2924 |
| 2883 DECLARE_CONCRETE_INSTRUCTION(Add) | 2925 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 2884 | 2926 |
| 2885 protected: | 2927 protected: |
| 2886 virtual bool DataEquals(HValue* other) { return true; } | 2928 virtual bool DataEquals(HValue* other) { return true; } |
| 2887 | 2929 |
| 2888 virtual Range* InferRange(); | 2930 virtual Range* InferRange(); |
| 2889 }; | 2931 }; |
| 2890 | 2932 |
| 2891 | 2933 |
| 2892 class HSub: public HArithmeticBinaryOperation { | 2934 class HSub: public HArithmeticBinaryOperation { |
| 2893 public: | 2935 public: |
| 2894 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2936 HSub(HValue* context, HValue* left, HValue* right) |
| 2937 : HArithmeticBinaryOperation(context, left, right) { |
| 2895 SetFlag(kCanOverflow); | 2938 SetFlag(kCanOverflow); |
| 2896 } | 2939 } |
| 2897 | 2940 |
| 2898 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2941 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2899 | 2942 |
| 2900 DECLARE_CONCRETE_INSTRUCTION(Sub) | 2943 DECLARE_CONCRETE_INSTRUCTION(Sub) |
| 2901 | 2944 |
| 2902 protected: | 2945 protected: |
| 2903 virtual bool DataEquals(HValue* other) { return true; } | 2946 virtual bool DataEquals(HValue* other) { return true; } |
| 2904 | 2947 |
| 2905 virtual Range* InferRange(); | 2948 virtual Range* InferRange(); |
| 2906 }; | 2949 }; |
| 2907 | 2950 |
| 2908 | 2951 |
| 2909 class HMul: public HArithmeticBinaryOperation { | 2952 class HMul: public HArithmeticBinaryOperation { |
| 2910 public: | 2953 public: |
| 2911 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2954 HMul(HValue* context, HValue* left, HValue* right) |
| 2955 : HArithmeticBinaryOperation(context, left, right) { |
| 2912 SetFlag(kCanOverflow); | 2956 SetFlag(kCanOverflow); |
| 2913 } | 2957 } |
| 2914 | 2958 |
| 2915 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2959 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2916 | 2960 |
| 2917 // Only commutative if it is certain that not two objects are multiplicated. | 2961 // Only commutative if it is certain that not two objects are multiplicated. |
| 2918 virtual bool IsCommutative() const { | 2962 virtual bool IsCommutative() const { |
| 2919 return !representation().IsTagged(); | 2963 return !representation().IsTagged(); |
| 2920 } | 2964 } |
| 2921 | 2965 |
| 2922 DECLARE_CONCRETE_INSTRUCTION(Mul) | 2966 DECLARE_CONCRETE_INSTRUCTION(Mul) |
| 2923 | 2967 |
| 2924 protected: | 2968 protected: |
| 2925 virtual bool DataEquals(HValue* other) { return true; } | 2969 virtual bool DataEquals(HValue* other) { return true; } |
| 2926 | 2970 |
| 2927 virtual Range* InferRange(); | 2971 virtual Range* InferRange(); |
| 2928 }; | 2972 }; |
| 2929 | 2973 |
| 2930 | 2974 |
| 2931 class HMod: public HArithmeticBinaryOperation { | 2975 class HMod: public HArithmeticBinaryOperation { |
| 2932 public: | 2976 public: |
| 2933 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2977 HMod(HValue* context, HValue* left, HValue* right) |
| 2978 : HArithmeticBinaryOperation(context, left, right) { |
| 2934 SetFlag(kCanBeDivByZero); | 2979 SetFlag(kCanBeDivByZero); |
| 2935 } | 2980 } |
| 2936 | 2981 |
| 2937 bool HasPowerOf2Divisor() { | 2982 bool HasPowerOf2Divisor() { |
| 2938 if (right()->IsConstant() && | 2983 if (right()->IsConstant() && |
| 2939 HConstant::cast(right())->HasInteger32Value()) { | 2984 HConstant::cast(right())->HasInteger32Value()) { |
| 2940 int32_t value = HConstant::cast(right())->Integer32Value(); | 2985 int32_t value = HConstant::cast(right())->Integer32Value(); |
| 2941 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 2986 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 2942 } | 2987 } |
| 2943 | 2988 |
| 2944 return false; | 2989 return false; |
| 2945 } | 2990 } |
| 2946 | 2991 |
| 2947 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2992 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2948 | 2993 |
| 2949 DECLARE_CONCRETE_INSTRUCTION(Mod) | 2994 DECLARE_CONCRETE_INSTRUCTION(Mod) |
| 2950 | 2995 |
| 2951 protected: | 2996 protected: |
| 2952 virtual bool DataEquals(HValue* other) { return true; } | 2997 virtual bool DataEquals(HValue* other) { return true; } |
| 2953 | 2998 |
| 2954 virtual Range* InferRange(); | 2999 virtual Range* InferRange(); |
| 2955 }; | 3000 }; |
| 2956 | 3001 |
| 2957 | 3002 |
| 2958 class HDiv: public HArithmeticBinaryOperation { | 3003 class HDiv: public HArithmeticBinaryOperation { |
| 2959 public: | 3004 public: |
| 2960 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 3005 HDiv(HValue* context, HValue* left, HValue* right) |
| 3006 : HArithmeticBinaryOperation(context, left, right) { |
| 2961 SetFlag(kCanBeDivByZero); | 3007 SetFlag(kCanBeDivByZero); |
| 2962 SetFlag(kCanOverflow); | 3008 SetFlag(kCanOverflow); |
| 2963 } | 3009 } |
| 2964 | 3010 |
| 2965 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 3011 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2966 | 3012 |
| 2967 DECLARE_CONCRETE_INSTRUCTION(Div) | 3013 DECLARE_CONCRETE_INSTRUCTION(Div) |
| 2968 | 3014 |
| 2969 protected: | 3015 protected: |
| 2970 virtual bool DataEquals(HValue* other) { return true; } | 3016 virtual bool DataEquals(HValue* other) { return true; } |
| 2971 | 3017 |
| 2972 virtual Range* InferRange(); | 3018 virtual Range* InferRange(); |
| 2973 }; | 3019 }; |
| 2974 | 3020 |
| 2975 | 3021 |
| 2976 class HBitAnd: public HBitwiseBinaryOperation { | 3022 class HBitAnd: public HBitwiseBinaryOperation { |
| 2977 public: | 3023 public: |
| 2978 HBitAnd(HValue* left, HValue* right) | 3024 HBitAnd(HValue* context, HValue* left, HValue* right) |
| 2979 : HBitwiseBinaryOperation(left, right) { } | 3025 : HBitwiseBinaryOperation(context, left, right) { } |
| 2980 | 3026 |
| 2981 virtual bool IsCommutative() const { return true; } | 3027 virtual bool IsCommutative() const { return true; } |
| 2982 virtual HType CalculateInferredType(); | 3028 virtual HType CalculateInferredType(); |
| 2983 | 3029 |
| 2984 DECLARE_CONCRETE_INSTRUCTION(BitAnd) | 3030 DECLARE_CONCRETE_INSTRUCTION(BitAnd) |
| 2985 | 3031 |
| 2986 protected: | 3032 protected: |
| 2987 virtual bool DataEquals(HValue* other) { return true; } | 3033 virtual bool DataEquals(HValue* other) { return true; } |
| 2988 | 3034 |
| 2989 virtual Range* InferRange(); | 3035 virtual Range* InferRange(); |
| 2990 }; | 3036 }; |
| 2991 | 3037 |
| 2992 | 3038 |
| 2993 class HBitXor: public HBitwiseBinaryOperation { | 3039 class HBitXor: public HBitwiseBinaryOperation { |
| 2994 public: | 3040 public: |
| 2995 HBitXor(HValue* left, HValue* right) | 3041 HBitXor(HValue* context, HValue* left, HValue* right) |
| 2996 : HBitwiseBinaryOperation(left, right) { } | 3042 : HBitwiseBinaryOperation(context, left, right) { } |
| 2997 | 3043 |
| 2998 virtual bool IsCommutative() const { return true; } | 3044 virtual bool IsCommutative() const { return true; } |
| 2999 virtual HType CalculateInferredType(); | 3045 virtual HType CalculateInferredType(); |
| 3000 | 3046 |
| 3001 DECLARE_CONCRETE_INSTRUCTION(BitXor) | 3047 DECLARE_CONCRETE_INSTRUCTION(BitXor) |
| 3002 | 3048 |
| 3003 protected: | 3049 protected: |
| 3004 virtual bool DataEquals(HValue* other) { return true; } | 3050 virtual bool DataEquals(HValue* other) { return true; } |
| 3005 }; | 3051 }; |
| 3006 | 3052 |
| 3007 | 3053 |
| 3008 class HBitOr: public HBitwiseBinaryOperation { | 3054 class HBitOr: public HBitwiseBinaryOperation { |
| 3009 public: | 3055 public: |
| 3010 HBitOr(HValue* left, HValue* right) | 3056 HBitOr(HValue* context, HValue* left, HValue* right) |
| 3011 : HBitwiseBinaryOperation(left, right) { } | 3057 : HBitwiseBinaryOperation(context, left, right) { } |
| 3012 | 3058 |
| 3013 virtual bool IsCommutative() const { return true; } | 3059 virtual bool IsCommutative() const { return true; } |
| 3014 virtual HType CalculateInferredType(); | 3060 virtual HType CalculateInferredType(); |
| 3015 | 3061 |
| 3016 DECLARE_CONCRETE_INSTRUCTION(BitOr) | 3062 DECLARE_CONCRETE_INSTRUCTION(BitOr) |
| 3017 | 3063 |
| 3018 protected: | 3064 protected: |
| 3019 virtual bool DataEquals(HValue* other) { return true; } | 3065 virtual bool DataEquals(HValue* other) { return true; } |
| 3020 | 3066 |
| 3021 virtual Range* InferRange(); | 3067 virtual Range* InferRange(); |
| 3022 }; | 3068 }; |
| 3023 | 3069 |
| 3024 | 3070 |
| 3025 class HShl: public HBitwiseBinaryOperation { | 3071 class HShl: public HBitwiseBinaryOperation { |
| 3026 public: | 3072 public: |
| 3027 HShl(HValue* left, HValue* right) | 3073 HShl(HValue* context, HValue* left, HValue* right) |
| 3028 : HBitwiseBinaryOperation(left, right) { } | 3074 : HBitwiseBinaryOperation(context, left, right) { } |
| 3029 | 3075 |
| 3030 virtual Range* InferRange(); | 3076 virtual Range* InferRange(); |
| 3031 virtual HType CalculateInferredType(); | 3077 virtual HType CalculateInferredType(); |
| 3032 | 3078 |
| 3033 DECLARE_CONCRETE_INSTRUCTION(Shl) | 3079 DECLARE_CONCRETE_INSTRUCTION(Shl) |
| 3034 | 3080 |
| 3035 protected: | 3081 protected: |
| 3036 virtual bool DataEquals(HValue* other) { return true; } | 3082 virtual bool DataEquals(HValue* other) { return true; } |
| 3037 }; | 3083 }; |
| 3038 | 3084 |
| 3039 | 3085 |
| 3040 class HShr: public HBitwiseBinaryOperation { | 3086 class HShr: public HBitwiseBinaryOperation { |
| 3041 public: | 3087 public: |
| 3042 HShr(HValue* left, HValue* right) | 3088 HShr(HValue* context, HValue* left, HValue* right) |
| 3043 : HBitwiseBinaryOperation(left, right) { } | 3089 : HBitwiseBinaryOperation(context, left, right) { } |
| 3044 | 3090 |
| 3045 virtual HType CalculateInferredType(); | 3091 virtual HType CalculateInferredType(); |
| 3046 | 3092 |
| 3047 DECLARE_CONCRETE_INSTRUCTION(Shr) | 3093 DECLARE_CONCRETE_INSTRUCTION(Shr) |
| 3048 | 3094 |
| 3049 protected: | 3095 protected: |
| 3050 virtual bool DataEquals(HValue* other) { return true; } | 3096 virtual bool DataEquals(HValue* other) { return true; } |
| 3051 }; | 3097 }; |
| 3052 | 3098 |
| 3053 | 3099 |
| 3054 class HSar: public HBitwiseBinaryOperation { | 3100 class HSar: public HBitwiseBinaryOperation { |
| 3055 public: | 3101 public: |
| 3056 HSar(HValue* left, HValue* right) | 3102 HSar(HValue* context, HValue* left, HValue* right) |
| 3057 : HBitwiseBinaryOperation(left, right) { } | 3103 : HBitwiseBinaryOperation(context, left, right) { } |
| 3058 | 3104 |
| 3059 virtual Range* InferRange(); | 3105 virtual Range* InferRange(); |
| 3060 virtual HType CalculateInferredType(); | 3106 virtual HType CalculateInferredType(); |
| 3061 | 3107 |
| 3062 DECLARE_CONCRETE_INSTRUCTION(Sar) | 3108 DECLARE_CONCRETE_INSTRUCTION(Sar) |
| 3063 | 3109 |
| 3064 protected: | 3110 protected: |
| 3065 virtual bool DataEquals(HValue* other) { return true; } | 3111 virtual bool DataEquals(HValue* other) { return true; } |
| 3066 }; | 3112 }; |
| 3067 | 3113 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3181 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 3227 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
| 3182 return cell_.is_identical_to(b->cell()); | 3228 return cell_.is_identical_to(b->cell()); |
| 3183 } | 3229 } |
| 3184 | 3230 |
| 3185 private: | 3231 private: |
| 3186 Handle<JSGlobalPropertyCell> cell_; | 3232 Handle<JSGlobalPropertyCell> cell_; |
| 3187 bool check_hole_value_; | 3233 bool check_hole_value_; |
| 3188 }; | 3234 }; |
| 3189 | 3235 |
| 3190 | 3236 |
| 3191 class HLoadGlobalGeneric: public HBinaryOperation { | 3237 class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
| 3192 public: | 3238 public: |
| 3193 HLoadGlobalGeneric(HValue* context, | 3239 HLoadGlobalGeneric(HValue* context, |
| 3194 HValue* global_object, | 3240 HValue* global_object, |
| 3195 Handle<Object> name, | 3241 Handle<Object> name, |
| 3196 bool for_typeof) | 3242 bool for_typeof) |
| 3197 : HBinaryOperation(context, global_object), | 3243 : name_(name), |
| 3198 name_(name), | |
| 3199 for_typeof_(for_typeof) { | 3244 for_typeof_(for_typeof) { |
| 3245 SetOperandAt(0, context); |
| 3246 SetOperandAt(1, global_object); |
| 3200 set_representation(Representation::Tagged()); | 3247 set_representation(Representation::Tagged()); |
| 3201 SetAllSideEffects(); | 3248 SetAllSideEffects(); |
| 3202 } | 3249 } |
| 3203 | 3250 |
| 3204 HValue* context() { return OperandAt(0); } | 3251 HValue* context() { return OperandAt(0); } |
| 3205 HValue* global_object() { return OperandAt(1); } | 3252 HValue* global_object() { return OperandAt(1); } |
| 3206 Handle<Object> name() const { return name_; } | 3253 Handle<Object> name() const { return name_; } |
| 3207 bool for_typeof() const { return for_typeof_; } | 3254 bool for_typeof() const { return for_typeof_; } |
| 3208 | 3255 |
| 3209 virtual void PrintDataTo(StringStream* stream); | 3256 virtual void PrintDataTo(StringStream* stream); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3312 int slot_index_; | 3359 int slot_index_; |
| 3313 }; | 3360 }; |
| 3314 | 3361 |
| 3315 | 3362 |
| 3316 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 3363 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| 3317 return !value->type().IsSmi() && | 3364 return !value->type().IsSmi() && |
| 3318 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); | 3365 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); |
| 3319 } | 3366 } |
| 3320 | 3367 |
| 3321 | 3368 |
| 3322 class HStoreContextSlot: public HBinaryOperation { | 3369 class HStoreContextSlot: public HTemplateInstruction<2> { |
| 3323 public: | 3370 public: |
| 3324 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | 3371 HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
| 3325 : HBinaryOperation(context, value), slot_index_(slot_index) { | 3372 : slot_index_(slot_index) { |
| 3373 SetOperandAt(0, context); |
| 3374 SetOperandAt(1, value); |
| 3326 SetFlag(kChangesContextSlots); | 3375 SetFlag(kChangesContextSlots); |
| 3327 } | 3376 } |
| 3328 | 3377 |
| 3329 HValue* context() { return OperandAt(0); } | 3378 HValue* context() { return OperandAt(0); } |
| 3330 HValue* value() { return OperandAt(1); } | 3379 HValue* value() { return OperandAt(1); } |
| 3331 int slot_index() const { return slot_index_; } | 3380 int slot_index() const { return slot_index_; } |
| 3332 | 3381 |
| 3333 bool NeedsWriteBarrier() { | 3382 bool NeedsWriteBarrier() { |
| 3334 return StoringValueNeedsWriteBarrier(value()); | 3383 return StoringValueNeedsWriteBarrier(value()); |
| 3335 } | 3384 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3379 HLoadNamedField* b = HLoadNamedField::cast(other); | 3428 HLoadNamedField* b = HLoadNamedField::cast(other); |
| 3380 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; | 3429 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; |
| 3381 } | 3430 } |
| 3382 | 3431 |
| 3383 private: | 3432 private: |
| 3384 bool is_in_object_; | 3433 bool is_in_object_; |
| 3385 int offset_; | 3434 int offset_; |
| 3386 }; | 3435 }; |
| 3387 | 3436 |
| 3388 | 3437 |
| 3389 class HLoadNamedFieldPolymorphic: public HUnaryOperation { | 3438 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { |
| 3390 public: | 3439 public: |
| 3391 HLoadNamedFieldPolymorphic(HValue* object, | 3440 HLoadNamedFieldPolymorphic(HValue* context, |
| 3441 HValue* object, |
| 3392 ZoneMapList* types, | 3442 ZoneMapList* types, |
| 3393 Handle<String> name); | 3443 Handle<String> name); |
| 3394 | 3444 |
| 3395 HValue* object() { return OperandAt(0); } | 3445 HValue* context() { return OperandAt(0); } |
| 3446 HValue* object() { return OperandAt(1); } |
| 3396 ZoneMapList* types() { return &types_; } | 3447 ZoneMapList* types() { return &types_; } |
| 3397 Handle<String> name() { return name_; } | 3448 Handle<String> name() { return name_; } |
| 3398 bool need_generic() { return need_generic_; } | 3449 bool need_generic() { return need_generic_; } |
| 3399 | 3450 |
| 3400 virtual Representation RequiredInputRepresentation(int index) const { | 3451 virtual Representation RequiredInputRepresentation(int index) const { |
| 3401 return Representation::Tagged(); | 3452 return Representation::Tagged(); |
| 3402 } | 3453 } |
| 3403 | 3454 |
| 3404 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) | 3455 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) |
| 3405 | 3456 |
| 3406 static const int kMaxLoadPolymorphism = 4; | 3457 static const int kMaxLoadPolymorphism = 4; |
| 3407 | 3458 |
| 3408 protected: | 3459 protected: |
| 3409 virtual bool DataEquals(HValue* value); | 3460 virtual bool DataEquals(HValue* value); |
| 3410 | 3461 |
| 3411 private: | 3462 private: |
| 3412 ZoneMapList types_; | 3463 ZoneMapList types_; |
| 3413 Handle<String> name_; | 3464 Handle<String> name_; |
| 3414 bool need_generic_; | 3465 bool need_generic_; |
| 3415 }; | 3466 }; |
| 3416 | 3467 |
| 3417 | 3468 |
| 3418 | 3469 |
| 3419 class HLoadNamedGeneric: public HBinaryOperation { | 3470 class HLoadNamedGeneric: public HTemplateInstruction<2> { |
| 3420 public: | 3471 public: |
| 3421 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) | 3472 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
| 3422 : HBinaryOperation(context, object), name_(name) { | 3473 : name_(name) { |
| 3474 SetOperandAt(0, context); |
| 3475 SetOperandAt(1, object); |
| 3423 set_representation(Representation::Tagged()); | 3476 set_representation(Representation::Tagged()); |
| 3424 SetAllSideEffects(); | 3477 SetAllSideEffects(); |
| 3425 } | 3478 } |
| 3426 | 3479 |
| 3427 HValue* context() { return OperandAt(0); } | 3480 HValue* context() { return OperandAt(0); } |
| 3428 HValue* object() { return OperandAt(1); } | 3481 HValue* object() { return OperandAt(1); } |
| 3429 Handle<Object> name() const { return name_; } | 3482 Handle<Object> name() const { return name_; } |
| 3430 | 3483 |
| 3431 virtual Representation RequiredInputRepresentation(int index) const { | 3484 virtual Representation RequiredInputRepresentation(int index) const { |
| 3432 return Representation::Tagged(); | 3485 return Representation::Tagged(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3454 return Representation::Tagged(); | 3507 return Representation::Tagged(); |
| 3455 } | 3508 } |
| 3456 | 3509 |
| 3457 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 3510 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
| 3458 | 3511 |
| 3459 protected: | 3512 protected: |
| 3460 virtual bool DataEquals(HValue* other) { return true; } | 3513 virtual bool DataEquals(HValue* other) { return true; } |
| 3461 }; | 3514 }; |
| 3462 | 3515 |
| 3463 | 3516 |
| 3464 class HLoadKeyedFastElement: public HBinaryOperation { | 3517 class HLoadKeyedFastElement: public HTemplateInstruction<2> { |
| 3465 public: | 3518 public: |
| 3466 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 3519 HLoadKeyedFastElement(HValue* obj, HValue* key) { |
| 3520 SetOperandAt(0, obj); |
| 3521 SetOperandAt(1, key); |
| 3467 set_representation(Representation::Tagged()); | 3522 set_representation(Representation::Tagged()); |
| 3468 SetFlag(kDependsOnArrayElements); | 3523 SetFlag(kDependsOnArrayElements); |
| 3469 SetFlag(kUseGVN); | 3524 SetFlag(kUseGVN); |
| 3470 } | 3525 } |
| 3471 | 3526 |
| 3472 HValue* object() { return OperandAt(0); } | 3527 HValue* object() { return OperandAt(0); } |
| 3473 HValue* key() { return OperandAt(1); } | 3528 HValue* key() { return OperandAt(1); } |
| 3474 | 3529 |
| 3475 virtual Representation RequiredInputRepresentation(int index) const { | 3530 virtual Representation RequiredInputRepresentation(int index) const { |
| 3476 // The key is supposed to be Integer32. | 3531 // The key is supposed to be Integer32. |
| 3477 return (index == 1) ? Representation::Integer32() | 3532 return index == 0 |
| 3478 : Representation::Tagged(); | 3533 ? Representation::Tagged() |
| 3534 : Representation::Integer32(); |
| 3479 } | 3535 } |
| 3480 | 3536 |
| 3481 virtual void PrintDataTo(StringStream* stream); | 3537 virtual void PrintDataTo(StringStream* stream); |
| 3482 | 3538 |
| 3483 bool RequiresHoleCheck() const; | 3539 bool RequiresHoleCheck() const; |
| 3484 | 3540 |
| 3485 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) | 3541 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
| 3486 | 3542 |
| 3487 protected: | 3543 protected: |
| 3488 virtual bool DataEquals(HValue* other) { return true; } | 3544 virtual bool DataEquals(HValue* other) { return true; } |
| 3489 }; | 3545 }; |
| 3490 | 3546 |
| 3491 | 3547 |
| 3492 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { | 3548 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { |
| 3493 public: | 3549 public: |
| 3494 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3550 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
| 3495 HValue* key, | 3551 HValue* key, |
| 3496 JSObject::ElementsKind elements_kind) | 3552 JSObject::ElementsKind elements_kind) |
| 3497 : HBinaryOperation(external_elements, key), | 3553 : elements_kind_(elements_kind) { |
| 3498 elements_kind_(elements_kind) { | 3554 SetOperandAt(0, external_elements); |
| 3555 SetOperandAt(1, key); |
| 3499 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || | 3556 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| 3500 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { | 3557 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
| 3501 set_representation(Representation::Double()); | 3558 set_representation(Representation::Double()); |
| 3502 } else { | 3559 } else { |
| 3503 set_representation(Representation::Integer32()); | 3560 set_representation(Representation::Integer32()); |
| 3504 } | 3561 } |
| 3505 SetFlag(kDependsOnSpecializedArrayElements); | 3562 SetFlag(kDependsOnSpecializedArrayElements); |
| 3506 // Native code could change the specialized array. | 3563 // Native code could change the specialized array. |
| 3507 SetFlag(kDependsOnCalls); | 3564 SetFlag(kDependsOnCalls); |
| 3508 SetFlag(kUseGVN); | 3565 SetFlag(kUseGVN); |
| 3509 } | 3566 } |
| 3510 | 3567 |
| 3511 virtual void PrintDataTo(StringStream* stream); | 3568 virtual void PrintDataTo(StringStream* stream); |
| 3512 | 3569 |
| 3513 virtual Representation RequiredInputRepresentation(int index) const { | 3570 virtual Representation RequiredInputRepresentation(int index) const { |
| 3514 // The key is supposed to be Integer32, but the base pointer | 3571 // The key is supposed to be Integer32, but the base pointer |
| 3515 // for the element load is a naked pointer. | 3572 // for the element load is a naked pointer. |
| 3516 return (index == 1) ? Representation::Integer32() | 3573 return index == 0 |
| 3517 : Representation::External(); | 3574 ? Representation::External() |
| 3575 : Representation::Integer32(); |
| 3518 } | 3576 } |
| 3519 | 3577 |
| 3520 HValue* external_pointer() { return OperandAt(0); } | 3578 HValue* external_pointer() { return OperandAt(0); } |
| 3521 HValue* key() { return OperandAt(1); } | 3579 HValue* key() { return OperandAt(1); } |
| 3522 JSObject::ElementsKind elements_kind() const { return elements_kind_; } | 3580 JSObject::ElementsKind elements_kind() const { return elements_kind_; } |
| 3523 | 3581 |
| 3524 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) | 3582 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) |
| 3525 | 3583 |
| 3526 protected: | 3584 protected: |
| 3527 virtual bool DataEquals(HValue* other) { | 3585 virtual bool DataEquals(HValue* other) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3553 virtual void PrintDataTo(StringStream* stream); | 3611 virtual void PrintDataTo(StringStream* stream); |
| 3554 | 3612 |
| 3555 virtual Representation RequiredInputRepresentation(int index) const { | 3613 virtual Representation RequiredInputRepresentation(int index) const { |
| 3556 return Representation::Tagged(); | 3614 return Representation::Tagged(); |
| 3557 } | 3615 } |
| 3558 | 3616 |
| 3559 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 3617 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
| 3560 }; | 3618 }; |
| 3561 | 3619 |
| 3562 | 3620 |
| 3563 class HStoreNamedField: public HBinaryOperation { | 3621 class HStoreNamedField: public HTemplateInstruction<2> { |
| 3564 public: | 3622 public: |
| 3565 HStoreNamedField(HValue* obj, | 3623 HStoreNamedField(HValue* obj, |
| 3566 Handle<String> name, | 3624 Handle<String> name, |
| 3567 HValue* val, | 3625 HValue* val, |
| 3568 bool in_object, | 3626 bool in_object, |
| 3569 int offset) | 3627 int offset) |
| 3570 : HBinaryOperation(obj, val), | 3628 : name_(name), |
| 3571 name_(name), | |
| 3572 is_in_object_(in_object), | 3629 is_in_object_(in_object), |
| 3573 offset_(offset) { | 3630 offset_(offset) { |
| 3631 SetOperandAt(0, obj); |
| 3632 SetOperandAt(1, val); |
| 3574 if (is_in_object_) { | 3633 if (is_in_object_) { |
| 3575 SetFlag(kChangesInobjectFields); | 3634 SetFlag(kChangesInobjectFields); |
| 3576 } else { | 3635 } else { |
| 3577 SetFlag(kChangesBackingStoreFields); | 3636 SetFlag(kChangesBackingStoreFields); |
| 3578 } | 3637 } |
| 3579 } | 3638 } |
| 3580 | 3639 |
| 3581 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 3640 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 3582 | 3641 |
| 3583 virtual Representation RequiredInputRepresentation(int index) const { | 3642 virtual Representation RequiredInputRepresentation(int index) const { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3645 public: | 3704 public: |
| 3646 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { | 3705 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { |
| 3647 SetOperandAt(0, obj); | 3706 SetOperandAt(0, obj); |
| 3648 SetOperandAt(1, key); | 3707 SetOperandAt(1, key); |
| 3649 SetOperandAt(2, val); | 3708 SetOperandAt(2, val); |
| 3650 SetFlag(kChangesArrayElements); | 3709 SetFlag(kChangesArrayElements); |
| 3651 } | 3710 } |
| 3652 | 3711 |
| 3653 virtual Representation RequiredInputRepresentation(int index) const { | 3712 virtual Representation RequiredInputRepresentation(int index) const { |
| 3654 // The key is supposed to be Integer32. | 3713 // The key is supposed to be Integer32. |
| 3655 return (index == 1) ? Representation::Integer32() | 3714 return index == 1 |
| 3715 ? Representation::Integer32() |
| 3656 : Representation::Tagged(); | 3716 : Representation::Tagged(); |
| 3657 } | 3717 } |
| 3658 | 3718 |
| 3659 HValue* object() { return OperandAt(0); } | 3719 HValue* object() { return OperandAt(0); } |
| 3660 HValue* key() { return OperandAt(1); } | 3720 HValue* key() { return OperandAt(1); } |
| 3661 HValue* value() { return OperandAt(2); } | 3721 HValue* value() { return OperandAt(2); } |
| 3662 | 3722 |
| 3663 bool NeedsWriteBarrier() { | 3723 bool NeedsWriteBarrier() { |
| 3664 return StoringValueNeedsWriteBarrier(value()); | 3724 return StoringValueNeedsWriteBarrier(value()); |
| 3665 } | 3725 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3741 | 3801 |
| 3742 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 3802 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
| 3743 | 3803 |
| 3744 private: | 3804 private: |
| 3745 bool strict_mode_; | 3805 bool strict_mode_; |
| 3746 }; | 3806 }; |
| 3747 | 3807 |
| 3748 | 3808 |
| 3749 class HStringAdd: public HBinaryOperation { | 3809 class HStringAdd: public HBinaryOperation { |
| 3750 public: | 3810 public: |
| 3751 HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { | 3811 HStringAdd(HValue* context, HValue* left, HValue* right) |
| 3812 : HBinaryOperation(context, left, right) { |
| 3752 set_representation(Representation::Tagged()); | 3813 set_representation(Representation::Tagged()); |
| 3753 SetFlag(kUseGVN); | 3814 SetFlag(kUseGVN); |
| 3754 SetFlag(kDependsOnMaps); | 3815 SetFlag(kDependsOnMaps); |
| 3755 } | 3816 } |
| 3756 | 3817 |
| 3757 virtual Representation RequiredInputRepresentation(int index) const { | 3818 virtual Representation RequiredInputRepresentation(int index) const { |
| 3758 return Representation::Tagged(); | 3819 return Representation::Tagged(); |
| 3759 } | 3820 } |
| 3760 | 3821 |
| 3761 virtual HType CalculateInferredType() { | 3822 virtual HType CalculateInferredType() { |
| 3762 return HType::String(); | 3823 return HType::String(); |
| 3763 } | 3824 } |
| 3764 | 3825 |
| 3765 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 3826 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
| 3766 | 3827 |
| 3767 protected: | 3828 protected: |
| 3768 virtual bool DataEquals(HValue* other) { return true; } | 3829 virtual bool DataEquals(HValue* other) { return true; } |
| 3769 }; | 3830 }; |
| 3770 | 3831 |
| 3771 | 3832 |
| 3772 class HStringCharCodeAt: public HBinaryOperation { | 3833 class HStringCharCodeAt: public HTemplateInstruction<3> { |
| 3773 public: | 3834 public: |
| 3774 HStringCharCodeAt(HValue* string, HValue* index) | 3835 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 3775 : HBinaryOperation(string, index) { | 3836 SetOperandAt(0, context); |
| 3837 SetOperandAt(1, string); |
| 3838 SetOperandAt(2, index); |
| 3776 set_representation(Representation::Integer32()); | 3839 set_representation(Representation::Integer32()); |
| 3777 SetFlag(kUseGVN); | 3840 SetFlag(kUseGVN); |
| 3778 SetFlag(kDependsOnMaps); | 3841 SetFlag(kDependsOnMaps); |
| 3779 } | 3842 } |
| 3780 | 3843 |
| 3781 virtual Representation RequiredInputRepresentation(int index) const { | 3844 virtual Representation RequiredInputRepresentation(int index) const { |
| 3782 // The index is supposed to be Integer32. | 3845 // The index is supposed to be Integer32. |
| 3783 return (index == 1) ? Representation::Integer32() | 3846 return index == 2 |
| 3847 ? Representation::Integer32() |
| 3784 : Representation::Tagged(); | 3848 : Representation::Tagged(); |
| 3785 } | 3849 } |
| 3786 | 3850 |
| 3787 HValue* string() { return OperandAt(0); } | 3851 HValue* context() { return OperandAt(0); } |
| 3788 HValue* index() { return OperandAt(1); } | 3852 HValue* string() { return OperandAt(1); } |
| 3853 HValue* index() { return OperandAt(2); } |
| 3789 | 3854 |
| 3790 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 3855 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
| 3791 | 3856 |
| 3792 protected: | 3857 protected: |
| 3793 virtual bool DataEquals(HValue* other) { return true; } | 3858 virtual bool DataEquals(HValue* other) { return true; } |
| 3794 | 3859 |
| 3795 virtual Range* InferRange() { | 3860 virtual Range* InferRange() { |
| 3796 return new Range(0, String::kMaxUC16CharCode); | 3861 return new Range(0, String::kMaxUC16CharCode); |
| 3797 } | 3862 } |
| 3798 }; | 3863 }; |
| 3799 | 3864 |
| 3800 | 3865 |
| 3801 class HStringCharFromCode: public HUnaryOperation { | 3866 class HStringCharFromCode: public HTemplateInstruction<2> { |
| 3802 public: | 3867 public: |
| 3803 explicit HStringCharFromCode(HValue* char_code) : HUnaryOperation(char_code) { | 3868 HStringCharFromCode(HValue* context, HValue* char_code) { |
| 3804 set_representation(Representation::Tagged()); | 3869 SetOperandAt(0, context); |
| 3870 SetOperandAt(1, char_code); |
| 3871 set_representation(Representation::Tagged()); |
| 3805 SetFlag(kUseGVN); | 3872 SetFlag(kUseGVN); |
| 3806 } | 3873 } |
| 3807 | 3874 |
| 3808 virtual Representation RequiredInputRepresentation(int index) const { | 3875 virtual Representation RequiredInputRepresentation(int index) const { |
| 3809 return Representation::Integer32(); | 3876 return index == 0 |
| 3877 ? Representation::Tagged() |
| 3878 : Representation::Integer32(); |
| 3810 } | 3879 } |
| 3811 | 3880 |
| 3881 HValue* context() { return OperandAt(0); } |
| 3882 HValue* value() { return OperandAt(1); } |
| 3883 |
| 3812 virtual bool DataEquals(HValue* other) { return true; } | 3884 virtual bool DataEquals(HValue* other) { return true; } |
| 3813 | 3885 |
| 3814 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 3886 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
| 3815 }; | 3887 }; |
| 3816 | 3888 |
| 3817 | 3889 |
| 3818 class HStringLength: public HUnaryOperation { | 3890 class HStringLength: public HUnaryOperation { |
| 3819 public: | 3891 public: |
| 3820 explicit HStringLength(HValue* string) : HUnaryOperation(string) { | 3892 explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
| 3821 set_representation(Representation::Tagged()); | 3893 set_representation(Representation::Tagged()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 | 3925 |
| 3854 int literal_index() const { return literal_index_; } | 3926 int literal_index() const { return literal_index_; } |
| 3855 int depth() const { return depth_; } | 3927 int depth() const { return depth_; } |
| 3856 | 3928 |
| 3857 private: | 3929 private: |
| 3858 int literal_index_; | 3930 int literal_index_; |
| 3859 int depth_; | 3931 int depth_; |
| 3860 }; | 3932 }; |
| 3861 | 3933 |
| 3862 | 3934 |
| 3863 class HArrayLiteral: public HMaterializedLiteral<0> { | 3935 class HArrayLiteral: public HMaterializedLiteral<1> { |
| 3864 public: | 3936 public: |
| 3865 HArrayLiteral(Handle<FixedArray> constant_elements, | 3937 HArrayLiteral(HValue* context, |
| 3938 Handle<FixedArray> constant_elements, |
| 3866 int length, | 3939 int length, |
| 3867 int literal_index, | 3940 int literal_index, |
| 3868 int depth) | 3941 int depth) |
| 3869 : HMaterializedLiteral<0>(literal_index, depth), | 3942 : HMaterializedLiteral<1>(literal_index, depth), |
| 3870 length_(length), | 3943 length_(length), |
| 3871 constant_elements_(constant_elements) {} | 3944 constant_elements_(constant_elements) { |
| 3945 SetOperandAt(0, context); |
| 3946 } |
| 3872 | 3947 |
| 3948 HValue* context() { return OperandAt(0); } |
| 3873 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 3949 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| 3874 int length() const { return length_; } | 3950 int length() const { return length_; } |
| 3875 | 3951 |
| 3876 bool IsCopyOnWrite() const; | 3952 bool IsCopyOnWrite() const; |
| 3877 | 3953 |
| 3878 virtual Representation RequiredInputRepresentation(int index) const { | 3954 virtual Representation RequiredInputRepresentation(int index) const { |
| 3879 return Representation::None(); | 3955 return Representation::Tagged(); |
| 3880 } | 3956 } |
| 3881 | 3957 |
| 3882 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) | 3958 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
| 3883 | 3959 |
| 3884 private: | 3960 private: |
| 3885 int length_; | 3961 int length_; |
| 3886 Handle<FixedArray> constant_elements_; | 3962 Handle<FixedArray> constant_elements_; |
| 3887 }; | 3963 }; |
| 3888 | 3964 |
| 3889 | 3965 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3915 | 3991 |
| 3916 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) | 3992 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
| 3917 | 3993 |
| 3918 private: | 3994 private: |
| 3919 Handle<FixedArray> constant_properties_; | 3995 Handle<FixedArray> constant_properties_; |
| 3920 bool fast_elements_; | 3996 bool fast_elements_; |
| 3921 bool has_function_; | 3997 bool has_function_; |
| 3922 }; | 3998 }; |
| 3923 | 3999 |
| 3924 | 4000 |
| 3925 class HRegExpLiteral: public HMaterializedLiteral<0> { | 4001 class HRegExpLiteral: public HMaterializedLiteral<1> { |
| 3926 public: | 4002 public: |
| 3927 HRegExpLiteral(Handle<String> pattern, | 4003 HRegExpLiteral(HValue* context, |
| 4004 Handle<String> pattern, |
| 3928 Handle<String> flags, | 4005 Handle<String> flags, |
| 3929 int literal_index) | 4006 int literal_index) |
| 3930 : HMaterializedLiteral<0>(literal_index, 0), | 4007 : HMaterializedLiteral<1>(literal_index, 0), |
| 3931 pattern_(pattern), | 4008 pattern_(pattern), |
| 3932 flags_(flags) { } | 4009 flags_(flags) { |
| 4010 SetOperandAt(0, context); |
| 4011 } |
| 3933 | 4012 |
| 4013 HValue* context() { return OperandAt(0); } |
| 3934 Handle<String> pattern() { return pattern_; } | 4014 Handle<String> pattern() { return pattern_; } |
| 3935 Handle<String> flags() { return flags_; } | 4015 Handle<String> flags() { return flags_; } |
| 3936 | 4016 |
| 3937 virtual Representation RequiredInputRepresentation(int index) const { | 4017 virtual Representation RequiredInputRepresentation(int index) const { |
| 3938 return Representation::None(); | 4018 return Representation::Tagged(); |
| 3939 } | 4019 } |
| 3940 | 4020 |
| 3941 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) | 4021 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
| 3942 | 4022 |
| 3943 private: | 4023 private: |
| 3944 Handle<String> pattern_; | 4024 Handle<String> pattern_; |
| 3945 Handle<String> flags_; | 4025 Handle<String> flags_; |
| 3946 }; | 4026 }; |
| 3947 | 4027 |
| 3948 | 4028 |
| 3949 class HFunctionLiteral: public HTemplateInstruction<0> { | 4029 class HFunctionLiteral: public HTemplateInstruction<1> { |
| 3950 public: | 4030 public: |
| 3951 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) | 4031 HFunctionLiteral(HValue* context, |
| 4032 Handle<SharedFunctionInfo> shared, |
| 4033 bool pretenure) |
| 3952 : shared_info_(shared), pretenure_(pretenure) { | 4034 : shared_info_(shared), pretenure_(pretenure) { |
| 4035 SetOperandAt(0, context); |
| 3953 set_representation(Representation::Tagged()); | 4036 set_representation(Representation::Tagged()); |
| 3954 } | 4037 } |
| 3955 | 4038 |
| 4039 HValue* context() { return OperandAt(0); } |
| 4040 |
| 3956 virtual Representation RequiredInputRepresentation(int index) const { | 4041 virtual Representation RequiredInputRepresentation(int index) const { |
| 3957 return Representation::None(); | 4042 return Representation::Tagged(); |
| 3958 } | 4043 } |
| 3959 | 4044 |
| 3960 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 4045 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
| 3961 | 4046 |
| 3962 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 4047 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| 3963 bool pretenure() const { return pretenure_; } | 4048 bool pretenure() const { return pretenure_; } |
| 3964 | 4049 |
| 3965 private: | 4050 private: |
| 3966 Handle<SharedFunctionInfo> shared_info_; | 4051 Handle<SharedFunctionInfo> shared_info_; |
| 3967 bool pretenure_; | 4052 bool pretenure_; |
| 3968 }; | 4053 }; |
| 3969 | 4054 |
| 3970 | 4055 |
| 3971 class HTypeof: public HUnaryOperation { | 4056 class HTypeof: public HTemplateInstruction<2> { |
| 3972 public: | 4057 public: |
| 3973 explicit HTypeof(HValue* value) : HUnaryOperation(value) { | 4058 explicit HTypeof(HValue* context, HValue* value) { |
| 4059 SetOperandAt(0, context); |
| 4060 SetOperandAt(1, value); |
| 3974 set_representation(Representation::Tagged()); | 4061 set_representation(Representation::Tagged()); |
| 3975 } | 4062 } |
| 3976 | 4063 |
| 4064 HValue* context() { return OperandAt(0); } |
| 4065 HValue* value() { return OperandAt(1); } |
| 4066 |
| 3977 virtual Representation RequiredInputRepresentation(int index) const { | 4067 virtual Representation RequiredInputRepresentation(int index) const { |
| 3978 return Representation::Tagged(); | 4068 return Representation::Tagged(); |
| 3979 } | 4069 } |
| 3980 | 4070 |
| 3981 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 4071 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
| 3982 }; | 4072 }; |
| 3983 | 4073 |
| 3984 | 4074 |
| 3985 class HToFastProperties: public HUnaryOperation { | 4075 class HToFastProperties: public HUnaryOperation { |
| 3986 public: | 4076 public: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4009 virtual Representation RequiredInputRepresentation(int index) const { | 4099 virtual Representation RequiredInputRepresentation(int index) const { |
| 4010 return Representation::Tagged(); | 4100 return Representation::Tagged(); |
| 4011 } | 4101 } |
| 4012 | 4102 |
| 4013 DECLARE_CONCRETE_INSTRUCTION(ValueOf) | 4103 DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
| 4014 }; | 4104 }; |
| 4015 | 4105 |
| 4016 | 4106 |
| 4017 class HDeleteProperty: public HBinaryOperation { | 4107 class HDeleteProperty: public HBinaryOperation { |
| 4018 public: | 4108 public: |
| 4019 HDeleteProperty(HValue* obj, HValue* key) | 4109 HDeleteProperty(HValue* context, HValue* obj, HValue* key) |
| 4020 : HBinaryOperation(obj, key) { | 4110 : HBinaryOperation(context, obj, key) { |
| 4021 set_representation(Representation::Tagged()); | 4111 set_representation(Representation::Tagged()); |
| 4022 SetAllSideEffects(); | 4112 SetAllSideEffects(); |
| 4023 } | 4113 } |
| 4024 | 4114 |
| 4025 virtual Representation RequiredInputRepresentation(int index) const { | 4115 virtual Representation RequiredInputRepresentation(int index) const { |
| 4026 return Representation::Tagged(); | 4116 return Representation::Tagged(); |
| 4027 } | 4117 } |
| 4028 | 4118 |
| 4029 virtual HType CalculateInferredType(); | 4119 virtual HType CalculateInferredType(); |
| 4030 | 4120 |
| 4031 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) | 4121 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) |
| 4032 | 4122 |
| 4033 HValue* object() { return left(); } | 4123 HValue* object() { return left(); } |
| 4034 HValue* key() { return right(); } | 4124 HValue* key() { return right(); } |
| 4035 }; | 4125 }; |
| 4036 | 4126 |
| 4037 | 4127 |
| 4038 class HIn: public HTemplateInstruction<2> { | 4128 class HIn: public HTemplateInstruction<3> { |
| 4039 public: | 4129 public: |
| 4040 HIn(HValue* key, HValue* object) { | 4130 HIn(HValue* context, HValue* key, HValue* object) { |
| 4041 SetOperandAt(0, key); | 4131 SetOperandAt(0, context); |
| 4042 SetOperandAt(1, object); | 4132 SetOperandAt(1, key); |
| 4133 SetOperandAt(2, object); |
| 4043 set_representation(Representation::Tagged()); | 4134 set_representation(Representation::Tagged()); |
| 4044 SetAllSideEffects(); | 4135 SetAllSideEffects(); |
| 4045 } | 4136 } |
| 4046 | 4137 |
| 4047 HValue* key() { return OperandAt(0); } | 4138 HValue* context() { return OperandAt(0); } |
| 4048 HValue* object() { return OperandAt(1); } | 4139 HValue* key() { return OperandAt(1); } |
| 4140 HValue* object() { return OperandAt(2); } |
| 4049 | 4141 |
| 4050 virtual Representation RequiredInputRepresentation(int index) const { | 4142 virtual Representation RequiredInputRepresentation(int index) const { |
| 4051 return Representation::Tagged(); | 4143 return Representation::Tagged(); |
| 4052 } | 4144 } |
| 4053 | 4145 |
| 4054 virtual HType CalculateInferredType() { | 4146 virtual HType CalculateInferredType() { |
| 4055 return HType::Boolean(); | 4147 return HType::Boolean(); |
| 4056 } | 4148 } |
| 4057 | 4149 |
| 4058 virtual void PrintDataTo(StringStream* stream); | 4150 virtual void PrintDataTo(StringStream* stream); |
| 4059 | 4151 |
| 4060 DECLARE_CONCRETE_INSTRUCTION(In) | 4152 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4061 }; | 4153 }; |
| 4062 | 4154 |
| 4063 #undef DECLARE_INSTRUCTION | 4155 #undef DECLARE_INSTRUCTION |
| 4064 #undef DECLARE_CONCRETE_INSTRUCTION | 4156 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4065 | 4157 |
| 4066 } } // namespace v8::internal | 4158 } } // namespace v8::internal |
| 4067 | 4159 |
| 4068 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4160 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |