| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 V(BinaryOperation) \ | 39 V(BinaryOperation) \ |
| 40 V(BitwiseBinaryOperation) \ | 40 V(BitwiseBinaryOperation) \ |
| 41 V(ControlInstruction) \ | 41 V(ControlInstruction) \ |
| 42 V(Instruction) \ | 42 V(Instruction) \ |
| 43 | 43 |
| 44 | 44 |
| 45 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 45 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
| 46 V(AbnormalExit) \ | 46 V(AbnormalExit) \ |
| 47 V(AccessArgumentsAt) \ | 47 V(AccessArgumentsAt) \ |
| 48 V(Add) \ | 48 V(Add) \ |
| 49 V(AllocateBlockContext) \ |
| 49 V(Allocate) \ | 50 V(Allocate) \ |
| 50 V(ApplyArguments) \ | 51 V(ApplyArguments) \ |
| 51 V(ArgumentsElements) \ | 52 V(ArgumentsElements) \ |
| 52 V(ArgumentsLength) \ | 53 V(ArgumentsLength) \ |
| 53 V(ArgumentsObject) \ | 54 V(ArgumentsObject) \ |
| 54 V(Bitwise) \ | 55 V(Bitwise) \ |
| 55 V(BlockEntry) \ | 56 V(BlockEntry) \ |
| 56 V(BoundsCheck) \ | 57 V(BoundsCheck) \ |
| 57 V(BoundsCheckBaseIndexInformation) \ | 58 V(BoundsCheckBaseIndexInformation) \ |
| 58 V(Branch) \ | 59 V(Branch) \ |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 V(Ror) \ | 134 V(Ror) \ |
| 134 V(Sar) \ | 135 V(Sar) \ |
| 135 V(SeqStringGetChar) \ | 136 V(SeqStringGetChar) \ |
| 136 V(SeqStringSetChar) \ | 137 V(SeqStringSetChar) \ |
| 137 V(Shl) \ | 138 V(Shl) \ |
| 138 V(Shr) \ | 139 V(Shr) \ |
| 139 V(Simulate) \ | 140 V(Simulate) \ |
| 140 V(StackCheck) \ | 141 V(StackCheck) \ |
| 141 V(StoreCodeEntry) \ | 142 V(StoreCodeEntry) \ |
| 142 V(StoreContextSlot) \ | 143 V(StoreContextSlot) \ |
| 144 V(StoreFrameContext) \ |
| 143 V(StoreGlobalCell) \ | 145 V(StoreGlobalCell) \ |
| 144 V(StoreKeyed) \ | 146 V(StoreKeyed) \ |
| 145 V(StoreKeyedGeneric) \ | 147 V(StoreKeyedGeneric) \ |
| 146 V(StoreNamedField) \ | 148 V(StoreNamedField) \ |
| 147 V(StoreNamedGeneric) \ | 149 V(StoreNamedGeneric) \ |
| 148 V(StringAdd) \ | 150 V(StringAdd) \ |
| 149 V(StringCharCodeAt) \ | 151 V(StringCharCodeAt) \ |
| 150 V(StringCharFromCode) \ | 152 V(StringCharFromCode) \ |
| 151 V(StringCompareAndBranch) \ | 153 V(StringCompareAndBranch) \ |
| 152 V(Sub) \ | 154 V(Sub) \ |
| (...skipping 5638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5791 // Load and check the value of the context slot. Deoptimize if it's the | 5793 // Load and check the value of the context slot. Deoptimize if it's the |
| 5792 // hole value. This is used for checking for loading of uninitialized | 5794 // hole value. This is used for checking for loading of uninitialized |
| 5793 // harmony bindings where we deoptimize into full-codegen generated code | 5795 // harmony bindings where we deoptimize into full-codegen generated code |
| 5794 // which will subsequently throw a reference error. | 5796 // which will subsequently throw a reference error. |
| 5795 kCheckDeoptimize, | 5797 kCheckDeoptimize, |
| 5796 // Load and check the value of the context slot. Return undefined if it's | 5798 // Load and check the value of the context slot. Return undefined if it's |
| 5797 // the hole value. This is used for non-harmony const assignments | 5799 // the hole value. This is used for non-harmony const assignments |
| 5798 kCheckReturnUndefined | 5800 kCheckReturnUndefined |
| 5799 }; | 5801 }; |
| 5800 | 5802 |
| 5801 HLoadContextSlot(HValue* context, Variable* var) | 5803 HLoadContextSlot(HValue* context, int slot_index, Mode mode) |
| 5802 : HUnaryOperation(context), slot_index_(var->index()) { | 5804 : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) { |
| 5803 ASSERT(var->IsContextSlot()); | |
| 5804 switch (var->mode()) { | |
| 5805 case LET: | |
| 5806 case CONST: | |
| 5807 mode_ = kCheckDeoptimize; | |
| 5808 break; | |
| 5809 case CONST_LEGACY: | |
| 5810 mode_ = kCheckReturnUndefined; | |
| 5811 break; | |
| 5812 default: | |
| 5813 mode_ = kNoCheck; | |
| 5814 } | |
| 5815 set_representation(Representation::Tagged()); | 5805 set_representation(Representation::Tagged()); |
| 5816 SetFlag(kUseGVN); | 5806 SetFlag(kUseGVN); |
| 5817 SetDependsOnFlag(kContextSlots); | 5807 SetDependsOnFlag(kContextSlots); |
| 5818 } | 5808 } |
| 5819 | 5809 |
| 5820 int slot_index() const { return slot_index_; } | 5810 int slot_index() const { return slot_index_; } |
| 5821 Mode mode() const { return mode_; } | 5811 Mode mode() const { return mode_; } |
| 5822 | 5812 |
| 5823 bool DeoptimizesOnHole() { | 5813 bool DeoptimizesOnHole() { |
| 5824 return mode_ == kCheckDeoptimize; | 5814 return mode_ == kCheckDeoptimize; |
| (...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7710 return HType::Tagged(); | 7700 return HType::Tagged(); |
| 7711 } | 7701 } |
| 7712 | 7702 |
| 7713 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 7703 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
| 7714 | 7704 |
| 7715 private: | 7705 private: |
| 7716 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7706 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7717 }; | 7707 }; |
| 7718 | 7708 |
| 7719 | 7709 |
| 7710 class HStoreFrameContext: public HUnaryOperation { |
| 7711 public: |
| 7712 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); |
| 7713 |
| 7714 HValue* context() { return OperandAt(0); } |
| 7715 |
| 7716 virtual Representation RequiredInputRepresentation(int index) { |
| 7717 return Representation::Tagged(); |
| 7718 } |
| 7719 |
| 7720 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext) |
| 7721 private: |
| 7722 explicit HStoreFrameContext(HValue* context) |
| 7723 : HUnaryOperation(context) { |
| 7724 set_representation(Representation::Tagged()); |
| 7725 SetChangesFlag(kContextSlots); |
| 7726 } |
| 7727 }; |
| 7728 |
| 7729 |
| 7730 class HAllocateBlockContext: public HTemplateInstruction<2> { |
| 7731 public: |
| 7732 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, |
| 7733 HValue*, Handle<ScopeInfo>); |
| 7734 HValue* context() { return OperandAt(0); } |
| 7735 HValue* function() { return OperandAt(1); } |
| 7736 Handle<ScopeInfo> scope_info() { return scope_info_; } |
| 7737 |
| 7738 virtual Representation RequiredInputRepresentation(int index) { |
| 7739 return Representation::Tagged(); |
| 7740 } |
| 7741 |
| 7742 virtual void PrintDataTo(StringStream* stream); |
| 7743 |
| 7744 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) |
| 7745 |
| 7746 private: |
| 7747 HAllocateBlockContext(HValue* context, |
| 7748 HValue* function, |
| 7749 Handle<ScopeInfo> scope_info) |
| 7750 : scope_info_(scope_info) { |
| 7751 SetOperandAt(0, context); |
| 7752 SetOperandAt(1, function); |
| 7753 set_representation(Representation::Tagged()); |
| 7754 } |
| 7755 |
| 7756 Handle<ScopeInfo> scope_info_; |
| 7757 }; |
| 7758 |
| 7759 |
| 7760 |
| 7720 #undef DECLARE_INSTRUCTION | 7761 #undef DECLARE_INSTRUCTION |
| 7721 #undef DECLARE_CONCRETE_INSTRUCTION | 7762 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7722 | 7763 |
| 7723 } } // namespace v8::internal | 7764 } } // namespace v8::internal |
| 7724 | 7765 |
| 7725 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7766 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |