OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void MarkAsCall() { is_call_ = true; } | 254 void MarkAsCall() { is_call_ = true; } |
255 | 255 |
256 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 256 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
257 | 257 |
258 // Interface to the register allocator and iterators. | 258 // Interface to the register allocator and iterators. |
259 bool IsMarkedAsCall() const { return is_call_; } | 259 bool IsMarkedAsCall() const { return is_call_; } |
260 | 260 |
261 virtual bool HasResult() const = 0; | 261 virtual bool HasResult() const = 0; |
262 virtual LOperand* result() = 0; | 262 virtual LOperand* result() = 0; |
263 | 263 |
264 virtual int InputCount() = 0; | |
265 virtual LOperand* InputAt(int i) = 0; | |
266 virtual int TempCount() = 0; | 264 virtual int TempCount() = 0; |
267 virtual LOperand* TempAt(int i) = 0; | 265 virtual LOperand* TempAt(int i) = 0; |
268 | 266 |
269 LOperand* FirstInput() { return InputAt(0); } | 267 LOperand* FirstInput() { return InputAt(0); } |
270 LOperand* Output() { return HasResult() ? result() : NULL; } | 268 LOperand* Output() { return HasResult() ? result() : NULL; } |
271 | 269 |
272 #ifdef DEBUG | 270 #ifdef DEBUG |
273 void VerifyCall(); | 271 void VerifyCall(); |
274 #endif | 272 #endif |
275 | 273 |
276 private: | 274 private: |
| 275 // Iterator support. |
| 276 friend class InputIterator; |
| 277 virtual int InputCount() = 0; |
| 278 virtual LOperand* InputAt(int i) = 0; |
| 279 |
277 LEnvironment* environment_; | 280 LEnvironment* environment_; |
278 SetOncePointer<LPointerMap> pointer_map_; | 281 SetOncePointer<LPointerMap> pointer_map_; |
279 HValue* hydrogen_value_; | 282 HValue* hydrogen_value_; |
280 bool is_call_; | 283 bool is_call_; |
281 }; | 284 }; |
282 | 285 |
283 | 286 |
284 // R = number of result operands (0 or 1). | 287 // R = number of result operands (0 or 1). |
285 // I = number of input operands. | 288 // I = number of input operands. |
286 // T = number of temporary operands. | 289 // T = number of temporary operands. |
287 template<int R, int I, int T> | 290 template<int R, int I, int T> |
288 class LTemplateInstruction: public LInstruction { | 291 class LTemplateInstruction: public LInstruction { |
289 public: | 292 public: |
290 // Allow 0 or 1 output operands. | 293 // Allow 0 or 1 output operands. |
291 STATIC_ASSERT(R == 0 || R == 1); | 294 STATIC_ASSERT(R == 0 || R == 1); |
292 virtual bool HasResult() const { return R != 0; } | 295 virtual bool HasResult() const { return R != 0; } |
293 void set_result(LOperand* operand) { results_[0] = operand; } | 296 void set_result(LOperand* operand) { results_[0] = operand; } |
294 LOperand* result() { return results_[0]; } | 297 LOperand* result() { return results_[0]; } |
295 | 298 |
296 int InputCount() { return I; } | |
297 LOperand* InputAt(int i) { return inputs_[i]; } | 299 LOperand* InputAt(int i) { return inputs_[i]; } |
298 | 300 |
299 int TempCount() { return T; } | 301 int TempCount() { return T; } |
300 LOperand* TempAt(int i) { return temps_[i]; } | 302 LOperand* TempAt(int i) { return temps_[i]; } |
301 | 303 |
302 protected: | 304 protected: |
303 EmbeddedContainer<LOperand*, R> results_; | 305 EmbeddedContainer<LOperand*, R> results_; |
304 EmbeddedContainer<LOperand*, I> inputs_; | 306 EmbeddedContainer<LOperand*, I> inputs_; |
305 EmbeddedContainer<LOperand*, T> temps_; | 307 EmbeddedContainer<LOperand*, T> temps_; |
| 308 |
| 309 private: |
| 310 virtual int InputCount() { return I; } |
306 }; | 311 }; |
307 | 312 |
308 | 313 |
309 class LGap: public LTemplateInstruction<0, 0, 0> { | 314 class LGap: public LTemplateInstruction<0, 0, 0> { |
310 public: | 315 public: |
311 explicit LGap(HBasicBlock* block) | 316 explicit LGap(HBasicBlock* block) |
312 : block_(block) { | 317 : block_(block) { |
313 parallel_moves_[BEFORE] = NULL; | 318 parallel_moves_[BEFORE] = NULL; |
314 parallel_moves_[START] = NULL; | 319 parallel_moves_[START] = NULL; |
315 parallel_moves_[END] = NULL; | 320 parallel_moves_[END] = NULL; |
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 | 2387 |
2383 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2388 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2384 }; | 2389 }; |
2385 | 2390 |
2386 #undef DECLARE_HYDROGEN_ACCESSOR | 2391 #undef DECLARE_HYDROGEN_ACCESSOR |
2387 #undef DECLARE_CONCRETE_INSTRUCTION | 2392 #undef DECLARE_CONCRETE_INSTRUCTION |
2388 | 2393 |
2389 } } // namespace v8::int | 2394 } } // namespace v8::int |
2390 | 2395 |
2391 #endif // V8_X64_LITHIUM_X64_H_ | 2396 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |