| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } | 860 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } |
| 861 bool RangeCanInclude(int value) const { | 861 bool RangeCanInclude(int value) const { |
| 862 return !HasRange() || range()->Includes(value); | 862 return !HasRange() || range()->Includes(value); |
| 863 } | 863 } |
| 864 void AddNewRange(Range* r, Zone* zone); | 864 void AddNewRange(Range* r, Zone* zone); |
| 865 void RemoveLastAddedRange(); | 865 void RemoveLastAddedRange(); |
| 866 void ComputeInitialRange(Zone* zone); | 866 void ComputeInitialRange(Zone* zone); |
| 867 | 867 |
| 868 // Escape analysis helpers. | 868 // Escape analysis helpers. |
| 869 virtual bool HasEscapingOperandAt(int index) { return true; } | 869 virtual bool HasEscapingOperandAt(int index) { return true; } |
| 870 virtual bool HasOutOfBoundsAccess(int size) { return false; } |
| 870 | 871 |
| 871 // Representation helpers. | 872 // Representation helpers. |
| 872 virtual Representation observed_input_representation(int index) { | 873 virtual Representation observed_input_representation(int index) { |
| 873 return Representation::None(); | 874 return Representation::None(); |
| 874 } | 875 } |
| 875 virtual Representation RequiredInputRepresentation(int index) = 0; | 876 virtual Representation RequiredInputRepresentation(int index) = 0; |
| 876 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); | 877 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
| 877 | 878 |
| 878 // This gives the instruction an opportunity to replace itself with an | 879 // This gives the instruction an opportunity to replace itself with an |
| 879 // instruction that does the same in some better way. To replace an | 880 // instruction that does the same in some better way. To replace an |
| (...skipping 4100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4980 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 4981 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
| 4981 | 4982 |
| 4982 private: | 4983 private: |
| 4983 CodeStub::Major major_key_; | 4984 CodeStub::Major major_key_; |
| 4984 TranscendentalCache::Type transcendental_type_; | 4985 TranscendentalCache::Type transcendental_type_; |
| 4985 }; | 4986 }; |
| 4986 | 4987 |
| 4987 | 4988 |
| 4988 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { | 4989 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { |
| 4989 public: | 4990 public: |
| 4990 DECLARE_INSTRUCTION_FACTORY_P0(HUnknownOSRValue) | 4991 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); |
| 4992 |
| 4993 virtual void PrintDataTo(StringStream* stream); |
| 4991 | 4994 |
| 4992 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4995 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 4993 return Representation::None(); | 4996 return Representation::None(); |
| 4994 } | 4997 } |
| 4995 | 4998 |
| 4996 void set_incoming_value(HPhi* value) { | 4999 void set_incoming_value(HPhi* value) { incoming_value_ = value; } |
| 4997 incoming_value_ = value; | 5000 HPhi* incoming_value() { return incoming_value_; } |
| 4998 } | 5001 HEnvironment *environment() { return environment_; } |
| 4999 | 5002 int index() { return index_; } |
| 5000 HPhi* incoming_value() { | |
| 5001 return incoming_value_; | |
| 5002 } | |
| 5003 | 5003 |
| 5004 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 5004 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { |
| 5005 if (incoming_value_ == NULL) return Representation::None(); | 5005 if (incoming_value_ == NULL) return Representation::None(); |
| 5006 return incoming_value_->KnownOptimalRepresentation(); | 5006 return incoming_value_->KnownOptimalRepresentation(); |
| 5007 } | 5007 } |
| 5008 | 5008 |
| 5009 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 5009 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
| 5010 | 5010 |
| 5011 private: | 5011 private: |
| 5012 HUnknownOSRValue() | 5012 HUnknownOSRValue(HEnvironment* environment, int index) |
| 5013 : incoming_value_(NULL) { | 5013 : environment_(environment), |
| 5014 index_(index), |
| 5015 incoming_value_(NULL) { |
| 5014 set_representation(Representation::Tagged()); | 5016 set_representation(Representation::Tagged()); |
| 5015 } | 5017 } |
| 5016 | 5018 |
| 5019 HEnvironment* environment_; |
| 5020 int index_; |
| 5017 HPhi* incoming_value_; | 5021 HPhi* incoming_value_; |
| 5018 }; | 5022 }; |
| 5019 | 5023 |
| 5020 | 5024 |
| 5021 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { | 5025 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { |
| 5022 public: | 5026 public: |
| 5023 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 5027 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
| 5024 : cell_(cell), details_(details), unique_id_() { | 5028 : cell_(cell), details_(details), unique_id_() { |
| 5025 set_representation(Representation::Tagged()); | 5029 set_representation(Representation::Tagged()); |
| 5026 SetFlag(kUseGVN); | 5030 SetFlag(kUseGVN); |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5748 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); | 5752 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); |
| 5749 | 5753 |
| 5750 HValue* object() { return OperandAt(0); } | 5754 HValue* object() { return OperandAt(0); } |
| 5751 bool HasTypeCheck() { return object()->IsCheckMaps(); } | 5755 bool HasTypeCheck() { return object()->IsCheckMaps(); } |
| 5752 HObjectAccess access() const { return access_; } | 5756 HObjectAccess access() const { return access_; } |
| 5753 Representation field_representation() const { | 5757 Representation field_representation() const { |
| 5754 return access_.representation(); | 5758 return access_.representation(); |
| 5755 } | 5759 } |
| 5756 | 5760 |
| 5757 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 5761 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } |
| 5762 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
| 5763 return !access().IsInobject() || access().offset() >= size; |
| 5764 } |
| 5758 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5765 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 5759 if (index == 0 && access().IsExternalMemory()) { | 5766 if (index == 0 && access().IsExternalMemory()) { |
| 5760 // object must be external in case of external memory access | 5767 // object must be external in case of external memory access |
| 5761 return Representation::External(); | 5768 return Representation::External(); |
| 5762 } | 5769 } |
| 5763 return Representation::Tagged(); | 5770 return Representation::Tagged(); |
| 5764 } | 5771 } |
| 5765 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 5772 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 5766 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5773 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 5767 | 5774 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6063 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { | 6070 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { |
| 6064 public: | 6071 public: |
| 6065 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | 6072 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
| 6066 HObjectAccess, HValue*); | 6073 HObjectAccess, HValue*); |
| 6067 | 6074 |
| 6068 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6075 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 6069 | 6076 |
| 6070 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 6077 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { |
| 6071 return index == 1; | 6078 return index == 1; |
| 6072 } | 6079 } |
| 6080 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
| 6081 return !access().IsInobject() || access().offset() >= size; |
| 6082 } |
| 6073 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6083 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6074 if (index == 0 && access().IsExternalMemory()) { | 6084 if (index == 0 && access().IsExternalMemory()) { |
| 6075 // object must be external in case of external memory access | 6085 // object must be external in case of external memory access |
| 6076 return Representation::External(); | 6086 return Representation::External(); |
| 6077 } else if (index == 1 && | 6087 } else if (index == 1 && |
| 6078 (field_representation().IsDouble() || | 6088 (field_representation().IsDouble() || |
| 6079 field_representation().IsSmi() || | 6089 field_representation().IsSmi() || |
| 6080 field_representation().IsInteger32())) { | 6090 field_representation().IsInteger32())) { |
| 6081 return field_representation(); | 6091 return field_representation(); |
| 6082 } | 6092 } |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6957 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 6948 }; | 6958 }; |
| 6949 | 6959 |
| 6950 | 6960 |
| 6951 #undef DECLARE_INSTRUCTION | 6961 #undef DECLARE_INSTRUCTION |
| 6952 #undef DECLARE_CONCRETE_INSTRUCTION | 6962 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6953 | 6963 |
| 6954 } } // namespace v8::internal | 6964 } } // namespace v8::internal |
| 6955 | 6965 |
| 6956 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6966 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |