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 6030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6041 | 6041 |
6042 friend class HLoadNamedField; | 6042 friend class HLoadNamedField; |
6043 friend class HStoreNamedField; | 6043 friend class HStoreNamedField; |
6044 | 6044 |
6045 inline Portion portion() const { | 6045 inline Portion portion() const { |
6046 return PortionField::decode(value_); | 6046 return PortionField::decode(value_); |
6047 } | 6047 } |
6048 }; | 6048 }; |
6049 | 6049 |
6050 | 6050 |
6051 class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> { | 6051 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { |
6052 public: | 6052 public: |
6053 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); | 6053 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, |
| 6054 HObjectAccess); |
6054 | 6055 |
6055 HValue* object() { return OperandAt(0); } | 6056 HValue* object() { return OperandAt(0); } |
6056 bool HasTypeCheck() { return object()->IsCheckMaps(); } | 6057 HValue* dependency() { |
| 6058 ASSERT(HasDependency()); |
| 6059 return OperandAt(1); |
| 6060 } |
| 6061 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } |
6057 HObjectAccess access() const { return access_; } | 6062 HObjectAccess access() const { return access_; } |
6058 Representation field_representation() const { | 6063 Representation field_representation() const { |
6059 return access_.representation(); | 6064 return access_.representation(); |
6060 } | 6065 } |
6061 | 6066 |
6062 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 6067 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } |
6063 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6068 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
6064 return !access().IsInobject() || access().offset() >= size; | 6069 return !access().IsInobject() || access().offset() >= size; |
6065 } | 6070 } |
6066 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6071 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6067 if (index == 0 && access().IsExternalMemory()) { | 6072 if (index == 0 && access().IsExternalMemory()) { |
6068 // object must be external in case of external memory access | 6073 // object must be external in case of external memory access |
6069 return Representation::External(); | 6074 return Representation::External(); |
6070 } | 6075 } |
6071 return Representation::Tagged(); | 6076 return Representation::Tagged(); |
6072 } | 6077 } |
6073 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 6078 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
6074 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6079 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6075 | 6080 |
6076 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6081 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
6077 | 6082 |
6078 protected: | 6083 protected: |
6079 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 6084 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
6080 HLoadNamedField* b = HLoadNamedField::cast(other); | 6085 HLoadNamedField* b = HLoadNamedField::cast(other); |
6081 return access_.Equals(b->access_); | 6086 return access_.Equals(b->access_); |
6082 } | 6087 } |
6083 | 6088 |
6084 private: | 6089 private: |
6085 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { | 6090 HLoadNamedField(HValue* object, |
| 6091 HValue* dependency, |
| 6092 HObjectAccess access) : access_(access) { |
6086 ASSERT(object != NULL); | 6093 ASSERT(object != NULL); |
6087 SetOperandAt(0, object); | 6094 SetOperandAt(0, object); |
| 6095 SetOperandAt(1, dependency != NULL ? dependency : object); |
6088 | 6096 |
6089 Representation representation = access.representation(); | 6097 Representation representation = access.representation(); |
6090 if (representation.IsInteger8() || | 6098 if (representation.IsInteger8() || |
6091 representation.IsUInteger8() || | 6099 representation.IsUInteger8() || |
6092 representation.IsInteger16() || | 6100 representation.IsInteger16() || |
6093 representation.IsUInteger16()) { | 6101 representation.IsUInteger16()) { |
6094 set_representation(Representation::Integer32()); | 6102 set_representation(Representation::Integer32()); |
6095 } else if (representation.IsSmi()) { | 6103 } else if (representation.IsSmi()) { |
6096 set_type(HType::Smi()); | 6104 set_type(HType::Smi()); |
6097 if (SmiValuesAre32Bits()) { | 6105 if (SmiValuesAre32Bits()) { |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7460 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7468 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7461 }; | 7469 }; |
7462 | 7470 |
7463 | 7471 |
7464 #undef DECLARE_INSTRUCTION | 7472 #undef DECLARE_INSTRUCTION |
7465 #undef DECLARE_CONCRETE_INSTRUCTION | 7473 #undef DECLARE_CONCRETE_INSTRUCTION |
7466 | 7474 |
7467 } } // namespace v8::internal | 7475 } } // namespace v8::internal |
7468 | 7476 |
7469 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7477 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |