| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 enum Flag { | 417 enum Flag { |
| 418 // Declare global value numbering flags. | 418 // Declare global value numbering flags. |
| 419 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 419 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
| 420 GVN_FLAG_LIST(DECLARE_DO) | 420 GVN_FLAG_LIST(DECLARE_DO) |
| 421 #undef DECLARE_DO | 421 #undef DECLARE_DO |
| 422 kFlexibleRepresentation, | 422 kFlexibleRepresentation, |
| 423 kUseGVN, | 423 kUseGVN, |
| 424 kCanOverflow, | 424 kCanOverflow, |
| 425 kBailoutOnMinusZero, | 425 kBailoutOnMinusZero, |
| 426 kCanBeDivByZero, | 426 kCanBeDivByZero, |
| 427 kDeoptimizeOnUndefined, |
| 427 kIsArguments, | 428 kIsArguments, |
| 428 kTruncatingToInt32, | 429 kTruncatingToInt32, |
| 429 kLastFlag = kTruncatingToInt32 | 430 kLastFlag = kTruncatingToInt32 |
| 430 }; | 431 }; |
| 431 | 432 |
| 432 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 433 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 433 | 434 |
| 434 static const int kChangesToDependsFlagsLeftShift = 1; | 435 static const int kChangesToDependsFlagsLeftShift = 1; |
| 435 | 436 |
| 436 static int ChangesFlagsMask() { | 437 static int ChangesFlagsMask() { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 | 932 |
| 932 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") | 933 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 933 }; | 934 }; |
| 934 | 935 |
| 935 | 936 |
| 936 class HChange: public HUnaryOperation { | 937 class HChange: public HUnaryOperation { |
| 937 public: | 938 public: |
| 938 HChange(HValue* value, | 939 HChange(HValue* value, |
| 939 Representation from, | 940 Representation from, |
| 940 Representation to, | 941 Representation to, |
| 941 bool is_truncating) | 942 bool is_truncating, |
| 942 : HUnaryOperation(value), from_(from) { | 943 bool deoptimize_on_undefined) |
| 944 : HUnaryOperation(value), |
| 945 from_(from), |
| 946 deoptimize_on_undefined_(deoptimize_on_undefined) { |
| 943 ASSERT(!from.IsNone() && !to.IsNone()); | 947 ASSERT(!from.IsNone() && !to.IsNone()); |
| 944 ASSERT(!from.Equals(to)); | 948 ASSERT(!from.Equals(to)); |
| 945 set_representation(to); | 949 set_representation(to); |
| 946 SetFlag(kUseGVN); | 950 SetFlag(kUseGVN); |
| 947 if (is_truncating) SetFlag(kTruncatingToInt32); | 951 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 948 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 952 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
| 949 value->range()->IsInSmiRange()) { | 953 value->range()->IsInSmiRange()) { |
| 950 set_type(HType::Smi()); | 954 set_type(HType::Smi()); |
| 951 } | 955 } |
| 952 } | 956 } |
| 953 | 957 |
| 954 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 958 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 955 | 959 |
| 956 Representation from() const { return from_; } | 960 Representation from() const { return from_; } |
| 957 Representation to() const { return representation(); } | 961 Representation to() const { return representation(); } |
| 962 bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } |
| 958 virtual Representation RequiredInputRepresentation(int index) const { | 963 virtual Representation RequiredInputRepresentation(int index) const { |
| 959 return from_; | 964 return from_; |
| 960 } | 965 } |
| 961 | 966 |
| 962 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 967 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
| 963 | 968 |
| 964 virtual void PrintDataTo(StringStream* stream); | 969 virtual void PrintDataTo(StringStream* stream); |
| 965 | 970 |
| 966 DECLARE_CONCRETE_INSTRUCTION(Change, | 971 DECLARE_CONCRETE_INSTRUCTION(Change, |
| 967 CanTruncateToInt32() ? "truncate" : "change") | 972 CanTruncateToInt32() ? "truncate" : "change") |
| 968 | 973 |
| 969 protected: | 974 protected: |
| 970 virtual bool DataEquals(HValue* other) { | 975 virtual bool DataEquals(HValue* other) { |
| 971 if (!other->IsChange()) return false; | 976 if (!other->IsChange()) return false; |
| 972 HChange* change = HChange::cast(other); | 977 HChange* change = HChange::cast(other); |
| 973 return value() == change->value() | 978 return value() == change->value() |
| 974 && to().Equals(change->to()); | 979 && to().Equals(change->to()) |
| 980 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
| 975 } | 981 } |
| 976 | 982 |
| 977 private: | 983 private: |
| 978 Representation from_; | 984 Representation from_; |
| 985 bool deoptimize_on_undefined_; |
| 979 }; | 986 }; |
| 980 | 987 |
| 981 | 988 |
| 982 class HSimulate: public HInstruction { | 989 class HSimulate: public HInstruction { |
| 983 public: | 990 public: |
| 984 HSimulate(int ast_id, int pop_count) | 991 HSimulate(int ast_id, int pop_count) |
| 985 : ast_id_(ast_id), | 992 : ast_id_(ast_id), |
| 986 pop_count_(pop_count), | 993 pop_count_(pop_count), |
| 987 values_(2), | 994 values_(2), |
| 988 assigned_indexes_(2) {} | 995 assigned_indexes_(2) {} |
| (...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3671 HValue* object() { return left(); } | 3678 HValue* object() { return left(); } |
| 3672 HValue* key() { return right(); } | 3679 HValue* key() { return right(); } |
| 3673 }; | 3680 }; |
| 3674 | 3681 |
| 3675 #undef DECLARE_INSTRUCTION | 3682 #undef DECLARE_INSTRUCTION |
| 3676 #undef DECLARE_CONCRETE_INSTRUCTION | 3683 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3677 | 3684 |
| 3678 } } // namespace v8::internal | 3685 } } // namespace v8::internal |
| 3679 | 3686 |
| 3680 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3687 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |