Chromium Code Reviews| 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 stores are made only to just allocated objects. | |
|
Toon Verwaest
2014/01/28 16:30:54
PREINITIALIZING_STORE is only used to mark stores
Igor Sheludko
2014/01/28 16:44:43
Done.
| |
| 6647 ASSERT(store_mode != PREINITIALIZING_STORE || | |
| 6648 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | |
| 6642 SetOperandAt(0, obj); | 6649 SetOperandAt(0, obj); |
| 6643 SetOperandAt(1, val); | 6650 SetOperandAt(1, val); |
| 6644 SetOperandAt(2, obj); | 6651 SetOperandAt(2, obj); |
| 6645 access.SetGVNFlags(this, true); | 6652 access.SetGVNFlags(this, true); |
| 6646 } | 6653 } |
| 6647 | 6654 |
| 6648 HObjectAccess access_; | 6655 HObjectAccess access_; |
| 6649 HValue* new_space_dominator_; | 6656 HValue* new_space_dominator_; |
| 6650 WriteBarrierMode write_barrier_mode_ : 1; | 6657 WriteBarrierMode write_barrier_mode_ : 1; |
| 6651 bool has_transition_ : 1; | 6658 bool has_transition_ : 1; |
| 6652 StoreFieldOrKeyedMode store_mode_ : 1; | 6659 StoreFieldOrKeyedMode store_mode_ : 2; |
| 6653 }; | 6660 }; |
| 6654 | 6661 |
| 6655 | 6662 |
| 6656 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6663 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
| 6657 public: | 6664 public: |
| 6658 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6665 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
| 6659 Handle<String>, HValue*, | 6666 Handle<String>, HValue*, |
| 6660 StrictModeFlag); | 6667 StrictModeFlag); |
| 6661 HValue* object() { return OperandAt(0); } | 6668 HValue* object() { return OperandAt(0); } |
| 6662 HValue* value() { return OperandAt(1); } | 6669 HValue* value() { return OperandAt(1); } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 6687 } | 6694 } |
| 6688 | 6695 |
| 6689 Handle<String> name_; | 6696 Handle<String> name_; |
| 6690 StrictModeFlag strict_mode_flag_; | 6697 StrictModeFlag strict_mode_flag_; |
| 6691 }; | 6698 }; |
| 6692 | 6699 |
| 6693 | 6700 |
| 6694 class HStoreKeyed V8_FINAL | 6701 class HStoreKeyed V8_FINAL |
| 6695 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6702 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
| 6696 public: | 6703 public: |
| 6697 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | |
| 6698 ElementsKind); | |
| 6699 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 6704 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6700 ElementsKind, StoreFieldOrKeyedMode); | 6705 ElementsKind, StoreFieldOrKeyedMode); |
| 6701 | 6706 |
| 6702 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6707 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6703 // kind_fast: tagged[int32] = tagged | 6708 // kind_fast: tagged[int32] = tagged |
| 6704 // kind_double: tagged[int32] = double | 6709 // kind_double: tagged[int32] = double |
| 6705 // kind_smi : tagged[int32] = smi | 6710 // kind_smi : tagged[int32] = smi |
| 6706 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 6711 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
| 6707 // kind_external: external[int32] = (double | int32) | 6712 // kind_external: external[int32] = (double | int32) |
| 6708 if (index == 0) { | 6713 if (index == 0) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6808 | 6813 |
| 6809 bool NeedsCanonicalization(); | 6814 bool NeedsCanonicalization(); |
| 6810 | 6815 |
| 6811 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6816 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6812 | 6817 |
| 6813 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6818 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
| 6814 | 6819 |
| 6815 private: | 6820 private: |
| 6816 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6821 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
| 6817 ElementsKind elements_kind, | 6822 ElementsKind elements_kind, |
| 6818 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6823 StoreFieldOrKeyedMode store_mode) |
| 6819 : elements_kind_(elements_kind), | 6824 : elements_kind_(elements_kind), |
| 6820 index_offset_(0), | 6825 index_offset_(0), |
| 6821 is_dehoisted_(false), | 6826 is_dehoisted_(false), |
| 6822 is_uninitialized_(false), | 6827 is_uninitialized_(false), |
| 6823 store_mode_(store_mode), | 6828 store_mode_(store_mode), |
| 6824 new_space_dominator_(NULL) { | 6829 new_space_dominator_(NULL) { |
| 6825 SetOperandAt(0, obj); | 6830 SetOperandAt(0, obj); |
| 6826 SetOperandAt(1, key); | 6831 SetOperandAt(1, key); |
| 6827 SetOperandAt(2, val); | 6832 SetOperandAt(2, val); |
| 6828 | 6833 |
| 6834 // Preinitializing stores are made only to just allocated objects. | |
|
Toon Verwaest
2014/01/28 16:30:54
Same as above.
Igor Sheludko
2014/01/28 16:44:43
Done.
| |
| 6835 ASSERT(store_mode != PREINITIALIZING_STORE || | |
| 6836 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | |
| 6837 | |
| 6829 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | 6838 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
| 6830 elements_kind == FAST_SMI_ELEMENTS); | 6839 elements_kind == FAST_SMI_ELEMENTS); |
| 6831 | 6840 |
| 6832 if (IsFastObjectElementsKind(elements_kind)) { | 6841 if (IsFastObjectElementsKind(elements_kind)) { |
| 6833 SetFlag(kTrackSideEffectDominators); | 6842 SetFlag(kTrackSideEffectDominators); |
| 6834 SetGVNFlag(kDependsOnNewSpacePromotion); | 6843 SetGVNFlag(kDependsOnNewSpacePromotion); |
| 6835 } | 6844 } |
| 6836 if (is_external()) { | 6845 if (is_external()) { |
| 6837 SetGVNFlag(kChangesExternalMemory); | 6846 SetGVNFlag(kChangesExternalMemory); |
| 6838 SetFlag(kAllowUndefinedAsNaN); | 6847 SetFlag(kAllowUndefinedAsNaN); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 6853 (elements_kind >= UINT8_ELEMENTS && | 6862 (elements_kind >= UINT8_ELEMENTS && |
| 6854 elements_kind <= INT32_ELEMENTS)) { | 6863 elements_kind <= INT32_ELEMENTS)) { |
| 6855 SetFlag(kTruncatingToInt32); | 6864 SetFlag(kTruncatingToInt32); |
| 6856 } | 6865 } |
| 6857 } | 6866 } |
| 6858 | 6867 |
| 6859 ElementsKind elements_kind_; | 6868 ElementsKind elements_kind_; |
| 6860 uint32_t index_offset_; | 6869 uint32_t index_offset_; |
| 6861 bool is_dehoisted_ : 1; | 6870 bool is_dehoisted_ : 1; |
| 6862 bool is_uninitialized_ : 1; | 6871 bool is_uninitialized_ : 1; |
| 6863 StoreFieldOrKeyedMode store_mode_: 1; | 6872 StoreFieldOrKeyedMode store_mode_: 2; |
| 6864 HValue* new_space_dominator_; | 6873 HValue* new_space_dominator_; |
| 6865 }; | 6874 }; |
| 6866 | 6875 |
| 6867 | 6876 |
| 6868 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6877 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
| 6869 public: | 6878 public: |
| 6870 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6879 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
| 6871 HValue*, HValue*, StrictModeFlag); | 6880 HValue*, HValue*, StrictModeFlag); |
| 6872 | 6881 |
| 6873 HValue* object() { return OperandAt(0); } | 6882 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; } | 7562 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7554 }; | 7563 }; |
| 7555 | 7564 |
| 7556 | 7565 |
| 7557 #undef DECLARE_INSTRUCTION | 7566 #undef DECLARE_INSTRUCTION |
| 7558 #undef DECLARE_CONCRETE_INSTRUCTION | 7567 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7559 | 7568 |
| 7560 } } // namespace v8::internal | 7569 } } // namespace v8::internal |
| 7561 | 7570 |
| 7562 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7571 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |