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

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

Issue 7114004: Add support for hydrogen control instructions with >2 successor blocks. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 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 14 matching lines...) Expand all
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_IA32_LITHIUM_IA32_H_ 28 #ifndef V8_IA32_LITHIUM_IA32_H_
29 #define V8_IA32_LITHIUM_IA32_H_ 29 #define V8_IA32_LITHIUM_IA32_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 "lithium.h"
34 #include "safepoint-table.h" 34 #include "safepoint-table.h"
35 #include "utils.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 // Forward declarations. 40 // Forward declarations.
40 class LCodeGen; 41 class LCodeGen;
41 42
42 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
43 V(AccessArgumentsAt) \ 44 V(AccessArgumentsAt) \
44 V(AddI) \ 45 V(AddI) \
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 private: 276 private:
276 LEnvironment* environment_; 277 LEnvironment* environment_;
277 SetOncePointer<LPointerMap> pointer_map_; 278 SetOncePointer<LPointerMap> pointer_map_;
278 HValue* hydrogen_value_; 279 HValue* hydrogen_value_;
279 SetOncePointer<LEnvironment> deoptimization_environment_; 280 SetOncePointer<LEnvironment> deoptimization_environment_;
280 bool is_call_; 281 bool is_call_;
281 bool is_save_doubles_; 282 bool is_save_doubles_;
282 }; 283 };
283 284
284 285
285 template<typename ElementType, int NumElements>
286 class OperandContainer {
287 public:
288 OperandContainer() {
289 for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
290 }
291 int length() { return NumElements; }
292 ElementType& operator[](int i) {
293 ASSERT(i < length());
294 return elems_[i];
295 }
296 void PrintOperandsTo(StringStream* stream);
297
298 private:
299 ElementType elems_[NumElements];
300 };
301
302
303 template<typename ElementType>
304 class OperandContainer<ElementType, 0> {
305 public:
306 int length() { return 0; }
307 void PrintOperandsTo(StringStream* stream) { }
308 ElementType& operator[](int i) {
309 UNREACHABLE();
310 static ElementType t = 0;
311 return t;
312 }
313 };
314
315
316 // R = number of result operands (0 or 1). 286 // R = number of result operands (0 or 1).
317 // I = number of input operands. 287 // I = number of input operands.
318 // T = number of temporary operands. 288 // T = number of temporary operands.
319 template<int R, int I, int T> 289 template<int R, int I, int T>
320 class LTemplateInstruction: public LInstruction { 290 class LTemplateInstruction: public LInstruction {
321 public: 291 public:
322 // Allow 0 or 1 output operands. 292 // Allow 0 or 1 output operands.
323 STATIC_ASSERT(R == 0 || R == 1); 293 STATIC_ASSERT(R == 0 || R == 1);
324 virtual bool HasResult() const { return R != 0; } 294 virtual bool HasResult() const { return R != 0; }
325 void set_result(LOperand* operand) { results_[0] = operand; } 295 void set_result(LOperand* operand) { results_[0] = operand; }
326 LOperand* result() { return results_[0]; } 296 LOperand* result() { return results_[0]; }
327 297
328 int InputCount() { return I; } 298 int InputCount() { return I; }
329 LOperand* InputAt(int i) { return inputs_[i]; } 299 LOperand* InputAt(int i) { return inputs_[i]; }
330 300
331 int TempCount() { return T; } 301 int TempCount() { return T; }
332 LOperand* TempAt(int i) { return temps_[i]; } 302 LOperand* TempAt(int i) { return temps_[i]; }
333 303
334 virtual void PrintDataTo(StringStream* stream); 304 virtual void PrintDataTo(StringStream* stream);
335 virtual void PrintOutputOperandTo(StringStream* stream); 305 virtual void PrintOutputOperandTo(StringStream* stream);
336 306
337 protected: 307 protected:
338 OperandContainer<LOperand*, R> results_; 308 EmbeddedContainer<LOperand*, R> results_;
339 OperandContainer<LOperand*, I> inputs_; 309 EmbeddedContainer<LOperand*, I> inputs_;
340 OperandContainer<LOperand*, T> temps_; 310 EmbeddedContainer<LOperand*, T> temps_;
341 }; 311 };
342 312
343 313
344 class LGap: public LTemplateInstruction<0, 0, 0> { 314 class LGap: public LTemplateInstruction<0, 0, 0> {
345 public: 315 public:
346 explicit LGap(HBasicBlock* block) : block_(block) { 316 explicit LGap(HBasicBlock* block) : block_(block) {
347 parallel_moves_[BEFORE] = NULL; 317 parallel_moves_[BEFORE] = NULL;
348 parallel_moves_[START] = NULL; 318 parallel_moves_[START] = NULL;
349 parallel_moves_[END] = NULL; 319 parallel_moves_[END] = NULL;
350 parallel_moves_[AFTER] = NULL; 320 parallel_moves_[AFTER] = NULL;
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 2363
2394 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2364 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2395 }; 2365 };
2396 2366
2397 #undef DECLARE_HYDROGEN_ACCESSOR 2367 #undef DECLARE_HYDROGEN_ACCESSOR
2398 #undef DECLARE_CONCRETE_INSTRUCTION 2368 #undef DECLARE_CONCRETE_INSTRUCTION
2399 2369
2400 } } // namespace v8::internal 2370 } } // namespace v8::internal
2401 2371
2402 #endif // V8_IA32_LITHIUM_IA32_H_ 2372 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698