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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1056 static I* New(Zone* zone, \ | 1056 static I* New(Zone* zone, \ |
1057 HValue* context, \ | 1057 HValue* context, \ |
1058 P1 p1, \ | 1058 P1 p1, \ |
1059 P2 p2, \ | 1059 P2 p2, \ |
1060 P3 p3, \ | 1060 P3 p3, \ |
1061 P4 p4, \ | 1061 P4 p4, \ |
1062 P5 p5) { \ | 1062 P5 p5) { \ |
1063 return new(zone) I(p1, p2, p3, p4, p5); \ | 1063 return new(zone) I(p1, p2, p3, p4, p5); \ |
1064 } | 1064 } |
1065 | 1065 |
1066 #define DECLARE_INSTRUCTION_FACTORY_P6(I, P1, P2, P3, P4, P5, P6) \ | |
1067 static I* New(Zone* zone, \ | |
1068 HValue* context, \ | |
1069 P1 p1, \ | |
1070 P2 p2, \ | |
1071 P3 p3, \ | |
1072 P4 p4, \ | |
1073 P5 p5, \ | |
1074 P6 p6) { \ | |
1075 return new(zone) I(p1, p2, p3, p4, p5, p6); \ | |
1076 } | |
1077 | |
1066 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \ | 1078 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \ |
1067 static I* New(Zone* zone, HValue* context) { \ | 1079 static I* New(Zone* zone, HValue* context) { \ |
1068 return new(zone) I(context); \ | 1080 return new(zone) I(context); \ |
1069 } | 1081 } |
1070 | 1082 |
1071 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \ | 1083 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \ |
1072 static I* New(Zone* zone, HValue* context, P1 p1) { \ | 1084 static I* New(Zone* zone, HValue* context, P1 p1) { \ |
1073 return new(zone) I(context, p1); \ | 1085 return new(zone) I(context, p1); \ |
1074 } | 1086 } |
1075 | 1087 |
(...skipping 4947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6023 } | 6035 } |
6024 | 6036 |
6025 static HObjectAccess ForFunctionContextPointer() { | 6037 static HObjectAccess ForFunctionContextPointer() { |
6026 return HObjectAccess(kInobject, JSFunction::kContextOffset); | 6038 return HObjectAccess(kInobject, JSFunction::kContextOffset); |
6027 } | 6039 } |
6028 | 6040 |
6029 static HObjectAccess ForMap() { | 6041 static HObjectAccess ForMap() { |
6030 return HObjectAccess(kMaps, JSObject::kMapOffset); | 6042 return HObjectAccess(kMaps, JSObject::kMapOffset); |
6031 } | 6043 } |
6032 | 6044 |
6033 static HObjectAccess ForMapInstanceSize() { | 6045 static HObjectAccess ForMapAsInteger32() { |
6046 return HObjectAccess(kMaps, JSObject::kMapOffset, | |
6047 Representation::Integer32()); | |
6048 } | |
6049 | |
6050 static HObjectAccess ForMapInObjectProperties() { | |
6034 return HObjectAccess(kInobject, | 6051 return HObjectAccess(kInobject, |
6035 Map::kInstanceSizeOffset, | 6052 Map::kInObjectPropertiesOffset, |
6036 Representation::UInteger8()); | 6053 Representation::UInteger8()); |
6037 } | 6054 } |
6038 | 6055 |
6039 static HObjectAccess ForMapInstanceType() { | 6056 static HObjectAccess ForMapInstanceType() { |
6040 return HObjectAccess(kInobject, | 6057 return HObjectAccess(kInobject, |
6041 Map::kInstanceTypeOffset, | 6058 Map::kInstanceTypeOffset, |
6042 Representation::UInteger8()); | 6059 Representation::UInteger8()); |
6043 } | 6060 } |
6044 | 6061 |
6062 static HObjectAccess ForMapInstanceSize() { | |
6063 return HObjectAccess(kInobject, | |
6064 Map::kInstanceSizeOffset, | |
6065 Representation::UInteger8()); | |
6066 } | |
6067 | |
6068 static HObjectAccess ForMapBitField() { | |
6069 return HObjectAccess(kInobject, | |
6070 Map::kBitFieldOffset, | |
6071 Representation::UInteger8()); | |
6072 } | |
6073 | |
6074 static HObjectAccess ForMapBitField2() { | |
6075 return HObjectAccess(kInobject, | |
6076 Map::kBitField2Offset, | |
6077 Representation::UInteger8()); | |
6078 } | |
6079 | |
6080 static HObjectAccess ForNameHashField() { | |
6081 return HObjectAccess(kInobject, | |
6082 Name::kHashFieldOffset, | |
6083 Representation::Integer32()); | |
6084 } | |
6085 | |
6086 static HObjectAccess ForMapInstanceTypeAndBitField() { | |
6087 STATIC_ASSERT((Map::kInstanceTypeOffset & 1) == 0); | |
6088 STATIC_ASSERT(Map::kBitFieldOffset == Map::kInstanceTypeOffset + 1); | |
6089 return HObjectAccess(kInobject, | |
6090 Map::kInstanceTypeOffset, | |
6091 Representation::UInteger16()); | |
6092 } | |
6093 | |
6045 static HObjectAccess ForPropertyCellValue() { | 6094 static HObjectAccess ForPropertyCellValue() { |
6046 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | 6095 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
6047 } | 6096 } |
6048 | 6097 |
6049 static HObjectAccess ForCellValue() { | 6098 static HObjectAccess ForCellValue() { |
6050 return HObjectAccess(kInobject, Cell::kValueOffset); | 6099 return HObjectAccess(kInobject, Cell::kValueOffset); |
6051 } | 6100 } |
6052 | 6101 |
6053 static HObjectAccess ForAllocationMementoSite() { | 6102 static HObjectAccess ForAllocationMementoSite() { |
6054 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); | 6103 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6287 set_representation(Representation::Tagged()); | 6336 set_representation(Representation::Tagged()); |
6288 SetFlag(kUseGVN); | 6337 SetFlag(kUseGVN); |
6289 SetGVNFlag(kDependsOnCalls); | 6338 SetGVNFlag(kDependsOnCalls); |
6290 } | 6339 } |
6291 }; | 6340 }; |
6292 | 6341 |
6293 class ArrayInstructionInterface { | 6342 class ArrayInstructionInterface { |
6294 public: | 6343 public: |
6295 virtual HValue* GetKey() = 0; | 6344 virtual HValue* GetKey() = 0; |
6296 virtual void SetKey(HValue* key) = 0; | 6345 virtual void SetKey(HValue* key) = 0; |
6297 virtual void SetIndexOffset(uint32_t index_offset) = 0; | 6346 virtual ElementsKind elements_kind() const = 0; |
6298 virtual int MaxIndexOffsetBits() = 0; | 6347 virtual void IncreaseBaseOffset(uint32_t base_offset) = 0; |
6348 virtual int MaxBaseOffsetBits() = 0; | |
6299 virtual bool IsDehoisted() = 0; | 6349 virtual bool IsDehoisted() = 0; |
6300 virtual void SetDehoisted(bool is_dehoisted) = 0; | 6350 virtual void SetDehoisted(bool is_dehoisted) = 0; |
6301 virtual ~ArrayInstructionInterface() { }; | 6351 virtual ~ArrayInstructionInterface() { }; |
6302 | 6352 |
6303 static Representation KeyedAccessIndexRequirement(Representation r) { | 6353 static Representation KeyedAccessIndexRequirement(Representation r) { |
6304 return r.IsInteger32() || SmiValuesAre32Bits() | 6354 return r.IsInteger32() || SmiValuesAre32Bits() |
6305 ? Representation::Integer32() : Representation::Smi(); | 6355 ? Representation::Integer32() : Representation::Smi(); |
6306 } | 6356 } |
6307 }; | 6357 }; |
6308 | 6358 |
6309 | 6359 |
6360 static const int kDefaultKeyedHeaderOffsetSentinel = -1; | |
6361 | |
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
| |
6310 enum LoadKeyedHoleMode { | 6362 enum LoadKeyedHoleMode { |
6311 NEVER_RETURN_HOLE, | 6363 NEVER_RETURN_HOLE, |
6312 ALLOW_RETURN_HOLE | 6364 ALLOW_RETURN_HOLE |
6313 }; | 6365 }; |
6314 | 6366 |
6315 | 6367 |
6316 class HLoadKeyed V8_FINAL | 6368 class HLoadKeyed V8_FINAL |
6317 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6369 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6318 public: | 6370 public: |
6319 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, | 6371 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, |
6320 ElementsKind); | 6372 ElementsKind); |
6321 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, | 6373 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
6322 ElementsKind, LoadKeyedHoleMode); | 6374 ElementsKind, LoadKeyedHoleMode); |
6375 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, | |
6376 ElementsKind, LoadKeyedHoleMode, int); | |
6323 | 6377 |
6324 bool is_external() const { | 6378 bool is_external() const { |
6325 return IsExternalArrayElementsKind(elements_kind()); | 6379 return IsExternalArrayElementsKind(elements_kind()); |
6326 } | 6380 } |
6327 HValue* elements() { return OperandAt(0); } | 6381 HValue* elements() { return OperandAt(0); } |
6328 HValue* key() { return OperandAt(1); } | 6382 HValue* key() { return OperandAt(1); } |
6329 HValue* dependency() { | 6383 HValue* dependency() { |
6330 ASSERT(HasDependency()); | 6384 ASSERT(HasDependency()); |
6331 return OperandAt(2); | 6385 return OperandAt(2); |
6332 } | 6386 } |
6333 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6387 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
6334 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } | 6388 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } |
6335 void SetIndexOffset(uint32_t index_offset) { | 6389 void IncreaseBaseOffset(uint32_t base_offset) { |
6336 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); | 6390 base_offset += BaseOffsetField::decode(bit_field_); |
6391 bit_field_ = BaseOffsetField::update(bit_field_, base_offset); | |
6337 } | 6392 } |
6338 virtual int MaxIndexOffsetBits() { | 6393 virtual int MaxBaseOffsetBits() { |
6339 return kBitsForIndexOffset; | 6394 return kBitsForBaseOffset; |
6340 } | 6395 } |
6341 HValue* GetKey() { return key(); } | 6396 HValue* GetKey() { return key(); } |
6342 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6397 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6343 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 6398 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
6344 void SetDehoisted(bool is_dehoisted) { | 6399 void SetDehoisted(bool is_dehoisted) { |
6345 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6400 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
6346 } | 6401 } |
6347 ElementsKind elements_kind() const { | 6402 virtual ElementsKind elements_kind() const V8_OVERRIDE { |
6348 return ElementsKindField::decode(bit_field_); | 6403 return ElementsKindField::decode(bit_field_); |
6349 } | 6404 } |
6350 LoadKeyedHoleMode hole_mode() const { | 6405 LoadKeyedHoleMode hole_mode() const { |
6351 return HoleModeField::decode(bit_field_); | 6406 return HoleModeField::decode(bit_field_); |
6352 } | 6407 } |
6353 | 6408 |
6354 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6409 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6355 // kind_fast: tagged[int32] (none) | 6410 // kind_fast: tagged[int32] (none) |
6356 // kind_double: tagged[int32] (none) | 6411 // kind_double: tagged[int32] (none) |
6357 // kind_external: external[int32] (none) | 6412 // kind_external: external[int32] (none) |
(...skipping 20 matching lines...) Expand all Loading... | |
6378 | 6433 |
6379 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 6434 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
6380 | 6435 |
6381 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) | 6436 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) |
6382 | 6437 |
6383 protected: | 6438 protected: |
6384 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 6439 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
6385 if (!other->IsLoadKeyed()) return false; | 6440 if (!other->IsLoadKeyed()) return false; |
6386 HLoadKeyed* other_load = HLoadKeyed::cast(other); | 6441 HLoadKeyed* other_load = HLoadKeyed::cast(other); |
6387 | 6442 |
6388 if (IsDehoisted() && index_offset() != other_load->index_offset()) | 6443 if (IsDehoisted() && base_offset() != other_load->base_offset()) |
6389 return false; | 6444 return false; |
6390 return elements_kind() == other_load->elements_kind(); | 6445 return elements_kind() == other_load->elements_kind(); |
6391 } | 6446 } |
6392 | 6447 |
6393 private: | 6448 private: |
6394 HLoadKeyed(HValue* obj, | 6449 HLoadKeyed(HValue* obj, |
6395 HValue* key, | 6450 HValue* key, |
6396 HValue* dependency, | 6451 HValue* dependency, |
6397 ElementsKind elements_kind, | 6452 ElementsKind elements_kind, |
6398 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) | 6453 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE, |
6454 int offset = kDefaultKeyedHeaderOffsetSentinel) | |
6399 : bit_field_(0) { | 6455 : bit_field_(0) { |
6456 offset = offset == kDefaultKeyedHeaderOffsetSentinel | |
6457 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | |
6458 : offset; | |
6400 bit_field_ = ElementsKindField::encode(elements_kind) | | 6459 bit_field_ = ElementsKindField::encode(elements_kind) | |
6401 HoleModeField::encode(mode); | 6460 HoleModeField::encode(mode) | |
6461 BaseOffsetField::encode(offset); | |
6402 | 6462 |
6403 SetOperandAt(0, obj); | 6463 SetOperandAt(0, obj); |
6404 SetOperandAt(1, key); | 6464 SetOperandAt(1, key); |
6405 SetOperandAt(2, dependency != NULL ? dependency : obj); | 6465 SetOperandAt(2, dependency != NULL ? dependency : obj); |
6406 | 6466 |
6407 if (!is_external()) { | 6467 if (!is_external()) { |
6408 // I can detect the case between storing double (holey and fast) and | 6468 // I can detect the case between storing double (holey and fast) and |
6409 // smi/object by looking at elements_kind_. | 6469 // smi/object by looking at elements_kind_. |
6410 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 6470 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || |
6411 IsFastDoubleElementsKind(elements_kind)); | 6471 IsFastDoubleElementsKind(elements_kind)); |
(...skipping 30 matching lines...) Expand all Loading... | |
6442 } | 6502 } |
6443 | 6503 |
6444 virtual bool IsDeletable() const V8_OVERRIDE { | 6504 virtual bool IsDeletable() const V8_OVERRIDE { |
6445 return !RequiresHoleCheck(); | 6505 return !RequiresHoleCheck(); |
6446 } | 6506 } |
6447 | 6507 |
6448 // Establish some checks around our packed fields | 6508 // Establish some checks around our packed fields |
6449 enum LoadKeyedBits { | 6509 enum LoadKeyedBits { |
6450 kBitsForElementsKind = 5, | 6510 kBitsForElementsKind = 5, |
6451 kBitsForHoleMode = 1, | 6511 kBitsForHoleMode = 1, |
6452 kBitsForIndexOffset = 25, | 6512 kBitsForBaseOffset = 25, |
6453 kBitsForIsDehoisted = 1, | 6513 kBitsForIsDehoisted = 1, |
6454 | 6514 |
6455 kStartElementsKind = 0, | 6515 kStartElementsKind = 0, |
6456 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, | 6516 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, |
6457 kStartIndexOffset = kStartHoleMode + kBitsForHoleMode, | 6517 kStartBaseOffset = kStartHoleMode + kBitsForHoleMode, |
6458 kStartIsDehoisted = kStartIndexOffset + kBitsForIndexOffset | 6518 kStartIsDehoisted = kStartBaseOffset + kBitsForBaseOffset |
6459 }; | 6519 }; |
6460 | 6520 |
6461 STATIC_ASSERT((kBitsForElementsKind + kBitsForIndexOffset + | 6521 STATIC_ASSERT((kBitsForElementsKind + kBitsForBaseOffset + |
6462 kBitsForIsDehoisted) <= sizeof(uint32_t)*8); | 6522 kBitsForIsDehoisted) <= sizeof(uint32_t)*8); |
6463 STATIC_ASSERT(kElementsKindCount <= (1 << kBitsForElementsKind)); | 6523 STATIC_ASSERT(kElementsKindCount <= (1 << kBitsForElementsKind)); |
6464 class ElementsKindField: | 6524 class ElementsKindField: |
6465 public BitField<ElementsKind, kStartElementsKind, kBitsForElementsKind> | 6525 public BitField<ElementsKind, kStartElementsKind, kBitsForElementsKind> |
6466 {}; // NOLINT | 6526 {}; // NOLINT |
6467 class HoleModeField: | 6527 class HoleModeField: |
6468 public BitField<LoadKeyedHoleMode, kStartHoleMode, kBitsForHoleMode> | 6528 public BitField<LoadKeyedHoleMode, kStartHoleMode, kBitsForHoleMode> |
6469 {}; // NOLINT | 6529 {}; // NOLINT |
6470 class IndexOffsetField: | 6530 class BaseOffsetField: |
6471 public BitField<uint32_t, kStartIndexOffset, kBitsForIndexOffset> | 6531 public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset> |
6472 {}; // NOLINT | 6532 {}; // NOLINT |
6473 class IsDehoistedField: | 6533 class IsDehoistedField: |
6474 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> | 6534 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> |
6475 {}; // NOLINT | 6535 {}; // NOLINT |
6476 uint32_t bit_field_; | 6536 uint32_t bit_field_; |
6477 }; | 6537 }; |
6478 | 6538 |
6479 | 6539 |
6480 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6540 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6481 public: | 6541 public: |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6661 Handle<String> name_; | 6721 Handle<String> name_; |
6662 StrictModeFlag strict_mode_flag_; | 6722 StrictModeFlag strict_mode_flag_; |
6663 }; | 6723 }; |
6664 | 6724 |
6665 | 6725 |
6666 class HStoreKeyed V8_FINAL | 6726 class HStoreKeyed V8_FINAL |
6667 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6727 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6668 public: | 6728 public: |
6669 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 6729 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
6670 ElementsKind); | 6730 ElementsKind); |
6731 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | |
6732 ElementsKind, int); | |
6671 | 6733 |
6672 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6734 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6673 // kind_fast: tagged[int32] = tagged | 6735 // kind_fast: tagged[int32] = tagged |
6674 // kind_double: tagged[int32] = double | 6736 // kind_double: tagged[int32] = double |
6675 // kind_smi : tagged[int32] = smi | 6737 // kind_smi : tagged[int32] = smi |
6676 // kind_external: external[int32] = (double | int32) | 6738 // kind_external: external[int32] = (double | int32) |
6677 if (index == 0) { | 6739 if (index == 0) { |
6678 return is_external() ? Representation::External() | 6740 return is_external() ? Representation::External() |
6679 : Representation::Tagged(); | 6741 : Representation::Tagged(); |
6680 } else if (index == 1) { | 6742 } else if (index == 1) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6716 // For fast object elements kinds, don't assume anything. | 6778 // For fast object elements kinds, don't assume anything. |
6717 return Representation::None(); | 6779 return Representation::None(); |
6718 } | 6780 } |
6719 | 6781 |
6720 HValue* elements() { return OperandAt(0); } | 6782 HValue* elements() { return OperandAt(0); } |
6721 HValue* key() { return OperandAt(1); } | 6783 HValue* key() { return OperandAt(1); } |
6722 HValue* value() { return OperandAt(2); } | 6784 HValue* value() { return OperandAt(2); } |
6723 bool value_is_smi() const { | 6785 bool value_is_smi() const { |
6724 return IsFastSmiElementsKind(elements_kind_); | 6786 return IsFastSmiElementsKind(elements_kind_); |
6725 } | 6787 } |
6726 ElementsKind elements_kind() const { return elements_kind_; } | 6788 virtual ElementsKind elements_kind() const V8_OVERRIDE { |
6727 uint32_t index_offset() { return index_offset_; } | 6789 return elements_kind_; |
6728 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 6790 } |
6729 virtual int MaxIndexOffsetBits() { | 6791 uint32_t base_offset() { return base_offset_; } |
6792 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.
| |
6793 base_offset_ += base_offset; | |
6794 } | |
6795 virtual int MaxBaseOffsetBits() { | |
6730 return 31 - ElementsKindToShiftSize(elements_kind_); | 6796 return 31 - ElementsKindToShiftSize(elements_kind_); |
6731 } | 6797 } |
6732 HValue* GetKey() { return key(); } | 6798 HValue* GetKey() { return key(); } |
6733 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6799 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6734 bool IsDehoisted() { return is_dehoisted_; } | 6800 bool IsDehoisted() { return is_dehoisted_; } |
6735 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6801 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
6736 bool IsUninitialized() { return is_uninitialized_; } | 6802 bool IsUninitialized() { return is_uninitialized_; } |
6737 void SetUninitialized(bool is_uninitialized) { | 6803 void SetUninitialized(bool is_uninitialized) { |
6738 is_uninitialized_ = is_uninitialized; | 6804 is_uninitialized_ = is_uninitialized; |
6739 } | 6805 } |
(...skipping 20 matching lines...) Expand all Loading... | |
6760 } | 6826 } |
6761 | 6827 |
6762 bool NeedsCanonicalization(); | 6828 bool NeedsCanonicalization(); |
6763 | 6829 |
6764 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6830 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6765 | 6831 |
6766 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6832 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6767 | 6833 |
6768 private: | 6834 private: |
6769 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6835 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6770 ElementsKind elements_kind) | 6836 ElementsKind elements_kind, |
6837 int offset = kDefaultKeyedHeaderOffsetSentinel) | |
6771 : elements_kind_(elements_kind), | 6838 : elements_kind_(elements_kind), |
6772 index_offset_(0), | 6839 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel |
6840 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | |
6841 : offset), | |
6773 is_dehoisted_(false), | 6842 is_dehoisted_(false), |
6774 is_uninitialized_(false), | 6843 is_uninitialized_(false), |
6775 new_space_dominator_(NULL) { | 6844 new_space_dominator_(NULL) { |
6776 SetOperandAt(0, obj); | 6845 SetOperandAt(0, obj); |
6777 SetOperandAt(1, key); | 6846 SetOperandAt(1, key); |
6778 SetOperandAt(2, val); | 6847 SetOperandAt(2, val); |
6779 | 6848 |
6780 if (IsFastObjectElementsKind(elements_kind)) { | 6849 if (IsFastObjectElementsKind(elements_kind)) { |
6781 SetFlag(kTrackSideEffectDominators); | 6850 SetFlag(kTrackSideEffectDominators); |
6782 SetGVNFlag(kDependsOnNewSpacePromotion); | 6851 SetGVNFlag(kDependsOnNewSpacePromotion); |
(...skipping 10 matching lines...) Expand all Loading... | |
6793 } | 6862 } |
6794 | 6863 |
6795 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 6864 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
6796 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 6865 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
6797 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 6866 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
6798 SetFlag(kTruncatingToInt32); | 6867 SetFlag(kTruncatingToInt32); |
6799 } | 6868 } |
6800 } | 6869 } |
6801 | 6870 |
6802 ElementsKind elements_kind_; | 6871 ElementsKind elements_kind_; |
6803 uint32_t index_offset_; | 6872 uint32_t base_offset_; |
6804 bool is_dehoisted_ : 1; | 6873 bool is_dehoisted_ : 1; |
6805 bool is_uninitialized_ : 1; | 6874 bool is_uninitialized_ : 1; |
6806 HValue* new_space_dominator_; | 6875 HValue* new_space_dominator_; |
6807 }; | 6876 }; |
6808 | 6877 |
6809 | 6878 |
6810 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6879 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
6811 public: | 6880 public: |
6812 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6881 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
6813 HValue*, HValue*, StrictModeFlag); | 6882 HValue*, HValue*, StrictModeFlag); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7452 set_representation(Representation::Tagged()); | 7521 set_representation(Representation::Tagged()); |
7453 } | 7522 } |
7454 | 7523 |
7455 int idx_; | 7524 int idx_; |
7456 HForInCacheArray* index_cache_; | 7525 HForInCacheArray* index_cache_; |
7457 }; | 7526 }; |
7458 | 7527 |
7459 | 7528 |
7460 class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { | 7529 class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { |
7461 public: | 7530 public: |
7462 HLoadFieldByIndex(HValue* object, | 7531 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); |
7463 HValue* index) { | |
7464 SetOperandAt(0, object); | |
7465 SetOperandAt(1, index); | |
7466 set_representation(Representation::Tagged()); | |
7467 } | |
7468 | 7532 |
7469 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 7533 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
7470 return Representation::Tagged(); | 7534 if (index == 1) { |
7535 return Representation::Integer32(); | |
7536 } else { | |
7537 return Representation::Tagged(); | |
7538 } | |
7471 } | 7539 } |
7472 | 7540 |
7473 HValue* object() { return OperandAt(0); } | 7541 HValue* object() { return OperandAt(0); } |
7474 HValue* index() { return OperandAt(1); } | 7542 HValue* index() { return OperandAt(1); } |
7475 | 7543 |
7476 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 7544 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
7477 | 7545 |
7478 virtual HType CalculateInferredType() V8_OVERRIDE { | 7546 virtual HType CalculateInferredType() V8_OVERRIDE { |
7479 return HType::Tagged(); | 7547 return HType::Tagged(); |
7480 } | 7548 } |
7481 | 7549 |
7482 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 7550 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
7483 | 7551 |
7484 private: | 7552 private: |
7553 HLoadFieldByIndex(HValue* object, | |
7554 HValue* index) { | |
7555 SetOperandAt(0, object); | |
7556 SetOperandAt(1, index); | |
7557 set_representation(Representation::Tagged()); | |
7558 } | |
7559 | |
7485 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7560 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7486 }; | 7561 }; |
7487 | 7562 |
7488 | 7563 |
7489 #undef DECLARE_INSTRUCTION | 7564 #undef DECLARE_INSTRUCTION |
7490 #undef DECLARE_CONCRETE_INSTRUCTION | 7565 #undef DECLARE_CONCRETE_INSTRUCTION |
7491 | 7566 |
7492 } } // namespace v8::internal | 7567 } } // namespace v8::internal |
7493 | 7568 |
7494 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7569 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |