Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: src/hydrogen-instructions.h

Issue 307593002: Preliminary support for block contexts in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "v8.h" 8 #include "v8.h"
9 9
10 #include "allocation.h" 10 #include "allocation.h"
(...skipping 27 matching lines...) Expand all
38 V(BinaryOperation) \ 38 V(BinaryOperation) \
39 V(BitwiseBinaryOperation) \ 39 V(BitwiseBinaryOperation) \
40 V(ControlInstruction) \ 40 V(ControlInstruction) \
41 V(Instruction) \ 41 V(Instruction) \
42 42
43 43
44 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ 44 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
45 V(AbnormalExit) \ 45 V(AbnormalExit) \
46 V(AccessArgumentsAt) \ 46 V(AccessArgumentsAt) \
47 V(Add) \ 47 V(Add) \
48 V(AllocateBlockContext) \
48 V(Allocate) \ 49 V(Allocate) \
49 V(ApplyArguments) \ 50 V(ApplyArguments) \
50 V(ArgumentsElements) \ 51 V(ArgumentsElements) \
51 V(ArgumentsLength) \ 52 V(ArgumentsLength) \
52 V(ArgumentsObject) \ 53 V(ArgumentsObject) \
53 V(ArrayShift) \ 54 V(ArrayShift) \
54 V(Bitwise) \ 55 V(Bitwise) \
55 V(BlockEntry) \ 56 V(BlockEntry) \
56 V(BoundsCheck) \ 57 V(BoundsCheck) \
57 V(BoundsCheckBaseIndexInformation) \ 58 V(BoundsCheckBaseIndexInformation) \
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 5689 matching lines...) Expand 10 before | Expand all | Expand 10 after
5842 // Load and check the value of the context slot. Deoptimize if it's the 5844 // Load and check the value of the context slot. Deoptimize if it's the
5843 // hole value. This is used for checking for loading of uninitialized 5845 // hole value. This is used for checking for loading of uninitialized
5844 // harmony bindings where we deoptimize into full-codegen generated code 5846 // harmony bindings where we deoptimize into full-codegen generated code
5845 // which will subsequently throw a reference error. 5847 // which will subsequently throw a reference error.
5846 kCheckDeoptimize, 5848 kCheckDeoptimize,
5847 // Load and check the value of the context slot. Return undefined if it's 5849 // Load and check the value of the context slot. Return undefined if it's
5848 // the hole value. This is used for non-harmony const assignments 5850 // the hole value. This is used for non-harmony const assignments
5849 kCheckReturnUndefined 5851 kCheckReturnUndefined
5850 }; 5852 };
5851 5853
5852 HLoadContextSlot(HValue* context, Variable* var) 5854 HLoadContextSlot(HValue* context, int slot_index, Mode mode)
5853 : HUnaryOperation(context), slot_index_(var->index()) { 5855 : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) {
5854 ASSERT(var->IsContextSlot());
5855 switch (var->mode()) {
5856 case LET:
5857 case CONST:
5858 mode_ = kCheckDeoptimize;
5859 break;
5860 case CONST_LEGACY:
5861 mode_ = kCheckReturnUndefined;
5862 break;
5863 default:
5864 mode_ = kNoCheck;
5865 }
5866 set_representation(Representation::Tagged()); 5856 set_representation(Representation::Tagged());
5867 SetFlag(kUseGVN); 5857 SetFlag(kUseGVN);
5868 SetDependsOnFlag(kContextSlots); 5858 SetDependsOnFlag(kContextSlots);
5869 } 5859 }
5870 5860
5871 int slot_index() const { return slot_index_; } 5861 int slot_index() const { return slot_index_; }
5872 Mode mode() const { return mode_; } 5862 Mode mode() const { return mode_; }
5873 5863
5874 bool DeoptimizesOnHole() { 5864 bool DeoptimizesOnHole() {
5875 return mode_ == kCheckDeoptimize; 5865 return mode_ == kCheckDeoptimize;
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
7798 return HType::Tagged(); 7788 return HType::Tagged();
7799 } 7789 }
7800 7790
7801 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 7791 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
7802 7792
7803 private: 7793 private:
7804 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7794 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7805 }; 7795 };
7806 7796
7807 7797
7798 class HStoreFrameContext: public HUnaryOperation {
7799 public:
7800 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*);
7801
7802 HValue* context() { return OperandAt(0); }
7803
7804 virtual Representation RequiredInputRepresentation(int index) {
7805 return Representation::Tagged();
7806 }
7807
7808 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext)
7809 private:
7810 explicit HStoreFrameContext(HValue* context)
7811 : HUnaryOperation(context) {
7812 set_representation(Representation::Tagged());
7813 SetChangesFlag(kContextSlots);
7814 }
7815 };
7816
7817
7818 class HAllocateBlockContext: public HTemplateInstruction<2> {
7819 public:
7820 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*,
7821 HValue*, Handle<ScopeInfo>);
7822 HValue* context() { return OperandAt(0); }
7823 HValue* function() { return OperandAt(1); }
7824 Handle<ScopeInfo> scope_info() { return scope_info_; }
7825
7826 virtual Representation RequiredInputRepresentation(int index) {
7827 return Representation::Tagged();
7828 }
7829
7830 virtual void PrintDataTo(StringStream* stream);
7831
7832 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext)
7833
7834 private:
7835 HAllocateBlockContext(HValue* context,
7836 HValue* function,
7837 Handle<ScopeInfo> scope_info)
7838 : scope_info_(scope_info) {
7839 SetOperandAt(0, context);
7840 SetOperandAt(1, function);
7841 set_representation(Representation::Tagged());
7842 }
7843
7844 Handle<ScopeInfo> scope_info_;
7845 };
7846
7847
7848
7808 #undef DECLARE_INSTRUCTION 7849 #undef DECLARE_INSTRUCTION
7809 #undef DECLARE_CONCRETE_INSTRUCTION 7850 #undef DECLARE_CONCRETE_INSTRUCTION
7810 7851
7811 } } // namespace v8::internal 7852 } } // namespace v8::internal
7812 7853
7813 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7854 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698