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 6500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6511 SetOperandAt(1, key); | 6511 SetOperandAt(1, key); |
6512 SetOperandAt(2, context); | 6512 SetOperandAt(2, context); |
6513 SetAllSideEffects(); | 6513 SetAllSideEffects(); |
6514 } | 6514 } |
6515 }; | 6515 }; |
6516 | 6516 |
6517 | 6517 |
6518 // Indicates whether the store is a store to an entry that was previously | 6518 // Indicates whether the store is a store to an entry that was previously |
6519 // initialized or not. | 6519 // initialized or not. |
6520 enum StoreFieldOrKeyedMode { | 6520 enum StoreFieldOrKeyedMode { |
| 6521 // This is a store of either an undefined value to a field or a hole/NaN to |
| 6522 // an entry of a newly allocated object. |
| 6523 PREINITIALIZING_STORE, |
| 6524 // The entry could be either previously initialized or not. |
6521 INITIALIZING_STORE, | 6525 INITIALIZING_STORE, |
| 6526 // At the time of this store it is guaranteed that the entry is already |
| 6527 // initialized. |
6522 STORE_TO_INITIALIZED_ENTRY | 6528 STORE_TO_INITIALIZED_ENTRY |
6523 }; | 6529 }; |
6524 | 6530 |
6525 | 6531 |
6526 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { | 6532 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { |
6527 public: | 6533 public: |
6528 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | |
6529 HObjectAccess, HValue*); | |
6530 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, | 6534 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, |
6531 HObjectAccess, HValue*, StoreFieldOrKeyedMode); | 6535 HObjectAccess, HValue*, StoreFieldOrKeyedMode); |
6532 | 6536 |
6533 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6537 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
6534 | 6538 |
6535 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 6539 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { |
6536 return index == 1; | 6540 return index == 1; |
6537 } | 6541 } |
6538 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6542 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
6539 return !access().IsInobject() || access().offset() >= size; | 6543 return !access().IsInobject() || access().offset() >= size; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6626 } | 6630 } |
6627 | 6631 |
6628 void UpdateValue(HValue* value) { | 6632 void UpdateValue(HValue* value) { |
6629 SetOperandAt(1, value); | 6633 SetOperandAt(1, value); |
6630 } | 6634 } |
6631 | 6635 |
6632 private: | 6636 private: |
6633 HStoreNamedField(HValue* obj, | 6637 HStoreNamedField(HValue* obj, |
6634 HObjectAccess access, | 6638 HObjectAccess access, |
6635 HValue* val, | 6639 HValue* val, |
6636 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6640 StoreFieldOrKeyedMode store_mode) |
6637 : access_(access), | 6641 : access_(access), |
6638 new_space_dominator_(NULL), | 6642 new_space_dominator_(NULL), |
6639 write_barrier_mode_(UPDATE_WRITE_BARRIER), | 6643 write_barrier_mode_(UPDATE_WRITE_BARRIER), |
6640 has_transition_(false), | 6644 has_transition_(false), |
6641 store_mode_(store_mode) { | 6645 store_mode_(store_mode) { |
| 6646 // PREINITIALIZING_STORE is only used to mark stores that initialize a |
| 6647 // memory region resulting from HAllocate (possibly through an |
| 6648 // HInnerAllocatedObject). |
| 6649 ASSERT(store_mode != PREINITIALIZING_STORE || |
| 6650 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
6642 SetOperandAt(0, obj); | 6651 SetOperandAt(0, obj); |
6643 SetOperandAt(1, val); | 6652 SetOperandAt(1, val); |
6644 SetOperandAt(2, obj); | 6653 SetOperandAt(2, obj); |
6645 access.SetGVNFlags(this, true); | 6654 access.SetGVNFlags(this, true); |
6646 } | 6655 } |
6647 | 6656 |
6648 HObjectAccess access_; | 6657 HObjectAccess access_; |
6649 HValue* new_space_dominator_; | 6658 HValue* new_space_dominator_; |
6650 WriteBarrierMode write_barrier_mode_ : 1; | 6659 WriteBarrierMode write_barrier_mode_ : 1; |
6651 bool has_transition_ : 1; | 6660 bool has_transition_ : 1; |
6652 StoreFieldOrKeyedMode store_mode_ : 1; | 6661 StoreFieldOrKeyedMode store_mode_ : 2; |
6653 }; | 6662 }; |
6654 | 6663 |
6655 | 6664 |
6656 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6665 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6657 public: | 6666 public: |
6658 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6667 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
6659 Handle<String>, HValue*, | 6668 Handle<String>, HValue*, |
6660 StrictModeFlag); | 6669 StrictModeFlag); |
6661 HValue* object() { return OperandAt(0); } | 6670 HValue* object() { return OperandAt(0); } |
6662 HValue* value() { return OperandAt(1); } | 6671 HValue* value() { return OperandAt(1); } |
(...skipping 24 matching lines...) Expand all Loading... |
6687 } | 6696 } |
6688 | 6697 |
6689 Handle<String> name_; | 6698 Handle<String> name_; |
6690 StrictModeFlag strict_mode_flag_; | 6699 StrictModeFlag strict_mode_flag_; |
6691 }; | 6700 }; |
6692 | 6701 |
6693 | 6702 |
6694 class HStoreKeyed V8_FINAL | 6703 class HStoreKeyed V8_FINAL |
6695 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6704 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6696 public: | 6705 public: |
6697 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | |
6698 ElementsKind); | |
6699 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 6706 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
6700 ElementsKind, StoreFieldOrKeyedMode); | 6707 ElementsKind, StoreFieldOrKeyedMode); |
6701 | 6708 |
6702 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6709 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6703 // kind_fast: tagged[int32] = tagged | 6710 // kind_fast: tagged[int32] = tagged |
6704 // kind_double: tagged[int32] = double | 6711 // kind_double: tagged[int32] = double |
6705 // kind_smi : tagged[int32] = smi | 6712 // kind_smi : tagged[int32] = smi |
6706 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 6713 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
6707 // kind_external: external[int32] = (double | int32) | 6714 // kind_external: external[int32] = (double | int32) |
6708 if (index == 0) { | 6715 if (index == 0) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6808 | 6815 |
6809 bool NeedsCanonicalization(); | 6816 bool NeedsCanonicalization(); |
6810 | 6817 |
6811 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6818 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6812 | 6819 |
6813 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6820 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6814 | 6821 |
6815 private: | 6822 private: |
6816 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6823 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6817 ElementsKind elements_kind, | 6824 ElementsKind elements_kind, |
6818 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6825 StoreFieldOrKeyedMode store_mode) |
6819 : elements_kind_(elements_kind), | 6826 : elements_kind_(elements_kind), |
6820 index_offset_(0), | 6827 index_offset_(0), |
6821 is_dehoisted_(false), | 6828 is_dehoisted_(false), |
6822 is_uninitialized_(false), | 6829 is_uninitialized_(false), |
6823 store_mode_(store_mode), | 6830 store_mode_(store_mode), |
6824 new_space_dominator_(NULL) { | 6831 new_space_dominator_(NULL) { |
6825 SetOperandAt(0, obj); | 6832 SetOperandAt(0, obj); |
6826 SetOperandAt(1, key); | 6833 SetOperandAt(1, key); |
6827 SetOperandAt(2, val); | 6834 SetOperandAt(2, val); |
6828 | 6835 |
| 6836 // PREINITIALIZING_STORE is only used to mark stores that initialize a |
| 6837 // memory region resulting from HAllocate (possibly through an |
| 6838 // HInnerAllocatedObject). |
| 6839 ASSERT(store_mode != PREINITIALIZING_STORE || |
| 6840 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
| 6841 |
6829 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | 6842 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
6830 elements_kind == FAST_SMI_ELEMENTS); | 6843 elements_kind == FAST_SMI_ELEMENTS); |
6831 | 6844 |
6832 if (IsFastObjectElementsKind(elements_kind)) { | 6845 if (IsFastObjectElementsKind(elements_kind)) { |
6833 SetFlag(kTrackSideEffectDominators); | 6846 SetFlag(kTrackSideEffectDominators); |
6834 SetGVNFlag(kDependsOnNewSpacePromotion); | 6847 SetGVNFlag(kDependsOnNewSpacePromotion); |
6835 } | 6848 } |
6836 if (is_external()) { | 6849 if (is_external()) { |
6837 SetGVNFlag(kChangesExternalMemory); | 6850 SetGVNFlag(kChangesExternalMemory); |
6838 SetFlag(kAllowUndefinedAsNaN); | 6851 SetFlag(kAllowUndefinedAsNaN); |
(...skipping 14 matching lines...) Expand all Loading... |
6853 (elements_kind >= UINT8_ELEMENTS && | 6866 (elements_kind >= UINT8_ELEMENTS && |
6854 elements_kind <= INT32_ELEMENTS)) { | 6867 elements_kind <= INT32_ELEMENTS)) { |
6855 SetFlag(kTruncatingToInt32); | 6868 SetFlag(kTruncatingToInt32); |
6856 } | 6869 } |
6857 } | 6870 } |
6858 | 6871 |
6859 ElementsKind elements_kind_; | 6872 ElementsKind elements_kind_; |
6860 uint32_t index_offset_; | 6873 uint32_t index_offset_; |
6861 bool is_dehoisted_ : 1; | 6874 bool is_dehoisted_ : 1; |
6862 bool is_uninitialized_ : 1; | 6875 bool is_uninitialized_ : 1; |
6863 StoreFieldOrKeyedMode store_mode_: 1; | 6876 StoreFieldOrKeyedMode store_mode_: 2; |
6864 HValue* new_space_dominator_; | 6877 HValue* new_space_dominator_; |
6865 }; | 6878 }; |
6866 | 6879 |
6867 | 6880 |
6868 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6881 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
6869 public: | 6882 public: |
6870 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6883 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
6871 HValue*, HValue*, StrictModeFlag); | 6884 HValue*, HValue*, StrictModeFlag); |
6872 | 6885 |
6873 HValue* object() { return OperandAt(0); } | 6886 HValue* object() { return OperandAt(0); } |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7553 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7566 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7554 }; | 7567 }; |
7555 | 7568 |
7556 | 7569 |
7557 #undef DECLARE_INSTRUCTION | 7570 #undef DECLARE_INSTRUCTION |
7558 #undef DECLARE_CONCRETE_INSTRUCTION | 7571 #undef DECLARE_CONCRETE_INSTRUCTION |
7559 | 7572 |
7560 } } // namespace v8::internal | 7573 } } // namespace v8::internal |
7561 | 7574 |
7562 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7575 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |