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 6031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6042 } | 6042 } |
6043 | 6043 |
6044 static HObjectAccess ForFunctionContextPointer() { | 6044 static HObjectAccess ForFunctionContextPointer() { |
6045 return HObjectAccess(kInobject, JSFunction::kContextOffset); | 6045 return HObjectAccess(kInobject, JSFunction::kContextOffset); |
6046 } | 6046 } |
6047 | 6047 |
6048 static HObjectAccess ForMap() { | 6048 static HObjectAccess ForMap() { |
6049 return HObjectAccess(kMaps, JSObject::kMapOffset); | 6049 return HObjectAccess(kMaps, JSObject::kMapOffset); |
6050 } | 6050 } |
6051 | 6051 |
6052 static HObjectAccess ForMapInstanceSize() { | 6052 static HObjectAccess ForMapAsInteger32() { |
| 6053 return HObjectAccess(kMaps, JSObject::kMapOffset, |
| 6054 Representation::Integer32()); |
| 6055 } |
| 6056 |
| 6057 static HObjectAccess ForMapInObjectProperties() { |
6053 return HObjectAccess(kInobject, | 6058 return HObjectAccess(kInobject, |
6054 Map::kInstanceSizeOffset, | 6059 Map::kInObjectPropertiesOffset, |
6055 Representation::UInteger8()); | 6060 Representation::UInteger8()); |
6056 } | 6061 } |
6057 | 6062 |
6058 static HObjectAccess ForMapInstanceType() { | 6063 static HObjectAccess ForMapInstanceType() { |
6059 return HObjectAccess(kInobject, | 6064 return HObjectAccess(kInobject, |
6060 Map::kInstanceTypeOffset, | 6065 Map::kInstanceTypeOffset, |
6061 Representation::UInteger8()); | 6066 Representation::UInteger8()); |
6062 } | 6067 } |
6063 | 6068 |
| 6069 static HObjectAccess ForMapInstanceSize() { |
| 6070 return HObjectAccess(kInobject, |
| 6071 Map::kInstanceSizeOffset, |
| 6072 Representation::UInteger8()); |
| 6073 } |
| 6074 |
| 6075 static HObjectAccess ForMapBitField() { |
| 6076 return HObjectAccess(kInobject, |
| 6077 Map::kBitFieldOffset, |
| 6078 Representation::UInteger8()); |
| 6079 } |
| 6080 |
| 6081 static HObjectAccess ForMapBitField2() { |
| 6082 return HObjectAccess(kInobject, |
| 6083 Map::kBitField2Offset, |
| 6084 Representation::UInteger8()); |
| 6085 } |
| 6086 |
| 6087 static HObjectAccess ForNameHashField() { |
| 6088 return HObjectAccess(kInobject, |
| 6089 Name::kHashFieldOffset, |
| 6090 Representation::Integer32()); |
| 6091 } |
| 6092 |
| 6093 static HObjectAccess ForMapInstanceTypeAndBitField() { |
| 6094 STATIC_ASSERT((Map::kInstanceTypeOffset & 1) == 0); |
| 6095 STATIC_ASSERT(Map::kBitFieldOffset == Map::kInstanceTypeOffset + 1); |
| 6096 return HObjectAccess(kInobject, |
| 6097 Map::kInstanceTypeOffset, |
| 6098 Representation::UInteger16()); |
| 6099 } |
| 6100 |
6064 static HObjectAccess ForPropertyCellValue() { | 6101 static HObjectAccess ForPropertyCellValue() { |
6065 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | 6102 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
6066 } | 6103 } |
6067 | 6104 |
6068 static HObjectAccess ForCellValue() { | 6105 static HObjectAccess ForCellValue() { |
6069 return HObjectAccess(kInobject, Cell::kValueOffset); | 6106 return HObjectAccess(kInobject, Cell::kValueOffset); |
6070 } | 6107 } |
6071 | 6108 |
6072 static HObjectAccess ForAllocationMementoSite() { | 6109 static HObjectAccess ForAllocationMementoSite() { |
6073 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); | 6110 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6446 } | 6483 } |
6447 HValue* elements() { return OperandAt(0); } | 6484 HValue* elements() { return OperandAt(0); } |
6448 HValue* key() { return OperandAt(1); } | 6485 HValue* key() { return OperandAt(1); } |
6449 HValue* dependency() { | 6486 HValue* dependency() { |
6450 ASSERT(HasDependency()); | 6487 ASSERT(HasDependency()); |
6451 return OperandAt(2); | 6488 return OperandAt(2); |
6452 } | 6489 } |
6453 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6490 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
6454 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } | 6491 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } |
6455 void IncreaseBaseOffset(uint32_t base_offset) { | 6492 void IncreaseBaseOffset(uint32_t base_offset) { |
| 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) |
6456 base_offset += BaseOffsetField::decode(bit_field_); | 6497 base_offset += BaseOffsetField::decode(bit_field_); |
6457 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); | 6498 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); |
6458 } | 6499 } |
6459 virtual int MaxBaseOffsetBits() { | 6500 virtual int MaxBaseOffsetBits() { |
6460 return kBitsForBaseOffset; | 6501 return kBitsForBaseOffset; |
6461 } | 6502 } |
6462 HValue* GetKey() { return key(); } | 6503 HValue* GetKey() { return key(); } |
6463 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6504 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6464 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 6505 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
6465 void SetDehoisted(bool is_dehoisted) { | 6506 void SetDehoisted(bool is_dehoisted) { |
6466 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6507 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
6467 } | 6508 } |
6468 ElementsKind elements_kind() const { | 6509 virtual ElementsKind elements_kind() const V8_OVERRIDE { |
6469 return ElementsKindField::decode(bit_field_); | 6510 return ElementsKindField::decode(bit_field_); |
6470 } | 6511 } |
6471 LoadKeyedHoleMode hole_mode() const { | 6512 LoadKeyedHoleMode hole_mode() const { |
6472 return HoleModeField::decode(bit_field_); | 6513 return HoleModeField::decode(bit_field_); |
6473 } | 6514 } |
6474 | 6515 |
6475 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6516 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6476 // kind_fast: tagged[int32] (none) | 6517 // kind_fast: tagged[int32] (none) |
6477 // kind_double: tagged[int32] (none) | 6518 // kind_double: tagged[int32] (none) |
6478 // kind_fixed_typed_array: tagged[int32] (none) | 6519 // kind_fixed_typed_array: tagged[int32] (none) |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6916 HValue* elements() const { return OperandAt(0); } | 6957 HValue* elements() const { return OperandAt(0); } |
6917 HValue* key() const { return OperandAt(1); } | 6958 HValue* key() const { return OperandAt(1); } |
6918 HValue* value() const { return OperandAt(2); } | 6959 HValue* value() const { return OperandAt(2); } |
6919 bool value_is_smi() const { | 6960 bool value_is_smi() const { |
6920 return IsFastSmiElementsKind(elements_kind_); | 6961 return IsFastSmiElementsKind(elements_kind_); |
6921 } | 6962 } |
6922 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6963 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
6923 ElementsKind elements_kind() const { return elements_kind_; } | 6964 ElementsKind elements_kind() const { return elements_kind_; } |
6924 uint32_t base_offset() { return base_offset_; } | 6965 uint32_t base_offset() { return base_offset_; } |
6925 void IncreaseBaseOffset(uint32_t base_offset) { | 6966 void IncreaseBaseOffset(uint32_t base_offset) { |
| 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) |
6926 base_offset_ += base_offset; | 6971 base_offset_ += base_offset; |
6927 } | 6972 } |
6928 virtual int MaxBaseOffsetBits() { | 6973 virtual int MaxBaseOffsetBits() { |
6929 return 31 - ElementsKindToShiftSize(elements_kind_); | 6974 return 31 - ElementsKindToShiftSize(elements_kind_); |
6930 } | 6975 } |
6931 HValue* GetKey() { return key(); } | 6976 HValue* GetKey() { return key(); } |
6932 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6977 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6933 bool IsDehoisted() { return is_dehoisted_; } | 6978 bool IsDehoisted() { return is_dehoisted_; } |
6934 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6979 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
6935 bool IsUninitialized() { return is_uninitialized_; } | 6980 bool IsUninitialized() { return is_uninitialized_; } |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7757 }; | 7802 }; |
7758 | 7803 |
7759 | 7804 |
7760 | 7805 |
7761 #undef DECLARE_INSTRUCTION | 7806 #undef DECLARE_INSTRUCTION |
7762 #undef DECLARE_CONCRETE_INSTRUCTION | 7807 #undef DECLARE_CONCRETE_INSTRUCTION |
7763 | 7808 |
7764 } } // namespace v8::internal | 7809 } } // namespace v8::internal |
7765 | 7810 |
7766 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7811 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |