| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 6423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6434 SetFlag(kUseGVN); | 6434 SetFlag(kUseGVN); |
| 6435 SetDependsOnFlag(kCalls); | 6435 SetDependsOnFlag(kCalls); |
| 6436 } | 6436 } |
| 6437 }; | 6437 }; |
| 6438 | 6438 |
| 6439 class ArrayInstructionInterface { | 6439 class ArrayInstructionInterface { |
| 6440 public: | 6440 public: |
| 6441 virtual HValue* GetKey() = 0; | 6441 virtual HValue* GetKey() = 0; |
| 6442 virtual void SetKey(HValue* key) = 0; | 6442 virtual void SetKey(HValue* key) = 0; |
| 6443 virtual ElementsKind elements_kind() const = 0; | 6443 virtual ElementsKind elements_kind() const = 0; |
| 6444 virtual void IncreaseBaseOffset(uint32_t base_offset) = 0; | 6444 // TryIncreaseBaseOffset returns false if overflow would result. |
| 6445 virtual int MaxBaseOffsetBits() = 0; | 6445 virtual bool TryIncreaseBaseOffset(uint32_t increase_by_value) = 0; |
| 6446 virtual bool IsDehoisted() = 0; | 6446 virtual bool IsDehoisted() = 0; |
| 6447 virtual void SetDehoisted(bool is_dehoisted) = 0; | 6447 virtual void SetDehoisted(bool is_dehoisted) = 0; |
| 6448 virtual ~ArrayInstructionInterface() { } | 6448 virtual ~ArrayInstructionInterface() { } |
| 6449 | 6449 |
| 6450 static Representation KeyedAccessIndexRequirement(Representation r) { | 6450 static Representation KeyedAccessIndexRequirement(Representation r) { |
| 6451 return r.IsInteger32() || SmiValuesAre32Bits() | 6451 return r.IsInteger32() || SmiValuesAre32Bits() |
| 6452 ? Representation::Integer32() : Representation::Smi(); | 6452 ? Representation::Integer32() : Representation::Smi(); |
| 6453 } | 6453 } |
| 6454 }; | 6454 }; |
| 6455 | 6455 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6482 return is_external() || is_fixed_typed_array(); | 6482 return is_external() || is_fixed_typed_array(); |
| 6483 } | 6483 } |
| 6484 HValue* elements() { return OperandAt(0); } | 6484 HValue* elements() { return OperandAt(0); } |
| 6485 HValue* key() { return OperandAt(1); } | 6485 HValue* key() { return OperandAt(1); } |
| 6486 HValue* dependency() { | 6486 HValue* dependency() { |
| 6487 ASSERT(HasDependency()); | 6487 ASSERT(HasDependency()); |
| 6488 return OperandAt(2); | 6488 return OperandAt(2); |
| 6489 } | 6489 } |
| 6490 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6490 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
| 6491 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } | 6491 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } |
| 6492 void IncreaseBaseOffset(uint32_t base_offset) { | 6492 bool TryIncreaseBaseOffset(uint32_t increase_by_value); |
| 6493 // The base offset is usually simply the size of the array header, except | |
| 6494 // with dehoisting adds an addition offset due to a array index key | |
| 6495 // manipulation, in which case it becomes (array header size + | |
| 6496 // constant-offset-from-key * kPointerSize) | |
| 6497 base_offset += BaseOffsetField::decode(bit_field_); | |
| 6498 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); | |
| 6499 } | |
| 6500 virtual int MaxBaseOffsetBits() { | |
| 6501 return kBitsForBaseOffset; | |
| 6502 } | |
| 6503 HValue* GetKey() { return key(); } | 6493 HValue* GetKey() { return key(); } |
| 6504 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6494 void SetKey(HValue* key) { SetOperandAt(1, key); } |
| 6505 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 6495 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
| 6506 void SetDehoisted(bool is_dehoisted) { | 6496 void SetDehoisted(bool is_dehoisted) { |
| 6507 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6497 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
| 6508 } | 6498 } |
| 6509 virtual ElementsKind elements_kind() const V8_OVERRIDE { | 6499 virtual ElementsKind elements_kind() const V8_OVERRIDE { |
| 6510 return ElementsKindField::decode(bit_field_); | 6500 return ElementsKindField::decode(bit_field_); |
| 6511 } | 6501 } |
| 6512 LoadKeyedHoleMode hole_mode() const { | 6502 LoadKeyedHoleMode hole_mode() const { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6956 | 6946 |
| 6957 HValue* elements() const { return OperandAt(0); } | 6947 HValue* elements() const { return OperandAt(0); } |
| 6958 HValue* key() const { return OperandAt(1); } | 6948 HValue* key() const { return OperandAt(1); } |
| 6959 HValue* value() const { return OperandAt(2); } | 6949 HValue* value() const { return OperandAt(2); } |
| 6960 bool value_is_smi() const { | 6950 bool value_is_smi() const { |
| 6961 return IsFastSmiElementsKind(elements_kind_); | 6951 return IsFastSmiElementsKind(elements_kind_); |
| 6962 } | 6952 } |
| 6963 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6953 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
| 6964 ElementsKind elements_kind() const { return elements_kind_; } | 6954 ElementsKind elements_kind() const { return elements_kind_; } |
| 6965 uint32_t base_offset() { return base_offset_; } | 6955 uint32_t base_offset() { return base_offset_; } |
| 6966 void IncreaseBaseOffset(uint32_t base_offset) { | 6956 bool TryIncreaseBaseOffset(uint32_t increase_by_value); |
| 6967 // The base offset is usually simply the size of the array header, except | |
| 6968 // with dehoisting adds an addition offset due to a array index key | |
| 6969 // manipulation, in which case it becomes (array header size + | |
| 6970 // constant-offset-from-key * kPointerSize) | |
| 6971 base_offset_ += base_offset; | |
| 6972 } | |
| 6973 virtual int MaxBaseOffsetBits() { | |
| 6974 return 31 - ElementsKindToShiftSize(elements_kind_); | |
| 6975 } | |
| 6976 HValue* GetKey() { return key(); } | 6957 HValue* GetKey() { return key(); } |
| 6977 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6958 void SetKey(HValue* key) { SetOperandAt(1, key); } |
| 6978 bool IsDehoisted() { return is_dehoisted_; } | 6959 bool IsDehoisted() { return is_dehoisted_; } |
| 6979 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6960 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
| 6980 bool IsUninitialized() { return is_uninitialized_; } | 6961 bool IsUninitialized() { return is_uninitialized_; } |
| 6981 void SetUninitialized(bool is_uninitialized) { | 6962 void SetUninitialized(bool is_uninitialized) { |
| 6982 is_uninitialized_ = is_uninitialized; | 6963 is_uninitialized_ = is_uninitialized; |
| 6983 } | 6964 } |
| 6984 | 6965 |
| 6985 bool IsConstantHoleStore() { | 6966 bool IsConstantHoleStore() { |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7802 }; | 7783 }; |
| 7803 | 7784 |
| 7804 | 7785 |
| 7805 | 7786 |
| 7806 #undef DECLARE_INSTRUCTION | 7787 #undef DECLARE_INSTRUCTION |
| 7807 #undef DECLARE_CONCRETE_INSTRUCTION | 7788 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7808 | 7789 |
| 7809 } } // namespace v8::internal | 7790 } } // namespace v8::internal |
| 7810 | 7791 |
| 7811 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7792 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |