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

Side by Side Diff: src/x64/lithium-x64.h

Issue 6113004: Version 3.0.7 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.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 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 11 matching lines...) Expand all
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_X64_LITHIUM_X64_H_ 28 #ifndef V8_X64_LITHIUM_X64_H_
29 #define V8_X64_LITHIUM_X64_H_ 29 #define V8_X64_LITHIUM_X64_H_
30 30
31 #include "hydrogen.h" 31 #include "hydrogen.h"
32 #include "lithium-allocator.h" 32 #include "lithium-allocator.h"
33 #include "lithium.h"
33 #include "safepoint-table.h" 34 #include "safepoint-table.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 // Forward declarations. 39 // Forward declarations.
39 class LCodeGen; 40 class LCodeGen;
40 class LEnvironment; 41 class LEnvironment;
41 class Translation; 42 class Translation;
42 43
43 class LInstruction: public ZoneObject { 44 class LInstruction: public ZoneObject {
44 public: 45 public:
45 LInstruction() { } 46 LInstruction() { }
46 virtual ~LInstruction() { } 47 virtual ~LInstruction() { }
47 48
49 virtual void PrintTo(StringStream* stream) const { UNIMPLEMENTED(); }
50 virtual void PrintDataTo(StringStream* stream) const { }
51
48 // Predicates should be generated by macro as in lithium-ia32.h. 52 // Predicates should be generated by macro as in lithium-ia32.h.
49 virtual bool IsLabel() const { 53 virtual bool IsLabel() const {
50 UNIMPLEMENTED(); 54 UNIMPLEMENTED();
51 return false; 55 return false;
52 } 56 }
53 virtual bool IsOsrEntry() const { 57 virtual bool IsOsrEntry() const {
54 UNIMPLEMENTED(); 58 UNIMPLEMENTED();
55 return false; 59 return false;
56 } 60 }
57 61
58 LPointerMap* pointer_map() const { 62 void set_environment(LEnvironment* env) { environment_.set(env); }
59 UNIMPLEMENTED(); 63 LEnvironment* environment() const { return environment_.get(); }
60 return NULL; 64 bool HasEnvironment() const { return environment_.is_set(); }
65
66 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
67 LPointerMap* pointer_map() const { return pointer_map_.get(); }
68 bool HasPointerMap() const { return pointer_map_.is_set(); }
69
70 void set_result(LOperand* operand) { result_.set(operand); }
71 LOperand* result() const { return result_.get(); }
72 bool HasResult() const { return result_.is_set(); }
73
74 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
75 HValue* hydrogen_value() const { return hydrogen_value_; }
76
77 void set_deoptimization_environment(LEnvironment* env) {
78 deoptimization_environment_.set(env);
79 }
80 LEnvironment* deoptimization_environment() const {
81 return deoptimization_environment_.get();
82 }
83 bool HasDeoptimizationEnvironment() const {
84 return deoptimization_environment_.is_set();
61 } 85 }
62 86
63 bool HasPointerMap() const { 87 private:
64 UNIMPLEMENTED(); 88 SetOncePointer<LEnvironment> environment_;
65 return false; 89 SetOncePointer<LPointerMap> pointer_map_;
66 } 90 SetOncePointer<LOperand> result_;
67 91 HValue* hydrogen_value_;
68 virtual void PrintTo(StringStream* stream) const { UNIMPLEMENTED(); } 92 SetOncePointer<LEnvironment> deoptimization_environment_;
69 }; 93 };
70 94
71 95
72 class LParallelMove : public ZoneObject { 96 class LParallelMove : public ZoneObject {
73 public: 97 public:
74 LParallelMove() { } 98 LParallelMove() : move_operands_(4) { }
75 99
76 void AddMove(LOperand* from, LOperand* to) { 100 void AddMove(LOperand* from, LOperand* to) {
77 UNIMPLEMENTED(); 101 UNIMPLEMENTED();
78 } 102 }
79 103
80 const ZoneList<LMoveOperands>* move_operands() const { 104 const ZoneList<LMoveOperands>* move_operands() const {
81 UNIMPLEMENTED(); 105 UNIMPLEMENTED();
82 return NULL; 106 return NULL;
83 } 107 }
108
109 private:
110 ZoneList<LMoveOperands> move_operands_;
84 }; 111 };
85 112
86 113
87 class LGap: public LInstruction { 114 class LGap: public LInstruction {
88 public: 115 public:
89 explicit LGap(HBasicBlock* block) { } 116 explicit LGap(HBasicBlock* block) { }
90 117
91 HBasicBlock* block() const { 118 HBasicBlock* block() const {
92 UNIMPLEMENTED(); 119 UNIMPLEMENTED();
93 return NULL; 120 return NULL;
(...skipping 10 matching lines...) Expand all
104 131
105 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) { 132 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
106 UNIMPLEMENTED(); 133 UNIMPLEMENTED();
107 return NULL; 134 return NULL;
108 } 135 }
109 136
110 LParallelMove* GetParallelMove(InnerPosition pos) { 137 LParallelMove* GetParallelMove(InnerPosition pos) {
111 UNIMPLEMENTED(); 138 UNIMPLEMENTED();
112 return NULL; 139 return NULL;
113 } 140 }
141
142 private:
143 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
144 HBasicBlock* block_;
114 }; 145 };
115 146
116 147
117 class LLabel: public LGap { 148 class LLabel: public LGap {
118 public: 149 public:
119 explicit LLabel(HBasicBlock* block) : LGap(block) { } 150 explicit LLabel(HBasicBlock* block) : LGap(block) { }
151
152 private:
153 Label label_;
154 LLabel* replacement_;
120 }; 155 };
121 156
122 157
123 class LOsrEntry: public LInstruction { 158 class LOsrEntry: public LInstruction {
124 public: 159 public:
125 // Function could be generated by a macro as in lithium-ia32.h. 160 // Function could be generated by a macro as in lithium-ia32.h.
126 static LOsrEntry* cast(LInstruction* instr) { 161 static LOsrEntry* cast(LInstruction* instr) {
127 UNIMPLEMENTED(); 162 UNIMPLEMENTED();
128 return NULL; 163 return NULL;
129 } 164 }
130 165
131 LOperand** SpilledRegisterArray() { 166 LOperand** SpilledRegisterArray() {
132 UNIMPLEMENTED(); 167 UNIMPLEMENTED();
133 return NULL; 168 return NULL;
134 } 169 }
135 LOperand** SpilledDoubleRegisterArray() { 170 LOperand** SpilledDoubleRegisterArray() {
136 UNIMPLEMENTED(); 171 UNIMPLEMENTED();
137 return NULL; 172 return NULL;
138 } 173 }
139 174
140 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand) { 175 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand) {
141 UNIMPLEMENTED(); 176 UNIMPLEMENTED();
142 } 177 }
143 void MarkSpilledDoubleRegister(int allocation_index, 178 void MarkSpilledDoubleRegister(int allocation_index,
144 LOperand* spill_operand) { 179 LOperand* spill_operand) {
145 UNIMPLEMENTED(); 180 UNIMPLEMENTED();
146 } 181 }
182
183 private:
184 // Arrays of spill slot operands for registers with an assigned spill
185 // slot, i.e., that must also be restored to the spill slot on OSR entry.
186 // NULL if the register has no assigned spill slot. Indexed by allocation
187 // index.
188 LOperand* register_spills_[Register::kNumAllocatableRegisters];
189 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
147 }; 190 };
148 191
149 192
150 class LPointerMap: public ZoneObject { 193 class LPointerMap: public ZoneObject {
151 public: 194 public:
152 explicit LPointerMap(int position) { } 195 explicit LPointerMap(int position)
196 : pointer_operands_(8), position_(position), lithium_position_(-1) { }
153 197
154 int lithium_position() const { 198 int lithium_position() const {
155 UNIMPLEMENTED(); 199 UNIMPLEMENTED();
156 return 0; 200 return 0;
157 } 201 }
158 202
159 void RecordPointer(LOperand* op) { UNIMPLEMENTED(); } 203 void RecordPointer(LOperand* op) { UNIMPLEMENTED(); }
204
205 private:
206 ZoneList<LOperand*> pointer_operands_;
207 int position_;
208 int lithium_position_;
160 }; 209 };
161 210
162 211
212 class LEnvironment: public ZoneObject {
213 public:
214 LEnvironment(Handle<JSFunction> closure,
215 int ast_id,
216 int parameter_count,
217 int argument_count,
218 int value_count,
219 LEnvironment* outer)
220 : closure_(closure),
221 arguments_stack_height_(argument_count),
222 deoptimization_index_(Safepoint::kNoDeoptimizationIndex),
223 translation_index_(-1),
224 ast_id_(ast_id),
225 parameter_count_(parameter_count),
226 values_(value_count),
227 representations_(value_count),
228 spilled_registers_(NULL),
229 spilled_double_registers_(NULL),
230 outer_(outer) {
231 }
232
233 Handle<JSFunction> closure() const { return closure_; }
234 int arguments_stack_height() const { return arguments_stack_height_; }
235 int deoptimization_index() const { return deoptimization_index_; }
236 int translation_index() const { return translation_index_; }
237 int ast_id() const { return ast_id_; }
238 int parameter_count() const { return parameter_count_; }
239 const ZoneList<LOperand*>* values() const { return &values_; }
240 LEnvironment* outer() const { return outer_; }
241
242 private:
243 Handle<JSFunction> closure_;
244 int arguments_stack_height_;
245 int deoptimization_index_;
246 int translation_index_;
247 int ast_id_;
248 int parameter_count_;
249 ZoneList<LOperand*> values_;
250 ZoneList<Representation> representations_;
251
252 // Allocation index indexed arrays of spill slot operands for registers
253 // that are also in spill slots at an OSR entry. NULL for environments
254 // that do not correspond to an OSR entry.
255 LOperand** spilled_registers_;
256 LOperand** spilled_double_registers_;
257
258 LEnvironment* outer_;
259 };
260
261
262 class LChunkBuilder;
163 class LChunk: public ZoneObject { 263 class LChunk: public ZoneObject {
164 public: 264 public:
165 explicit LChunk(HGraph* graph) { } 265 explicit LChunk(HGraph* graph)
266 : spill_slot_count_(0),
267 graph_(graph),
268 instructions_(32),
269 pointer_maps_(8),
270 inlined_closures_(1) { }
166 271
167 HGraph* graph() const { 272 int spill_slot_count() const { return spill_slot_count_; }
168 UNIMPLEMENTED(); 273 HGraph* graph() const { return graph_; }
169 return NULL; 274 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
170 } 275 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
171 276 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
172 const ZoneList<LPointerMap*>* pointer_maps() const { 277 return &inlined_closures_;
173 UNIMPLEMENTED();
174 return NULL;
175 } 278 }
176 279
177 LOperand* GetNextSpillSlot(bool double_slot) { 280 LOperand* GetNextSpillSlot(bool double_slot) {
178 UNIMPLEMENTED(); 281 UNIMPLEMENTED();
179 return NULL; 282 return NULL;
180 } 283 }
181 284
182 LConstantOperand* DefineConstantOperand(HConstant* constant) { 285 LConstantOperand* DefineConstantOperand(HConstant* constant) {
183 UNIMPLEMENTED(); 286 UNIMPLEMENTED();
184 return NULL; 287 return NULL;
185 } 288 }
186 289
187 LLabel* GetLabel(int block_id) const { 290 LLabel* GetLabel(int block_id) const {
188 UNIMPLEMENTED(); 291 UNIMPLEMENTED();
189 return NULL; 292 return NULL;
190 } 293 }
191 294
192 const ZoneList<LInstruction*>* instructions() const {
193 UNIMPLEMENTED();
194 return NULL;
195 }
196
197 int GetParameterStackSlot(int index) const { 295 int GetParameterStackSlot(int index) const {
198 UNIMPLEMENTED(); 296 UNIMPLEMENTED();
199 return 0; 297 return 0;
200 } 298 }
201 299
202 void AddGapMove(int index, LOperand* from, LOperand* to) { UNIMPLEMENTED(); } 300 void AddGapMove(int index, LOperand* from, LOperand* to) { UNIMPLEMENTED(); }
203 301
204 LGap* GetGapAt(int index) const { 302 LGap* GetGapAt(int index) const {
205 UNIMPLEMENTED(); 303 UNIMPLEMENTED();
206 return NULL; 304 return NULL;
207 } 305 }
208 306
209 bool IsGapAt(int index) const { 307 bool IsGapAt(int index) const {
210 UNIMPLEMENTED(); 308 UNIMPLEMENTED();
211 return false; 309 return false;
212 } 310 }
213 311
214 int NearestGapPos(int index) const { 312 int NearestGapPos(int index) const {
215 UNIMPLEMENTED(); 313 UNIMPLEMENTED();
216 return 0; 314 return 0;
217 } 315 }
218 316
219 void MarkEmptyBlocks() { UNIMPLEMENTED(); } 317 void MarkEmptyBlocks() { UNIMPLEMENTED(); }
220 318
221 #ifdef DEBUG 319 #ifdef DEBUG
222 void Verify() { UNIMPLEMENTED(); } 320 void Verify() { }
223 #endif 321 #endif
322
323 private:
324 int spill_slot_count_;
325 HGraph* const graph_;
326 ZoneList<LInstruction*> instructions_;
327 ZoneList<LPointerMap*> pointer_maps_;
328 ZoneList<Handle<JSFunction> > inlined_closures_;
224 }; 329 };
225 330
226 331
227 class LChunkBuilder BASE_EMBEDDED { 332 class LChunkBuilder BASE_EMBEDDED {
228 public: 333 public:
229 LChunkBuilder(HGraph* graph, LAllocator* allocator) { } 334 LChunkBuilder(HGraph* graph, LAllocator* allocator)
335 : chunk_(NULL),
336 graph_(graph),
337 status_(UNUSED),
338 current_instruction_(NULL),
339 current_block_(NULL),
340 next_block_(NULL),
341 argument_count_(0),
342 allocator_(allocator),
343 position_(RelocInfo::kNoPosition),
344 instructions_pending_deoptimization_environment_(NULL),
345 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
230 346
231 // Build the sequence for the graph. 347 // Build the sequence for the graph.
232 LChunk* Build() { 348 LChunk* Build();
233 UNIMPLEMENTED();
234 return NULL;
235 };
236 349
237 // Declare methods that deal with the individual node types. 350 // Declare methods that deal with the individual node types.
238 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node) { \ 351 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node) { \
239 UNIMPLEMENTED(); \ 352 UNIMPLEMENTED(); \
240 return NULL; \ 353 return NULL; \
241 } 354 }
242 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 355 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
243 #undef DECLARE_DO 356 #undef DECLARE_DO
244 357
358 private:
359 enum Status {
360 UNUSED,
361 BUILDING,
362 DONE,
363 ABORTED
364 };
365
366 LChunk* chunk() const { return chunk_; }
367 HGraph* graph() const { return graph_; }
368
369 bool is_unused() const { return status_ == UNUSED; }
370 bool is_building() const { return status_ == BUILDING; }
371 bool is_done() const { return status_ == DONE; }
372 bool is_aborted() const { return status_ == ABORTED; }
373
374 void Abort(const char* format, ...);
375
376 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
377
378 LChunk* chunk_;
379 HGraph* const graph_;
380 Status status_;
381 HInstruction* current_instruction_;
382 HBasicBlock* current_block_;
383 HBasicBlock* next_block_;
384 int argument_count_;
385 LAllocator* allocator_;
386 int position_;
387 LInstruction* instructions_pending_deoptimization_environment_;
388 int pending_deoptimization_ast_id_;
389
245 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 390 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
246 }; 391 };
247 392
248 393
249 } } // namespace v8::internal 394 } } // namespace v8::internal
250 395
251 #endif // V8_X64_LITHIUM_X64_H_ 396 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698