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