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

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

Issue 6660023: Initialize zone lists in the register allocator with more reasonable initial ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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/hydrogen.cc ('k') | src/lithium-allocator.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 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 if (bits_ != NULL) new_bits->CopyFrom(*bits_); 421 if (bits_ != NULL) new_bits->CopyFrom(*bits_);
422 bits_ = new_bits; 422 bits_ = new_bits;
423 } 423 }
424 424
425 BitVector* bits_; 425 BitVector* bits_;
426 }; 426 };
427 427
428 428
429 class LAllocator BASE_EMBEDDED { 429 class LAllocator BASE_EMBEDDED {
430 public: 430 public:
431 explicit LAllocator(int first_virtual_register, HGraph* graph) 431 LAllocator(int first_virtual_register, HGraph* graph);
432 : chunk_(NULL),
433 live_in_sets_(0),
434 live_ranges_(16),
435 fixed_live_ranges_(8),
436 fixed_double_live_ranges_(8),
437 unhandled_live_ranges_(8),
438 active_live_ranges_(8),
439 inactive_live_ranges_(8),
440 reusable_slots_(8),
441 next_virtual_register_(first_virtual_register),
442 first_artificial_register_(first_virtual_register),
443 mode_(NONE),
444 num_registers_(-1),
445 graph_(graph),
446 has_osr_entry_(false) {}
447 432
448 static void Setup(); 433 static void Setup();
449 static void TraceAlloc(const char* msg, ...); 434 static void TraceAlloc(const char* msg, ...);
450 435
451 // Lithium translation support. 436 // Lithium translation support.
452 // Record a use of an input operand in the current instruction. 437 // Record a use of an input operand in the current instruction.
453 void RecordUse(HValue* value, LUnallocated* operand); 438 void RecordUse(HValue* value, LUnallocated* operand);
454 // Record the definition of the output operand. 439 // Record the definition of the output operand.
455 void RecordDefinition(HInstruction* instr, LUnallocated* operand); 440 void RecordDefinition(HInstruction* instr, LUnallocated* operand);
456 // Record a temporary operand. 441 // Record a temporary operand.
457 void RecordTemporary(LUnallocated* operand); 442 void RecordTemporary(LUnallocated* operand);
458 443
459 // Checks whether the value of a given virtual register is tagged. 444 // Checks whether the value of a given virtual register is tagged.
460 bool HasTaggedValue(int virtual_register) const; 445 bool HasTaggedValue(int virtual_register) const;
461 446
462 // Returns the register kind required by the given virtual register. 447 // Returns the register kind required by the given virtual register.
463 RegisterKind RequiredRegisterKind(int virtual_register) const; 448 RegisterKind RequiredRegisterKind(int virtual_register) const;
464 449
465 // Control max function size. 450 // Control max function size.
466 static int max_initial_value_ids(); 451 static int max_initial_value_ids();
467 452
468 void Allocate(LChunk* chunk); 453 void Allocate(LChunk* chunk);
469 454
470 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; } 455 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; }
471 const ZoneList<LiveRange*>* fixed_live_ranges() const { 456 const Vector<LiveRange*>* fixed_live_ranges() const {
472 return &fixed_live_ranges_; 457 return &fixed_live_ranges_;
473 } 458 }
474 const ZoneList<LiveRange*>* fixed_double_live_ranges() const { 459 const Vector<LiveRange*>* fixed_double_live_ranges() const {
475 return &fixed_double_live_ranges_; 460 return &fixed_double_live_ranges_;
476 } 461 }
477 462
478 LChunk* chunk() const { return chunk_; } 463 LChunk* chunk() const { return chunk_; }
479 HGraph* graph() const { return graph_; } 464 HGraph* graph() const { return graph_; }
480 465
481 void MarkAsOsrEntry() { 466 void MarkAsOsrEntry() {
482 // There can be only one. 467 // There can be only one.
483 ASSERT(!has_osr_entry_); 468 ASSERT(!has_osr_entry_);
484 // Simply set a flag to find and process instruction later. 469 // Simply set a flag to find and process instruction later.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 LChunk* chunk_; 594 LChunk* chunk_;
610 595
611 // During liveness analysis keep a mapping from block id to live_in sets 596 // During liveness analysis keep a mapping from block id to live_in sets
612 // for blocks already analyzed. 597 // for blocks already analyzed.
613 ZoneList<BitVector*> live_in_sets_; 598 ZoneList<BitVector*> live_in_sets_;
614 599
615 // Liveness analysis results. 600 // Liveness analysis results.
616 ZoneList<LiveRange*> live_ranges_; 601 ZoneList<LiveRange*> live_ranges_;
617 602
618 // Lists of live ranges 603 // Lists of live ranges
619 ZoneList<LiveRange*> fixed_live_ranges_; 604 EmbeddedVector<LiveRange*,
Kevin Millikin (Chromium) 2011/03/10 11:23:08 No matter what you do here, it will be a nasty lin
fschneider 2011/03/10 12:04:16 I'm fine with both.
620 ZoneList<LiveRange*> fixed_double_live_ranges_; 605 Register::kNumAllocatableRegisters> fixed_live_ranges_;
606 EmbeddedVector<LiveRange*,
607 DoubleRegister::kNumAllocatableRegisters> fixed_double_live_ranges_;
621 ZoneList<LiveRange*> unhandled_live_ranges_; 608 ZoneList<LiveRange*> unhandled_live_ranges_;
622 ZoneList<LiveRange*> active_live_ranges_; 609 ZoneList<LiveRange*> active_live_ranges_;
623 ZoneList<LiveRange*> inactive_live_ranges_; 610 ZoneList<LiveRange*> inactive_live_ranges_;
624 ZoneList<LiveRange*> reusable_slots_; 611 ZoneList<LiveRange*> reusable_slots_;
625 612
626 // Next virtual register number to be assigned to temporaries. 613 // Next virtual register number to be assigned to temporaries.
627 int next_virtual_register_; 614 int next_virtual_register_;
628 int first_artificial_register_; 615 int first_artificial_register_;
629 GrowableBitVector double_artificial_registers_; 616 GrowableBitVector double_artificial_registers_;
630 617
631 RegisterKind mode_; 618 RegisterKind mode_;
632 int num_registers_; 619 int num_registers_;
633 620
634 HGraph* graph_; 621 HGraph* graph_;
635 622
636 bool has_osr_entry_; 623 bool has_osr_entry_;
637 624
638 DISALLOW_COPY_AND_ASSIGN(LAllocator); 625 DISALLOW_COPY_AND_ASSIGN(LAllocator);
639 }; 626 };
640 627
641 628
642 } } // namespace v8::internal 629 } } // namespace v8::internal
643 630
644 #endif // V8_LITHIUM_ALLOCATOR_H_ 631 #endif // V8_LITHIUM_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698