Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/hydrogen-instructions.h

Issue 6615012: Mark HChange that convert to int32 with truncation with the appropiate flag.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 933 }
934 934
935 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 935 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
936 }; 936 };
937 937
938 938
939 class HChange: public HUnaryOperation { 939 class HChange: public HUnaryOperation {
940 public: 940 public:
941 HChange(HValue* value, 941 HChange(HValue* value,
942 Representation from, 942 Representation from,
943 Representation to) 943 Representation to,
944 bool is_truncating)
944 : HUnaryOperation(value), from_(from), to_(to) { 945 : HUnaryOperation(value), from_(from), to_(to) {
945 ASSERT(!from.IsNone() && !to.IsNone()); 946 ASSERT(!from.IsNone() && !to.IsNone());
946 ASSERT(!from.Equals(to)); 947 ASSERT(!from.Equals(to));
947 set_representation(to); 948 set_representation(to);
948 SetFlag(kUseGVN); 949 SetFlag(kUseGVN);
949 950 if (is_truncating) SetFlag(kTruncatingToInt32);
950 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && 951 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL &&
951 value->range()->IsInSmiRange()) { 952 value->range()->IsInSmiRange()) {
952 set_type(HType::Smi()); 953 set_type(HType::Smi());
953 } 954 }
954 } 955 }
955 956
956 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 957 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
957 958
958 Representation from() const { return from_; } 959 Representation from() const { return from_; }
959 Representation to() const { return to_; } 960 Representation to() const { return to_; }
960 virtual Representation RequiredInputRepresentation(int index) const { 961 virtual Representation RequiredInputRepresentation(int index) const {
961 return from_; 962 return from_;
962 } 963 }
963 964
964 bool CanTruncateToInt32() const { 965 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
965 for (int i = 0; i < uses()->length(); ++i) {
966 if (!uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) return false;
967 }
968 return true;
969 }
970 966
971 virtual void PrintDataTo(StringStream* stream); 967 virtual void PrintDataTo(StringStream* stream);
972 968
973 DECLARE_CONCRETE_INSTRUCTION(Change, 969 DECLARE_CONCRETE_INSTRUCTION(Change,
974 CanTruncateToInt32() ? "truncate" : "change") 970 CanTruncateToInt32() ? "truncate" : "change")
975 971
976 protected: 972 protected:
977 virtual bool DataEquals(HValue* other) { 973 virtual bool DataEquals(HValue* other) {
978 if (!other->IsChange()) return false; 974 if (!other->IsChange()) return false;
979 HChange* change = HChange::cast(other); 975 HChange* change = HChange::cast(other);
980 return value() == change->value() 976 return value() == change->value()
981 && to().Equals(change->to()) 977 && to().Equals(change->to());
982 && CanTruncateToInt32() == change->CanTruncateToInt32();
983 } 978 }
984 979
985 private: 980 private:
986 Representation from_; 981 Representation from_;
987 Representation to_; 982 Representation to_;
988 }; 983 };
989 984
990 985
991 class HSimulate: public HInstruction { 986 class HSimulate: public HInstruction {
992 public: 987 public:
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
3484 HValue* object() { return left(); } 3479 HValue* object() { return left(); }
3485 HValue* key() { return right(); } 3480 HValue* key() { return right(); }
3486 }; 3481 };
3487 3482
3488 #undef DECLARE_INSTRUCTION 3483 #undef DECLARE_INSTRUCTION
3489 #undef DECLARE_CONCRETE_INSTRUCTION 3484 #undef DECLARE_CONCRETE_INSTRUCTION
3490 3485
3491 } } // namespace v8::internal 3486 } } // namespace v8::internal
3492 3487
3493 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3488 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698