| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 enum Flag { | 480 enum Flag { |
| 481 // Declare global value numbering flags. | 481 // Declare global value numbering flags. |
| 482 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 482 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
| 483 GVN_FLAG_LIST(DECLARE_DO) | 483 GVN_FLAG_LIST(DECLARE_DO) |
| 484 #undef DECLARE_DO | 484 #undef DECLARE_DO |
| 485 kFlexibleRepresentation, | 485 kFlexibleRepresentation, |
| 486 kUseGVN, | 486 kUseGVN, |
| 487 kCanOverflow, | 487 kCanOverflow, |
| 488 kBailoutOnMinusZero, | 488 kBailoutOnMinusZero, |
| 489 kCanBeDivByZero, | 489 kCanBeDivByZero, |
| 490 kDeoptimizeOnUndefined, |
| 490 kIsArguments, | 491 kIsArguments, |
| 491 kTruncatingToInt32, | 492 kTruncatingToInt32, |
| 492 kLastFlag = kTruncatingToInt32 | 493 kLastFlag = kTruncatingToInt32 |
| 493 }; | 494 }; |
| 494 | 495 |
| 495 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 496 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 496 | 497 |
| 497 static const int kChangesToDependsFlagsLeftShift = 1; | 498 static const int kChangesToDependsFlagsLeftShift = 1; |
| 498 | 499 |
| 499 static int ChangesFlagsMask() { | 500 static int ChangesFlagsMask() { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1061 |
| 1061 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1062 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1062 }; | 1063 }; |
| 1063 | 1064 |
| 1064 | 1065 |
| 1065 class HChange: public HUnaryOperation { | 1066 class HChange: public HUnaryOperation { |
| 1066 public: | 1067 public: |
| 1067 HChange(HValue* value, | 1068 HChange(HValue* value, |
| 1068 Representation from, | 1069 Representation from, |
| 1069 Representation to, | 1070 Representation to, |
| 1070 bool is_truncating) | 1071 bool is_truncating, |
| 1071 : HUnaryOperation(value), from_(from) { | 1072 bool deoptimize_on_undefined) |
| 1073 : HUnaryOperation(value), |
| 1074 from_(from), |
| 1075 deoptimize_on_undefined_(deoptimize_on_undefined) { |
| 1072 ASSERT(!from.IsNone() && !to.IsNone()); | 1076 ASSERT(!from.IsNone() && !to.IsNone()); |
| 1073 ASSERT(!from.Equals(to)); | 1077 ASSERT(!from.Equals(to)); |
| 1074 set_representation(to); | 1078 set_representation(to); |
| 1075 SetFlag(kUseGVN); | 1079 SetFlag(kUseGVN); |
| 1076 if (is_truncating) SetFlag(kTruncatingToInt32); | 1080 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 1077 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 1081 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
| 1078 value->range()->IsInSmiRange()) { | 1082 value->range()->IsInSmiRange()) { |
| 1079 set_type(HType::Smi()); | 1083 set_type(HType::Smi()); |
| 1080 } | 1084 } |
| 1081 } | 1085 } |
| 1082 | 1086 |
| 1083 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1087 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1084 | 1088 |
| 1085 Representation from() const { return from_; } | 1089 Representation from() const { return from_; } |
| 1086 Representation to() const { return representation(); } | 1090 Representation to() const { return representation(); } |
| 1091 bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } |
| 1087 virtual Representation RequiredInputRepresentation(int index) const { | 1092 virtual Representation RequiredInputRepresentation(int index) const { |
| 1088 return from_; | 1093 return from_; |
| 1089 } | 1094 } |
| 1090 | 1095 |
| 1091 virtual void PrintDataTo(StringStream* stream); | 1096 virtual void PrintDataTo(StringStream* stream); |
| 1092 | 1097 |
| 1093 DECLARE_CONCRETE_INSTRUCTION(Change) | 1098 DECLARE_CONCRETE_INSTRUCTION(Change) |
| 1094 | 1099 |
| 1095 protected: | 1100 protected: |
| 1096 virtual bool DataEquals(HValue* other) { | 1101 virtual bool DataEquals(HValue* other) { |
| 1097 if (!other->IsChange()) return false; | 1102 if (!other->IsChange()) return false; |
| 1098 HChange* change = HChange::cast(other); | 1103 HChange* change = HChange::cast(other); |
| 1099 return value() == change->value() | 1104 return value() == change->value() |
| 1100 && to().Equals(change->to()); | 1105 && to().Equals(change->to()) |
| 1106 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
| 1101 } | 1107 } |
| 1102 | 1108 |
| 1103 private: | 1109 private: |
| 1104 Representation from_; | 1110 Representation from_; |
| 1111 bool deoptimize_on_undefined_; |
| 1105 }; | 1112 }; |
| 1106 | 1113 |
| 1107 | 1114 |
| 1108 class HClampToUint8: public HUnaryOperation { | 1115 class HClampToUint8: public HUnaryOperation { |
| 1109 public: | 1116 public: |
| 1110 explicit HClampToUint8(HValue* value) | 1117 explicit HClampToUint8(HValue* value) |
| 1111 : HUnaryOperation(value), | 1118 : HUnaryOperation(value), |
| 1112 input_rep_(Representation::None()) { | 1119 input_rep_(Representation::None()) { |
| 1113 SetFlag(kFlexibleRepresentation); | 1120 SetFlag(kFlexibleRepresentation); |
| 1114 set_representation(Representation::Tagged()); | 1121 set_representation(Representation::Tagged()); |
| (...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4029 | 4036 |
| 4030 DECLARE_CONCRETE_INSTRUCTION(In) | 4037 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4031 }; | 4038 }; |
| 4032 | 4039 |
| 4033 #undef DECLARE_INSTRUCTION | 4040 #undef DECLARE_INSTRUCTION |
| 4034 #undef DECLARE_CONCRETE_INSTRUCTION | 4041 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4035 | 4042 |
| 4036 } } // namespace v8::internal | 4043 } } // namespace v8::internal |
| 4037 | 4044 |
| 4038 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4045 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |