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

Side by Side Diff: src/lithium.h

Issue 6142011: Crankshaft: Move LEnvironment and LPointerMap classes to platform-independent... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/lithium.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_LITHIUM_H_ 28 #ifndef V8_LITHIUM_H_
29 #define V8_LITHIUM_H_ 29 #define V8_LITHIUM_H_
30 30
31 #include "hydrogen.h"
31 #include "lithium-allocator.h" 32 #include "lithium-allocator.h"
33 #include "safepoint-table.h"
32 34
33 namespace v8 { 35 namespace v8 {
34 namespace internal { 36 namespace internal {
35 37
38 class LCodeGen;
36 class LGapNode; 39 class LGapNode;
40 class Translation;
37 41
38 class LGapResolver BASE_EMBEDDED { 42 class LGapResolver BASE_EMBEDDED {
39 public: 43 public:
40 LGapResolver(); 44 LGapResolver();
41 const ZoneList<LMoveOperands>* Resolve(const ZoneList<LMoveOperands>* moves, 45 const ZoneList<LMoveOperands>* Resolve(const ZoneList<LMoveOperands>* moves,
42 LOperand* marker_operand); 46 LOperand* marker_operand);
43 47
44 private: 48 private:
45 LGapNode* LookupNode(LOperand* operand); 49 LGapNode* LookupNode(LOperand* operand);
46 bool CanReach(LGapNode* a, LGapNode* b, int visited_id); 50 bool CanReach(LGapNode* a, LGapNode* b, int visited_id);
(...skipping 24 matching lines...) Expand all
71 return &move_operands_; 75 return &move_operands_;
72 } 76 }
73 77
74 void PrintDataTo(StringStream* stream) const; 78 void PrintDataTo(StringStream* stream) const;
75 79
76 private: 80 private:
77 ZoneList<LMoveOperands> move_operands_; 81 ZoneList<LMoveOperands> move_operands_;
78 }; 82 };
79 83
80 84
85 class LPointerMap: public ZoneObject {
86 public:
87 explicit LPointerMap(int position)
88 : pointer_operands_(8), position_(position), lithium_position_(-1) { }
89
90 const ZoneList<LOperand*>* operands() const { return &pointer_operands_; }
91 int position() const { return position_; }
92 int lithium_position() const { return lithium_position_; }
93
94 void set_lithium_position(int pos) {
95 ASSERT(lithium_position_ == -1);
96 lithium_position_ = pos;
97 }
98
99 void RecordPointer(LOperand* op);
100 void PrintTo(StringStream* stream);
101
102 private:
103 ZoneList<LOperand*> pointer_operands_;
104 int position_;
105 int lithium_position_;
106 };
107
108
109 class LEnvironment: public ZoneObject {
110 public:
111 LEnvironment(Handle<JSFunction> closure,
112 int ast_id,
113 int parameter_count,
114 int argument_count,
115 int value_count,
116 LEnvironment* outer)
117 : closure_(closure),
118 arguments_stack_height_(argument_count),
119 deoptimization_index_(Safepoint::kNoDeoptimizationIndex),
120 translation_index_(-1),
121 ast_id_(ast_id),
122 parameter_count_(parameter_count),
123 values_(value_count),
124 representations_(value_count),
125 spilled_registers_(NULL),
126 spilled_double_registers_(NULL),
127 outer_(outer) {
128 }
129
130 Handle<JSFunction> closure() const { return closure_; }
131 int arguments_stack_height() const { return arguments_stack_height_; }
132 int deoptimization_index() const { return deoptimization_index_; }
133 int translation_index() const { return translation_index_; }
134 int ast_id() const { return ast_id_; }
135 int parameter_count() const { return parameter_count_; }
136 LOperand** spilled_registers() const { return spilled_registers_; }
137 LOperand** spilled_double_registers() const {
138 return spilled_double_registers_;
139 }
140 const ZoneList<LOperand*>* values() const { return &values_; }
141 LEnvironment* outer() const { return outer_; }
142
143 void AddValue(LOperand* operand, Representation representation) {
144 values_.Add(operand);
145 representations_.Add(representation);
146 }
147
148 bool HasTaggedValueAt(int index) const {
149 return representations_[index].IsTagged();
150 }
151
152 void Register(int deoptimization_index, int translation_index) {
153 ASSERT(!HasBeenRegistered());
154 deoptimization_index_ = deoptimization_index;
155 translation_index_ = translation_index;
156 }
157 bool HasBeenRegistered() const {
158 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex;
159 }
160
161 void SetSpilledRegisters(LOperand** registers,
162 LOperand** double_registers) {
163 spilled_registers_ = registers;
164 spilled_double_registers_ = double_registers;
165 }
166
167 void PrintTo(StringStream* stream);
168
169 private:
170 Handle<JSFunction> closure_;
171 int arguments_stack_height_;
172 int deoptimization_index_;
173 int translation_index_;
174 int ast_id_;
175 int parameter_count_;
176 ZoneList<LOperand*> values_;
177 ZoneList<Representation> representations_;
178
179 // Allocation index indexed arrays of spill slot operands for registers
180 // that are also in spill slots at an OSR entry. NULL for environments
181 // that do not correspond to an OSR entry.
182 LOperand** spilled_registers_;
183 LOperand** spilled_double_registers_;
184
185 LEnvironment* outer_;
186
187 friend class LCodegen;
188 };
189
81 } } // namespace v8::internal 190 } } // namespace v8::internal
82 191
83 #endif // V8_LITHIUM_H_ 192 #endif // V8_LITHIUM_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/lithium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698