Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 52e3ba0ef8d6898b55e30edefd616a430b6a24b3..42ca5a721bf2c5c742d2a812a6fa8ce0a4757785 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -1063,6 +1063,18 @@ class HValue : public ZoneObject { |
return new(zone) I(p1, p2, p3, p4, p5); \ |
} |
+#define DECLARE_INSTRUCTION_FACTORY_P6(I, P1, P2, P3, P4, P5, P6) \ |
+ static I* New(Zone* zone, \ |
+ HValue* context, \ |
+ P1 p1, \ |
+ P2 p2, \ |
+ P3 p3, \ |
+ P4 p4, \ |
+ P5 p5, \ |
+ P6 p6) { \ |
+ return new(zone) I(p1, p2, p3, p4, p5, p6); \ |
+ } |
+ |
#define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \ |
static I* New(Zone* zone, HValue* context) { \ |
return new(zone) I(context); \ |
@@ -6030,9 +6042,14 @@ class HObjectAccess V8_FINAL { |
return HObjectAccess(kMaps, JSObject::kMapOffset); |
} |
- static HObjectAccess ForMapInstanceSize() { |
+ static HObjectAccess ForMapAsInteger32() { |
+ return HObjectAccess(kMaps, JSObject::kMapOffset, |
+ Representation::Integer32()); |
+ } |
+ |
+ static HObjectAccess ForMapInObjectProperties() { |
return HObjectAccess(kInobject, |
- Map::kInstanceSizeOffset, |
+ Map::kInObjectPropertiesOffset, |
Representation::UInteger8()); |
} |
@@ -6042,6 +6059,38 @@ class HObjectAccess V8_FINAL { |
Representation::UInteger8()); |
} |
+ static HObjectAccess ForMapInstanceSize() { |
+ return HObjectAccess(kInobject, |
+ Map::kInstanceSizeOffset, |
+ Representation::UInteger8()); |
+ } |
+ |
+ static HObjectAccess ForMapBitField() { |
+ return HObjectAccess(kInobject, |
+ Map::kBitFieldOffset, |
+ Representation::UInteger8()); |
+ } |
+ |
+ static HObjectAccess ForMapBitField2() { |
+ return HObjectAccess(kInobject, |
+ Map::kBitField2Offset, |
+ Representation::UInteger8()); |
+ } |
+ |
+ static HObjectAccess ForNameHashField() { |
+ return HObjectAccess(kInobject, |
+ Name::kHashFieldOffset, |
+ Representation::Integer32()); |
+ } |
+ |
+ static HObjectAccess ForMapInstanceTypeAndBitField() { |
+ STATIC_ASSERT((Map::kInstanceTypeOffset & 1) == 0); |
+ STATIC_ASSERT(Map::kBitFieldOffset == Map::kInstanceTypeOffset + 1); |
+ return HObjectAccess(kInobject, |
+ Map::kInstanceTypeOffset, |
+ Representation::UInteger16()); |
+ } |
+ |
static HObjectAccess ForPropertyCellValue() { |
return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
} |
@@ -6294,8 +6343,9 @@ class ArrayInstructionInterface { |
public: |
virtual HValue* GetKey() = 0; |
virtual void SetKey(HValue* key) = 0; |
- virtual void SetIndexOffset(uint32_t index_offset) = 0; |
- virtual int MaxIndexOffsetBits() = 0; |
+ virtual ElementsKind elements_kind() const = 0; |
+ virtual void IncreaseBaseOffset(uint32_t base_offset) = 0; |
+ virtual int MaxBaseOffsetBits() = 0; |
virtual bool IsDehoisted() = 0; |
virtual void SetDehoisted(bool is_dehoisted) = 0; |
virtual ~ArrayInstructionInterface() { }; |
@@ -6307,6 +6357,8 @@ class ArrayInstructionInterface { |
}; |
+static const int kDefaultKeyedHeaderOffsetSentinel = -1; |
+ |
Toon Verwaest
2013/12/04 17:29:26
super nit: seems like we're pretty inconsistent in
danno
2014/06/06 15:43:50
Well, a few weeks ago we decided that we would jus
|
enum LoadKeyedHoleMode { |
NEVER_RETURN_HOLE, |
ALLOW_RETURN_HOLE |
@@ -6320,6 +6372,8 @@ class HLoadKeyed V8_FINAL |
ElementsKind); |
DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
ElementsKind, LoadKeyedHoleMode); |
+ DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, |
+ ElementsKind, LoadKeyedHoleMode, int); |
bool is_external() const { |
return IsExternalArrayElementsKind(elements_kind()); |
@@ -6331,12 +6385,13 @@ class HLoadKeyed V8_FINAL |
return OperandAt(2); |
} |
bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
- uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } |
- void SetIndexOffset(uint32_t index_offset) { |
- bit_field_ = IndexOffsetField::update(bit_field_, index_offset); |
+ uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } |
+ void IncreaseBaseOffset(uint32_t base_offset) { |
+ base_offset += BaseOffsetField::decode(bit_field_); |
+ bit_field_ = BaseOffsetField::update(bit_field_, base_offset); |
} |
- virtual int MaxIndexOffsetBits() { |
- return kBitsForIndexOffset; |
+ virtual int MaxBaseOffsetBits() { |
+ return kBitsForBaseOffset; |
} |
HValue* GetKey() { return key(); } |
void SetKey(HValue* key) { SetOperandAt(1, key); } |
@@ -6344,7 +6399,7 @@ class HLoadKeyed V8_FINAL |
void SetDehoisted(bool is_dehoisted) { |
bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
} |
- ElementsKind elements_kind() const { |
+ virtual ElementsKind elements_kind() const V8_OVERRIDE { |
return ElementsKindField::decode(bit_field_); |
} |
LoadKeyedHoleMode hole_mode() const { |
@@ -6385,7 +6440,7 @@ class HLoadKeyed V8_FINAL |
if (!other->IsLoadKeyed()) return false; |
HLoadKeyed* other_load = HLoadKeyed::cast(other); |
- if (IsDehoisted() && index_offset() != other_load->index_offset()) |
+ if (IsDehoisted() && base_offset() != other_load->base_offset()) |
return false; |
return elements_kind() == other_load->elements_kind(); |
} |
@@ -6395,10 +6450,15 @@ class HLoadKeyed V8_FINAL |
HValue* key, |
HValue* dependency, |
ElementsKind elements_kind, |
- LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) |
+ LoadKeyedHoleMode mode = NEVER_RETURN_HOLE, |
+ int offset = kDefaultKeyedHeaderOffsetSentinel) |
: bit_field_(0) { |
+ offset = offset == kDefaultKeyedHeaderOffsetSentinel |
+ ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
+ : offset; |
bit_field_ = ElementsKindField::encode(elements_kind) | |
- HoleModeField::encode(mode); |
+ HoleModeField::encode(mode) | |
+ BaseOffsetField::encode(offset); |
SetOperandAt(0, obj); |
SetOperandAt(1, key); |
@@ -6449,16 +6509,16 @@ class HLoadKeyed V8_FINAL |
enum LoadKeyedBits { |
kBitsForElementsKind = 5, |
kBitsForHoleMode = 1, |
- kBitsForIndexOffset = 25, |
+ kBitsForBaseOffset = 25, |
kBitsForIsDehoisted = 1, |
kStartElementsKind = 0, |
kStartHoleMode = kStartElementsKind + kBitsForElementsKind, |
- kStartIndexOffset = kStartHoleMode + kBitsForHoleMode, |
- kStartIsDehoisted = kStartIndexOffset + kBitsForIndexOffset |
+ kStartBaseOffset = kStartHoleMode + kBitsForHoleMode, |
+ kStartIsDehoisted = kStartBaseOffset + kBitsForBaseOffset |
}; |
- STATIC_ASSERT((kBitsForElementsKind + kBitsForIndexOffset + |
+ STATIC_ASSERT((kBitsForElementsKind + kBitsForBaseOffset + |
kBitsForIsDehoisted) <= sizeof(uint32_t)*8); |
STATIC_ASSERT(kElementsKindCount <= (1 << kBitsForElementsKind)); |
class ElementsKindField: |
@@ -6467,8 +6527,8 @@ class HLoadKeyed V8_FINAL |
class HoleModeField: |
public BitField<LoadKeyedHoleMode, kStartHoleMode, kBitsForHoleMode> |
{}; // NOLINT |
- class IndexOffsetField: |
- public BitField<uint32_t, kStartIndexOffset, kBitsForIndexOffset> |
+ class BaseOffsetField: |
+ public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset> |
{}; // NOLINT |
class IsDehoistedField: |
public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> |
@@ -6668,6 +6728,8 @@ class HStoreKeyed V8_FINAL |
public: |
DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
ElementsKind); |
+ DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
+ ElementsKind, int); |
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
// kind_fast: tagged[int32] = tagged |
@@ -6723,10 +6785,14 @@ class HStoreKeyed V8_FINAL |
bool value_is_smi() const { |
return IsFastSmiElementsKind(elements_kind_); |
} |
- ElementsKind elements_kind() const { return elements_kind_; } |
- uint32_t index_offset() { return index_offset_; } |
- void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
- virtual int MaxIndexOffsetBits() { |
+ virtual ElementsKind elements_kind() const V8_OVERRIDE { |
+ return elements_kind_; |
+ } |
+ uint32_t base_offset() { return base_offset_; } |
+ void IncreaseBaseOffset(uint32_t base_offset) { |
Toon Verwaest
2013/12/04 17:29:26
Could you add a comment indicating to what you are
danno
2014/06/06 15:43:50
Done.
|
+ base_offset_ += base_offset; |
+ } |
+ virtual int MaxBaseOffsetBits() { |
return 31 - ElementsKindToShiftSize(elements_kind_); |
} |
HValue* GetKey() { return key(); } |
@@ -6767,9 +6833,12 @@ class HStoreKeyed V8_FINAL |
private: |
HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
- ElementsKind elements_kind) |
+ ElementsKind elements_kind, |
+ int offset = kDefaultKeyedHeaderOffsetSentinel) |
: elements_kind_(elements_kind), |
- index_offset_(0), |
+ base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel |
+ ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
+ : offset), |
is_dehoisted_(false), |
is_uninitialized_(false), |
new_space_dominator_(NULL) { |
@@ -6800,7 +6869,7 @@ class HStoreKeyed V8_FINAL |
} |
ElementsKind elements_kind_; |
- uint32_t index_offset_; |
+ uint32_t base_offset_; |
bool is_dehoisted_ : 1; |
bool is_uninitialized_ : 1; |
HValue* new_space_dominator_; |
@@ -7459,15 +7528,14 @@ class HForInCacheArray V8_FINAL : public HTemplateInstruction<2> { |
class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { |
public: |
- HLoadFieldByIndex(HValue* object, |
- HValue* index) { |
- SetOperandAt(0, object); |
- SetOperandAt(1, index); |
- set_representation(Representation::Tagged()); |
- } |
+ DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); |
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
- return Representation::Tagged(); |
+ if (index == 1) { |
+ return Representation::Integer32(); |
+ } else { |
+ return Representation::Tagged(); |
+ } |
} |
HValue* object() { return OperandAt(0); } |
@@ -7482,6 +7550,13 @@ class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { |
DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
private: |
+ HLoadFieldByIndex(HValue* object, |
+ HValue* index) { |
+ SetOperandAt(0, object); |
+ SetOperandAt(1, index); |
+ set_representation(Representation::Tagged()); |
+ } |
+ |
virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
}; |