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