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 5723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5734 } | 5734 } |
5735 | 5735 |
5736 inline Handle<String> name() const { | 5736 inline Handle<String> name() const { |
5737 return name_; | 5737 return name_; |
5738 } | 5738 } |
5739 | 5739 |
5740 inline bool immutable() const { | 5740 inline bool immutable() const { |
5741 return ImmutableField::decode(value_); | 5741 return ImmutableField::decode(value_); |
5742 } | 5742 } |
5743 | 5743 |
5744 // Returns true if access is being made to an in-object property that | |
5745 // was already added to the object. | |
5746 inline bool existing_inobject_property() const { | |
5747 return ExistingInobjectPropertyField::decode(value_); | |
5748 } | |
5749 | |
5744 inline HObjectAccess WithRepresentation(Representation representation) { | 5750 inline HObjectAccess WithRepresentation(Representation representation) { |
5745 return HObjectAccess(portion(), offset(), representation, name()); | 5751 return HObjectAccess(portion(), offset(), representation, name(), |
5752 immutable(), existing_inobject_property()); | |
5746 } | 5753 } |
5747 | 5754 |
5748 static HObjectAccess ForHeapNumberValue() { | 5755 static HObjectAccess ForHeapNumberValue() { |
5749 return HObjectAccess( | 5756 return HObjectAccess(kDouble, |
Toon Verwaest
2014/02/03 13:51:32
spurious change
Igor Sheludko
2014/02/03 17:57:05
Done.
| |
5750 kDouble, HeapNumber::kValueOffset, Representation::Double()); | 5757 HeapNumber::kValueOffset, |
5758 Representation::Double()); | |
5751 } | 5759 } |
5752 | 5760 |
5753 static HObjectAccess ForHeapNumberValueLowestBits() { | 5761 static HObjectAccess ForHeapNumberValueLowestBits() { |
5754 return HObjectAccess(kDouble, | 5762 return HObjectAccess(kDouble, |
5755 HeapNumber::kValueOffset, | 5763 HeapNumber::kValueOffset, |
5756 Representation::Integer32()); | 5764 Representation::Integer32()); |
5757 } | 5765 } |
5758 | 5766 |
5759 static HObjectAccess ForHeapNumberValueHighestBits() { | 5767 static HObjectAccess ForHeapNumberValueHighestBits() { |
5760 return HObjectAccess(kDouble, | 5768 return HObjectAccess(kDouble, |
(...skipping 18 matching lines...) Expand all Loading... | |
5779 kArrayLengths, | 5787 kArrayLengths, |
5780 JSArray::kLengthOffset, | 5788 JSArray::kLengthOffset, |
5781 IsFastElementsKind(elements_kind) && | 5789 IsFastElementsKind(elements_kind) && |
5782 FLAG_track_fields | 5790 FLAG_track_fields |
5783 ? Representation::Smi() : Representation::Tagged()); | 5791 ? Representation::Smi() : Representation::Tagged()); |
5784 } | 5792 } |
5785 | 5793 |
5786 static HObjectAccess ForAllocationSiteOffset(int offset); | 5794 static HObjectAccess ForAllocationSiteOffset(int offset); |
5787 | 5795 |
5788 static HObjectAccess ForAllocationSiteList() { | 5796 static HObjectAccess ForAllocationSiteList() { |
5789 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); | 5797 return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), |
5798 Handle<String>::null(), false, false); | |
5790 } | 5799 } |
5791 | 5800 |
5792 static HObjectAccess ForFixedArrayLength() { | 5801 static HObjectAccess ForFixedArrayLength() { |
5793 return HObjectAccess( | 5802 return HObjectAccess( |
5794 kArrayLengths, | 5803 kArrayLengths, |
5795 FixedArray::kLengthOffset, | 5804 FixedArray::kLengthOffset, |
5796 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); | 5805 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); |
5797 } | 5806 } |
5798 | 5807 |
5799 static HObjectAccess ForStringHashField() { | 5808 static HObjectAccess ForStringHashField() { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5881 | 5890 |
5882 static HObjectAccess ForCellValue() { | 5891 static HObjectAccess ForCellValue() { |
5883 return HObjectAccess(kInobject, Cell::kValueOffset); | 5892 return HObjectAccess(kInobject, Cell::kValueOffset); |
5884 } | 5893 } |
5885 | 5894 |
5886 static HObjectAccess ForAllocationMementoSite() { | 5895 static HObjectAccess ForAllocationMementoSite() { |
5887 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); | 5896 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
5888 } | 5897 } |
5889 | 5898 |
5890 static HObjectAccess ForCounter() { | 5899 static HObjectAccess ForCounter() { |
5891 return HObjectAccess(kExternalMemory, 0, Representation::Integer32()); | 5900 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), |
5901 Handle<String>::null(), false, false); | |
5892 } | 5902 } |
5893 | 5903 |
5894 // Create an access to an offset in a fixed array header. | 5904 // Create an access to an offset in a fixed array header. |
5895 static HObjectAccess ForFixedArrayHeader(int offset); | 5905 static HObjectAccess ForFixedArrayHeader(int offset); |
5896 | 5906 |
5897 // Create an access to an in-object property in a JSObject. | 5907 // Create an access to an in-object property in a JSObject. |
5898 static HObjectAccess ForJSObjectOffset(int offset, | 5908 // This kind of access must be used when the object |map| is known and |
5909 // in-object properties are being accessed. Accesses of the in-object | |
5910 // properties can have different semantics depending on whether corresponding | |
5911 // property was added to the map or not. | |
5912 static HObjectAccess ForJSObjectOffset(Handle<Map> map, int offset, | |
titzer
2014/02/03 13:45:39
Can we call this one ForMapAndOffset?
Igor Sheludko
2014/02/03 17:57:05
Done.
| |
5899 Representation representation = Representation::Tagged()); | 5913 Representation representation = Representation::Tagged()); |
5900 | 5914 |
5915 // Create an access to an in-object property in a JSObject. | |
5916 // This kind of access can be used for accessing object header fields or | |
5917 // in-object properties if the map of the object is not known. | |
5918 static HObjectAccess ForJSObjectOffsetUnsafe(int offset, | |
titzer
2014/02/03 13:45:39
And then we can keep the ForJSObjectOffset for thi
Igor Sheludko
2014/02/03 17:57:05
In offline discussions we have chosen a better nam
| |
5919 Representation representation = Representation::Tagged()) { | |
5920 return ForJSObjectOffset(Handle<Map>::null(), offset, representation); | |
5921 } | |
5922 | |
5901 // Create an access to an in-object property in a JSArray. | 5923 // Create an access to an in-object property in a JSArray. |
5902 static HObjectAccess ForJSArrayOffset(int offset); | 5924 static HObjectAccess ForJSArrayOffset(int offset); |
5903 | 5925 |
5904 static HObjectAccess ForContextSlot(int index); | 5926 static HObjectAccess ForContextSlot(int index); |
5905 | 5927 |
5906 // Create an access to the backing store of an object. | 5928 // Create an access to the backing store of an object. |
5907 static HObjectAccess ForBackingStoreOffset(int offset, | 5929 static HObjectAccess ForBackingStoreOffset(int offset, |
5908 Representation representation = Representation::Tagged()); | 5930 Representation representation = Representation::Tagged()); |
5909 | 5931 |
5910 // Create an access to a resolved field (in-object or backing store). | 5932 // Create an access to a resolved field (in-object or backing store). |
5911 static HObjectAccess ForField(Handle<Map> map, | 5933 static HObjectAccess ForField(Handle<Map> map, |
5912 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 5934 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
5913 | 5935 |
5914 // Create an access for the payload of a Cell or JSGlobalPropertyCell. | 5936 // Create an access for the payload of a Cell or JSGlobalPropertyCell. |
5915 static HObjectAccess ForCellPayload(Isolate* isolate); | 5937 static HObjectAccess ForCellPayload(Isolate* isolate); |
5916 | 5938 |
5917 static HObjectAccess ForJSTypedArrayLength() { | 5939 static HObjectAccess ForJSTypedArrayLength() { |
Toon Verwaest
2014/02/03 13:51:32
You can probably get a map for each of the unsafe
Igor Sheludko
2014/02/03 17:57:05
For all these special cases we already know that t
| |
5918 return HObjectAccess::ForJSObjectOffset(JSTypedArray::kLengthOffset); | 5940 return HObjectAccess::ForJSObjectOffsetUnsafe(JSTypedArray::kLengthOffset); |
5919 } | 5941 } |
5920 | 5942 |
5921 static HObjectAccess ForJSArrayBufferBackingStore() { | 5943 static HObjectAccess ForJSArrayBufferBackingStore() { |
5922 return HObjectAccess::ForJSObjectOffset( | 5944 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5923 JSArrayBuffer::kBackingStoreOffset, Representation::External()); | 5945 JSArrayBuffer::kBackingStoreOffset, Representation::External()); |
5924 } | 5946 } |
5925 | 5947 |
5926 static HObjectAccess ForExternalArrayExternalPointer() { | 5948 static HObjectAccess ForExternalArrayExternalPointer() { |
5927 return HObjectAccess::ForJSObjectOffset( | 5949 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5928 ExternalArray::kExternalPointerOffset, Representation::External()); | 5950 ExternalArray::kExternalPointerOffset, Representation::External()); |
5929 } | 5951 } |
5930 | 5952 |
5931 static HObjectAccess ForJSArrayBufferViewWeakNext() { | 5953 static HObjectAccess ForJSArrayBufferViewWeakNext() { |
5932 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kWeakNextOffset); | 5954 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5955 JSArrayBufferView::kWeakNextOffset); | |
5933 } | 5956 } |
5934 | 5957 |
5935 static HObjectAccess ForJSArrayBufferWeakFirstView() { | 5958 static HObjectAccess ForJSArrayBufferWeakFirstView() { |
5936 return HObjectAccess::ForJSObjectOffset( | 5959 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5937 JSArrayBuffer::kWeakFirstViewOffset); | 5960 JSArrayBuffer::kWeakFirstViewOffset); |
5938 } | 5961 } |
5939 | 5962 |
5940 static HObjectAccess ForJSArrayBufferViewBuffer() { | 5963 static HObjectAccess ForJSArrayBufferViewBuffer() { |
5941 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kBufferOffset); | 5964 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5965 JSArrayBufferView::kBufferOffset); | |
5942 } | 5966 } |
5943 | 5967 |
5944 static HObjectAccess ForJSArrayBufferViewByteOffset() { | 5968 static HObjectAccess ForJSArrayBufferViewByteOffset() { |
5945 return HObjectAccess::ForJSObjectOffset( | 5969 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5946 JSArrayBufferView::kByteOffsetOffset); | 5970 JSArrayBufferView::kByteOffsetOffset); |
5947 } | 5971 } |
5948 | 5972 |
5949 static HObjectAccess ForJSArrayBufferViewByteLength() { | 5973 static HObjectAccess ForJSArrayBufferViewByteLength() { |
5950 return HObjectAccess::ForJSObjectOffset( | 5974 return HObjectAccess::ForJSObjectOffsetUnsafe( |
5951 JSArrayBufferView::kByteLengthOffset); | 5975 JSArrayBufferView::kByteLengthOffset); |
5952 } | 5976 } |
5953 | 5977 |
5954 static HObjectAccess ForGlobalObjectNativeContext() { | 5978 static HObjectAccess ForGlobalObjectNativeContext() { |
5955 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); | 5979 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); |
5956 } | 5980 } |
5957 | 5981 |
5958 void PrintTo(StringStream* stream); | 5982 void PrintTo(StringStream* stream); |
5959 | 5983 |
5960 inline bool Equals(HObjectAccess that) const { | 5984 inline bool Equals(HObjectAccess that) const { |
(...skipping 12 matching lines...) Expand all Loading... | |
5973 kElementsPointer, // elements pointer | 5997 kElementsPointer, // elements pointer |
5974 kBackingStore, // some field in the backing store | 5998 kBackingStore, // some field in the backing store |
5975 kDouble, // some double field | 5999 kDouble, // some double field |
5976 kInobject, // some other in-object field | 6000 kInobject, // some other in-object field |
5977 kExternalMemory // some field in external memory | 6001 kExternalMemory // some field in external memory |
5978 }; | 6002 }; |
5979 | 6003 |
5980 HObjectAccess(Portion portion, int offset, | 6004 HObjectAccess(Portion portion, int offset, |
5981 Representation representation = Representation::Tagged(), | 6005 Representation representation = Representation::Tagged(), |
5982 Handle<String> name = Handle<String>::null(), | 6006 Handle<String> name = Handle<String>::null(), |
5983 bool immutable = false) | 6007 bool immutable = false, |
6008 bool existing_inobject_property = true) | |
5984 : value_(PortionField::encode(portion) | | 6009 : value_(PortionField::encode(portion) | |
5985 RepresentationField::encode(representation.kind()) | | 6010 RepresentationField::encode(representation.kind()) | |
5986 ImmutableField::encode(immutable ? 1 : 0) | | 6011 ImmutableField::encode(immutable ? 1 : 0) | |
6012 ExistingInobjectPropertyField::encode( | |
6013 existing_inobject_property ? 1 : 0) | | |
5987 OffsetField::encode(offset)), | 6014 OffsetField::encode(offset)), |
5988 name_(name) { | 6015 name_(name) { |
5989 // assert that the fields decode correctly | 6016 // assert that the fields decode correctly |
5990 ASSERT(this->offset() == offset); | 6017 ASSERT(this->offset() == offset); |
5991 ASSERT(this->portion() == portion); | 6018 ASSERT(this->portion() == portion); |
5992 ASSERT(this->immutable() == immutable); | 6019 ASSERT(this->immutable() == immutable); |
6020 ASSERT(this->existing_inobject_property() == existing_inobject_property); | |
5993 ASSERT(RepresentationField::decode(value_) == representation.kind()); | 6021 ASSERT(RepresentationField::decode(value_) == representation.kind()); |
6022 ASSERT(!this->existing_inobject_property() || IsInobject()); | |
5994 } | 6023 } |
5995 | 6024 |
5996 class PortionField : public BitField<Portion, 0, 3> {}; | 6025 class PortionField : public BitField<Portion, 0, 3> {}; |
5997 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6026 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
5998 class ImmutableField : public BitField<bool, 7, 1> {}; | 6027 class ImmutableField : public BitField<bool, 7, 1> {}; |
5999 class OffsetField : public BitField<int, 8, 24> {}; | 6028 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; |
6029 class OffsetField : public BitField<int, 9, 23> {}; | |
6000 | 6030 |
6001 uint32_t value_; // encodes portion, representation, immutable, and offset | 6031 uint32_t value_; // encodes portion, representation, immutable, and offset |
6002 Handle<String> name_; | 6032 Handle<String> name_; |
6003 | 6033 |
6004 friend class HLoadNamedField; | 6034 friend class HLoadNamedField; |
6005 friend class HStoreNamedField; | 6035 friend class HStoreNamedField; |
6006 | 6036 |
6007 inline Portion portion() const { | 6037 inline Portion portion() const { |
6008 return PortionField::decode(value_); | 6038 return PortionField::decode(value_); |
6009 } | 6039 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6375 SetOperandAt(1, key); | 6405 SetOperandAt(1, key); |
6376 SetOperandAt(2, context); | 6406 SetOperandAt(2, context); |
6377 SetAllSideEffects(); | 6407 SetAllSideEffects(); |
6378 } | 6408 } |
6379 }; | 6409 }; |
6380 | 6410 |
6381 | 6411 |
6382 // Indicates whether the store is a store to an entry that was previously | 6412 // Indicates whether the store is a store to an entry that was previously |
6383 // initialized or not. | 6413 // initialized or not. |
6384 enum StoreFieldOrKeyedMode { | 6414 enum StoreFieldOrKeyedMode { |
6385 // This is a store of either an undefined value to a field or a hole/NaN to | |
6386 // an entry of a newly allocated object. | |
6387 PREINITIALIZING_STORE, | |
6388 // The entry could be either previously initialized or not. | |
titzer
2014/02/03 13:45:39
Please preserve the comments here.
Igor Sheludko
2014/02/03 17:57:05
Done.
| |
6389 INITIALIZING_STORE, | 6415 INITIALIZING_STORE, |
6390 // At the time of this store it is guaranteed that the entry is already | |
6391 // initialized. | |
6392 STORE_TO_INITIALIZED_ENTRY | 6416 STORE_TO_INITIALIZED_ENTRY |
6393 }; | 6417 }; |
6394 | 6418 |
6395 | 6419 |
6396 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { | 6420 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { |
6397 public: | 6421 public: |
6422 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | |
6423 HObjectAccess, HValue*); | |
6398 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, | 6424 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, |
6399 HObjectAccess, HValue*, StoreFieldOrKeyedMode); | 6425 HObjectAccess, HValue*, StoreFieldOrKeyedMode); |
6400 | 6426 |
6401 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6427 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
6402 | 6428 |
6403 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 6429 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { |
6404 return index == 1; | 6430 return index == 1; |
6405 } | 6431 } |
6406 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6432 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
6407 return !access().IsInobject() || access().offset() >= size; | 6433 return !access().IsInobject() || access().offset() >= size; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6494 } | 6520 } |
6495 | 6521 |
6496 void UpdateValue(HValue* value) { | 6522 void UpdateValue(HValue* value) { |
6497 SetOperandAt(1, value); | 6523 SetOperandAt(1, value); |
6498 } | 6524 } |
6499 | 6525 |
6500 private: | 6526 private: |
6501 HStoreNamedField(HValue* obj, | 6527 HStoreNamedField(HValue* obj, |
6502 HObjectAccess access, | 6528 HObjectAccess access, |
6503 HValue* val, | 6529 HValue* val, |
6504 StoreFieldOrKeyedMode store_mode) | 6530 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
6505 : access_(access), | 6531 : access_(access), |
6506 new_space_dominator_(NULL), | 6532 new_space_dominator_(NULL), |
6507 write_barrier_mode_(UPDATE_WRITE_BARRIER), | 6533 write_barrier_mode_(UPDATE_WRITE_BARRIER), |
6508 has_transition_(false), | 6534 has_transition_(false), |
6509 store_mode_(store_mode) { | 6535 store_mode_(store_mode) { |
6510 // PREINITIALIZING_STORE is only used to mark stores that initialize a | |
6511 // memory region resulting from HAllocate (possibly through an | |
6512 // HInnerAllocatedObject). | |
6513 ASSERT(store_mode != PREINITIALIZING_STORE || | |
6514 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | |
Toon Verwaest
2014/02/03 13:51:32
The equivalent ASSERT should still hold using the
Igor Sheludko
2014/02/03 17:57:05
Done.
| |
6515 SetOperandAt(0, obj); | 6536 SetOperandAt(0, obj); |
6516 SetOperandAt(1, val); | 6537 SetOperandAt(1, val); |
6517 SetOperandAt(2, obj); | 6538 SetOperandAt(2, obj); |
6518 access.SetGVNFlags(this, true); | 6539 access.SetGVNFlags(this, true); |
6519 } | 6540 } |
6520 | 6541 |
6521 HObjectAccess access_; | 6542 HObjectAccess access_; |
6522 HValue* new_space_dominator_; | 6543 HValue* new_space_dominator_; |
6523 WriteBarrierMode write_barrier_mode_ : 1; | 6544 WriteBarrierMode write_barrier_mode_ : 1; |
6524 bool has_transition_ : 1; | 6545 bool has_transition_ : 1; |
6525 StoreFieldOrKeyedMode store_mode_ : 2; | 6546 StoreFieldOrKeyedMode store_mode_ : 1; |
6526 }; | 6547 }; |
6527 | 6548 |
6528 | 6549 |
6529 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6550 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6530 public: | 6551 public: |
6531 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6552 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
6532 Handle<String>, HValue*, | 6553 Handle<String>, HValue*, |
6533 StrictModeFlag); | 6554 StrictModeFlag); |
6534 HValue* object() { return OperandAt(0); } | 6555 HValue* object() { return OperandAt(0); } |
6535 HValue* value() { return OperandAt(1); } | 6556 HValue* value() { return OperandAt(1); } |
(...skipping 24 matching lines...) Expand all Loading... | |
6560 } | 6581 } |
6561 | 6582 |
6562 Handle<String> name_; | 6583 Handle<String> name_; |
6563 StrictModeFlag strict_mode_flag_; | 6584 StrictModeFlag strict_mode_flag_; |
6564 }; | 6585 }; |
6565 | 6586 |
6566 | 6587 |
6567 class HStoreKeyed V8_FINAL | 6588 class HStoreKeyed V8_FINAL |
6568 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6589 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6569 public: | 6590 public: |
6591 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | |
6592 ElementsKind); | |
6570 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 6593 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
6571 ElementsKind, StoreFieldOrKeyedMode); | 6594 ElementsKind, StoreFieldOrKeyedMode); |
6572 | 6595 |
6573 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6596 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6574 // kind_fast: tagged[int32] = tagged | 6597 // kind_fast: tagged[int32] = tagged |
6575 // kind_double: tagged[int32] = double | 6598 // kind_double: tagged[int32] = double |
6576 // kind_smi : tagged[int32] = smi | 6599 // kind_smi : tagged[int32] = smi |
6577 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 6600 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
6578 // kind_external: external[int32] = (double | int32) | 6601 // kind_external: external[int32] = (double | int32) |
6579 if (index == 0) { | 6602 if (index == 0) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6679 | 6702 |
6680 bool NeedsCanonicalization(); | 6703 bool NeedsCanonicalization(); |
6681 | 6704 |
6682 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6705 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6683 | 6706 |
6684 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6707 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6685 | 6708 |
6686 private: | 6709 private: |
6687 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6710 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6688 ElementsKind elements_kind, | 6711 ElementsKind elements_kind, |
6689 StoreFieldOrKeyedMode store_mode) | 6712 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
6690 : elements_kind_(elements_kind), | 6713 : elements_kind_(elements_kind), |
6691 index_offset_(0), | 6714 index_offset_(0), |
6692 is_dehoisted_(false), | 6715 is_dehoisted_(false), |
6693 is_uninitialized_(false), | 6716 is_uninitialized_(false), |
6694 store_mode_(store_mode), | 6717 store_mode_(store_mode), |
6695 new_space_dominator_(NULL) { | 6718 new_space_dominator_(NULL) { |
6696 SetOperandAt(0, obj); | 6719 SetOperandAt(0, obj); |
6697 SetOperandAt(1, key); | 6720 SetOperandAt(1, key); |
6698 SetOperandAt(2, val); | 6721 SetOperandAt(2, val); |
6699 | 6722 |
6700 // PREINITIALIZING_STORE is only used to mark stores that initialize a | |
6701 // memory region resulting from HAllocate (possibly through an | |
6702 // HInnerAllocatedObject). | |
6703 ASSERT(store_mode != PREINITIALIZING_STORE || | |
6704 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | |
Toon Verwaest
2014/02/03 13:51:32
Same as above
Igor Sheludko
2014/02/03 17:57:05
The HObjectAccess mechanism is not applicable to H
| |
6705 | |
6706 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | 6723 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
6707 elements_kind == FAST_SMI_ELEMENTS); | 6724 elements_kind == FAST_SMI_ELEMENTS); |
6708 | 6725 |
6709 if (IsFastObjectElementsKind(elements_kind)) { | 6726 if (IsFastObjectElementsKind(elements_kind)) { |
6710 SetFlag(kTrackSideEffectDominators); | 6727 SetFlag(kTrackSideEffectDominators); |
6711 SetGVNFlag(kDependsOnNewSpacePromotion); | 6728 SetGVNFlag(kDependsOnNewSpacePromotion); |
6712 } | 6729 } |
6713 if (is_external()) { | 6730 if (is_external()) { |
6714 SetGVNFlag(kChangesExternalMemory); | 6731 SetGVNFlag(kChangesExternalMemory); |
6715 SetFlag(kAllowUndefinedAsNaN); | 6732 SetFlag(kAllowUndefinedAsNaN); |
(...skipping 14 matching lines...) Expand all Loading... | |
6730 (elements_kind >= UINT8_ELEMENTS && | 6747 (elements_kind >= UINT8_ELEMENTS && |
6731 elements_kind <= INT32_ELEMENTS)) { | 6748 elements_kind <= INT32_ELEMENTS)) { |
6732 SetFlag(kTruncatingToInt32); | 6749 SetFlag(kTruncatingToInt32); |
6733 } | 6750 } |
6734 } | 6751 } |
6735 | 6752 |
6736 ElementsKind elements_kind_; | 6753 ElementsKind elements_kind_; |
6737 uint32_t index_offset_; | 6754 uint32_t index_offset_; |
6738 bool is_dehoisted_ : 1; | 6755 bool is_dehoisted_ : 1; |
6739 bool is_uninitialized_ : 1; | 6756 bool is_uninitialized_ : 1; |
6740 StoreFieldOrKeyedMode store_mode_: 2; | 6757 StoreFieldOrKeyedMode store_mode_: 1; |
6741 HValue* new_space_dominator_; | 6758 HValue* new_space_dominator_; |
6742 }; | 6759 }; |
6743 | 6760 |
6744 | 6761 |
6745 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6762 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
6746 public: | 6763 public: |
6747 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6764 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
6748 HValue*, HValue*, StrictModeFlag); | 6765 HValue*, HValue*, StrictModeFlag); |
6749 | 6766 |
6750 HValue* object() { return OperandAt(0); } | 6767 HValue* object() { return OperandAt(0); } |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7411 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7428 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7412 }; | 7429 }; |
7413 | 7430 |
7414 | 7431 |
7415 #undef DECLARE_INSTRUCTION | 7432 #undef DECLARE_INSTRUCTION |
7416 #undef DECLARE_CONCRETE_INSTRUCTION | 7433 #undef DECLARE_CONCRETE_INSTRUCTION |
7417 | 7434 |
7418 } } // namespace v8::internal | 7435 } } // namespace v8::internal |
7419 | 7436 |
7420 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7437 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |