| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 enum Flag { | 476 enum Flag { |
| 477 // Declare global value numbering flags. | 477 // Declare global value numbering flags. |
| 478 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 478 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
| 479 GVN_FLAG_LIST(DECLARE_DO) | 479 GVN_FLAG_LIST(DECLARE_DO) |
| 480 #undef DECLARE_DO | 480 #undef DECLARE_DO |
| 481 kFlexibleRepresentation, | 481 kFlexibleRepresentation, |
| 482 kUseGVN, | 482 kUseGVN, |
| 483 kCanOverflow, | 483 kCanOverflow, |
| 484 kBailoutOnMinusZero, | 484 kBailoutOnMinusZero, |
| 485 kCanBeDivByZero, | 485 kCanBeDivByZero, |
| 486 kDeoptimizeOnUndefined, |
| 486 kIsArguments, | 487 kIsArguments, |
| 487 kTruncatingToInt32, | 488 kTruncatingToInt32, |
| 488 kLastFlag = kTruncatingToInt32 | 489 kLastFlag = kTruncatingToInt32 |
| 489 }; | 490 }; |
| 490 | 491 |
| 491 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 492 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 492 | 493 |
| 493 static const int kChangesToDependsFlagsLeftShift = 1; | 494 static const int kChangesToDependsFlagsLeftShift = 1; |
| 494 | 495 |
| 495 static int ChangesFlagsMask() { | 496 static int ChangesFlagsMask() { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1027 |
| 1027 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1028 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1028 }; | 1029 }; |
| 1029 | 1030 |
| 1030 | 1031 |
| 1031 class HChange: public HUnaryOperation { | 1032 class HChange: public HUnaryOperation { |
| 1032 public: | 1033 public: |
| 1033 HChange(HValue* value, | 1034 HChange(HValue* value, |
| 1034 Representation from, | 1035 Representation from, |
| 1035 Representation to, | 1036 Representation to, |
| 1036 bool is_truncating) | 1037 bool is_truncating, |
| 1037 : HUnaryOperation(value), from_(from) { | 1038 bool deoptimize_on_undefined) |
| 1039 : HUnaryOperation(value), |
| 1040 from_(from), |
| 1041 deoptimize_on_undefined_(deoptimize_on_undefined) { |
| 1038 ASSERT(!from.IsNone() && !to.IsNone()); | 1042 ASSERT(!from.IsNone() && !to.IsNone()); |
| 1039 ASSERT(!from.Equals(to)); | 1043 ASSERT(!from.Equals(to)); |
| 1040 set_representation(to); | 1044 set_representation(to); |
| 1041 SetFlag(kUseGVN); | 1045 SetFlag(kUseGVN); |
| 1042 if (is_truncating) SetFlag(kTruncatingToInt32); | 1046 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 1043 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 1047 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
| 1044 value->range()->IsInSmiRange()) { | 1048 value->range()->IsInSmiRange()) { |
| 1045 set_type(HType::Smi()); | 1049 set_type(HType::Smi()); |
| 1046 } | 1050 } |
| 1047 } | 1051 } |
| 1048 | 1052 |
| 1049 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1053 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1050 | 1054 |
| 1051 Representation from() const { return from_; } | 1055 Representation from() const { return from_; } |
| 1052 Representation to() const { return representation(); } | 1056 Representation to() const { return representation(); } |
| 1057 bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } |
| 1053 virtual Representation RequiredInputRepresentation(int index) const { | 1058 virtual Representation RequiredInputRepresentation(int index) const { |
| 1054 return from_; | 1059 return from_; |
| 1055 } | 1060 } |
| 1056 | 1061 |
| 1057 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1062 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
| 1058 | 1063 |
| 1059 virtual void PrintDataTo(StringStream* stream); | 1064 virtual void PrintDataTo(StringStream* stream); |
| 1060 | 1065 |
| 1061 DECLARE_CONCRETE_INSTRUCTION(Change) | 1066 DECLARE_CONCRETE_INSTRUCTION(Change) |
| 1062 | 1067 |
| 1063 protected: | 1068 protected: |
| 1064 virtual bool DataEquals(HValue* other) { | 1069 virtual bool DataEquals(HValue* other) { |
| 1065 if (!other->IsChange()) return false; | 1070 if (!other->IsChange()) return false; |
| 1066 HChange* change = HChange::cast(other); | 1071 HChange* change = HChange::cast(other); |
| 1067 return value() == change->value() | 1072 return value() == change->value() |
| 1068 && to().Equals(change->to()); | 1073 && to().Equals(change->to()) |
| 1074 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
| 1069 } | 1075 } |
| 1070 | 1076 |
| 1071 private: | 1077 private: |
| 1072 Representation from_; | 1078 Representation from_; |
| 1079 bool deoptimize_on_undefined_; |
| 1073 }; | 1080 }; |
| 1074 | 1081 |
| 1075 | 1082 |
| 1076 class HClampToUint8: public HUnaryOperation { | 1083 class HClampToUint8: public HUnaryOperation { |
| 1077 public: | 1084 public: |
| 1078 explicit HClampToUint8(HValue* value) | 1085 explicit HClampToUint8(HValue* value) |
| 1079 : HUnaryOperation(value), | 1086 : HUnaryOperation(value), |
| 1080 input_rep_(Representation::None()) { | 1087 input_rep_(Representation::None()) { |
| 1081 SetFlag(kFlexibleRepresentation); | 1088 SetFlag(kFlexibleRepresentation); |
| 1082 set_representation(Representation::Tagged()); | 1089 set_representation(Representation::Tagged()); |
| (...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3962 | 3969 |
| 3963 DECLARE_CONCRETE_INSTRUCTION(In) | 3970 DECLARE_CONCRETE_INSTRUCTION(In) |
| 3964 }; | 3971 }; |
| 3965 | 3972 |
| 3966 #undef DECLARE_INSTRUCTION | 3973 #undef DECLARE_INSTRUCTION |
| 3967 #undef DECLARE_CONCRETE_INSTRUCTION | 3974 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3968 | 3975 |
| 3969 } } // namespace v8::internal | 3976 } } // namespace v8::internal |
| 3970 | 3977 |
| 3971 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3978 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |