| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 Representation representation() const { return representation_; } | 547 Representation representation() const { return representation_; } |
| 548 void ChangeRepresentation(Representation r) { | 548 void ChangeRepresentation(Representation r) { |
| 549 // Representation was already set and is allowed to be changed. | 549 // Representation was already set and is allowed to be changed. |
| 550 ASSERT(!representation_.IsNone()); | 550 ASSERT(!representation_.IsNone()); |
| 551 ASSERT(!r.IsNone()); | 551 ASSERT(!r.IsNone()); |
| 552 ASSERT(CheckFlag(kFlexibleRepresentation)); | 552 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 553 RepresentationChanged(r); | 553 RepresentationChanged(r); |
| 554 representation_ = r; | 554 representation_ = r; |
| 555 } | 555 } |
| 556 | 556 |
| 557 virtual bool IsConvertibleToInteger() const { return true; } |
| 558 |
| 557 HType type() const { return type_; } | 559 HType type() const { return type_; } |
| 558 void set_type(HType type) { | 560 void set_type(HType type) { |
| 559 ASSERT(HasNoUses()); | 561 ASSERT(HasNoUses()); |
| 560 type_ = type; | 562 type_ = type; |
| 561 } | 563 } |
| 562 | 564 |
| 563 // An operation needs to override this function iff: | 565 // An operation needs to override this function iff: |
| 564 // 1) it can produce an int32 output. | 566 // 1) it can produce an int32 output. |
| 565 // 2) the true value of its output can potentially be minus zero. | 567 // 2) the true value of its output can potentially be minus zero. |
| 566 // The implementation must set a flag so that it bails out in the case where | 568 // The implementation must set a flag so that it bails out in the case where |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 virtual bool DataEquals(HValue* other) { return true; } | 1917 virtual bool DataEquals(HValue* other) { return true; } |
| 1916 }; | 1918 }; |
| 1917 | 1919 |
| 1918 | 1920 |
| 1919 class HPhi: public HValue { | 1921 class HPhi: public HValue { |
| 1920 public: | 1922 public: |
| 1921 explicit HPhi(int merged_index) | 1923 explicit HPhi(int merged_index) |
| 1922 : inputs_(2), | 1924 : inputs_(2), |
| 1923 merged_index_(merged_index), | 1925 merged_index_(merged_index), |
| 1924 phi_id_(-1), | 1926 phi_id_(-1), |
| 1925 is_live_(false) { | 1927 is_live_(false), |
| 1928 is_convertible_to_integer_(true) { |
| 1926 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 1929 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| 1927 non_phi_uses_[i] = 0; | 1930 non_phi_uses_[i] = 0; |
| 1928 indirect_uses_[i] = 0; | 1931 indirect_uses_[i] = 0; |
| 1929 } | 1932 } |
| 1930 ASSERT(merged_index >= 0); | 1933 ASSERT(merged_index >= 0); |
| 1931 set_representation(Representation::Tagged()); | 1934 set_representation(Representation::Tagged()); |
| 1932 SetFlag(kFlexibleRepresentation); | 1935 SetFlag(kFlexibleRepresentation); |
| 1933 } | 1936 } |
| 1934 | 1937 |
| 1935 virtual Representation InferredRepresentation() { | 1938 virtual Representation InferredRepresentation() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 int phi_id() { return phi_id_; } | 1996 int phi_id() { return phi_id_; } |
| 1994 bool is_live() { return is_live_; } | 1997 bool is_live() { return is_live_; } |
| 1995 void set_is_live(bool b) { is_live_ = b; } | 1998 void set_is_live(bool b) { is_live_ = b; } |
| 1996 | 1999 |
| 1997 static HPhi* cast(HValue* value) { | 2000 static HPhi* cast(HValue* value) { |
| 1998 ASSERT(value->IsPhi()); | 2001 ASSERT(value->IsPhi()); |
| 1999 return reinterpret_cast<HPhi*>(value); | 2002 return reinterpret_cast<HPhi*>(value); |
| 2000 } | 2003 } |
| 2001 virtual Opcode opcode() const { return HValue::kPhi; } | 2004 virtual Opcode opcode() const { return HValue::kPhi; } |
| 2002 | 2005 |
| 2006 virtual bool IsConvertibleToInteger() const { |
| 2007 return is_convertible_to_integer_; |
| 2008 } |
| 2009 |
| 2010 void set_is_convertible_to_integer(bool b) { |
| 2011 is_convertible_to_integer_ = b; |
| 2012 } |
| 2013 |
| 2003 protected: | 2014 protected: |
| 2004 virtual void DeleteFromGraph(); | 2015 virtual void DeleteFromGraph(); |
| 2005 virtual void InternalSetOperandAt(int index, HValue* value) { | 2016 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 2006 inputs_[index] = value; | 2017 inputs_[index] = value; |
| 2007 } | 2018 } |
| 2008 | 2019 |
| 2009 private: | 2020 private: |
| 2010 ZoneList<HValue*> inputs_; | 2021 ZoneList<HValue*> inputs_; |
| 2011 int merged_index_; | 2022 int merged_index_; |
| 2012 | 2023 |
| 2013 int non_phi_uses_[Representation::kNumRepresentations]; | 2024 int non_phi_uses_[Representation::kNumRepresentations]; |
| 2014 int indirect_uses_[Representation::kNumRepresentations]; | 2025 int indirect_uses_[Representation::kNumRepresentations]; |
| 2015 int phi_id_; | 2026 int phi_id_; |
| 2016 bool is_live_; | 2027 bool is_live_; |
| 2028 bool is_convertible_to_integer_; |
| 2017 }; | 2029 }; |
| 2018 | 2030 |
| 2019 | 2031 |
| 2020 class HArgumentsObject: public HTemplateInstruction<0> { | 2032 class HArgumentsObject: public HTemplateInstruction<0> { |
| 2021 public: | 2033 public: |
| 2022 HArgumentsObject() { | 2034 HArgumentsObject() { |
| 2023 set_representation(Representation::Tagged()); | 2035 set_representation(Representation::Tagged()); |
| 2024 SetFlag(kIsArguments); | 2036 SetFlag(kIsArguments); |
| 2025 } | 2037 } |
| 2026 | 2038 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2037 HConstant(Handle<Object> handle, Representation r); | 2049 HConstant(Handle<Object> handle, Representation r); |
| 2038 | 2050 |
| 2039 Handle<Object> handle() const { return handle_; } | 2051 Handle<Object> handle() const { return handle_; } |
| 2040 | 2052 |
| 2041 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 2053 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
| 2042 | 2054 |
| 2043 virtual Representation RequiredInputRepresentation(int index) const { | 2055 virtual Representation RequiredInputRepresentation(int index) const { |
| 2044 return Representation::None(); | 2056 return Representation::None(); |
| 2045 } | 2057 } |
| 2046 | 2058 |
| 2059 virtual bool IsConvertibleToInteger() const { |
| 2060 if (handle_->IsSmi()) return true; |
| 2061 if (handle_->IsHeapNumber() && |
| 2062 (HeapNumber::cast(*handle_)->value() == |
| 2063 static_cast<double>(NumberToInt32(*handle_)))) return true; |
| 2064 return false; |
| 2065 } |
| 2066 |
| 2047 virtual bool EmitAtUses() { return !representation().IsDouble(); } | 2067 virtual bool EmitAtUses() { return !representation().IsDouble(); } |
| 2048 virtual void PrintDataTo(StringStream* stream); | 2068 virtual void PrintDataTo(StringStream* stream); |
| 2049 virtual HType CalculateInferredType(); | 2069 virtual HType CalculateInferredType(); |
| 2050 bool IsInteger() const { return handle_->IsSmi(); } | 2070 bool IsInteger() const { return handle_->IsSmi(); } |
| 2051 HConstant* CopyToRepresentation(Representation r) const; | 2071 HConstant* CopyToRepresentation(Representation r) const; |
| 2052 HConstant* CopyToTruncatedInt32() const; | 2072 HConstant* CopyToTruncatedInt32() const; |
| 2053 bool HasInteger32Value() const { return has_int32_value_; } | 2073 bool HasInteger32Value() const { return has_int32_value_; } |
| 2054 int32_t Integer32Value() const { | 2074 int32_t Integer32Value() const { |
| 2055 ASSERT(HasInteger32Value()); | 2075 ASSERT(HasInteger32Value()); |
| 2056 return int32_value_; | 2076 return int32_value_; |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3806 | 3826 |
| 3807 DECLARE_CONCRETE_INSTRUCTION(In) | 3827 DECLARE_CONCRETE_INSTRUCTION(In) |
| 3808 }; | 3828 }; |
| 3809 | 3829 |
| 3810 #undef DECLARE_INSTRUCTION | 3830 #undef DECLARE_INSTRUCTION |
| 3811 #undef DECLARE_CONCRETE_INSTRUCTION | 3831 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3812 | 3832 |
| 3813 } } // namespace v8::internal | 3833 } } // namespace v8::internal |
| 3814 | 3834 |
| 3815 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3835 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |