| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 TraceAlloc(const char* msg, ...); | 433 static void TraceAlloc(const char* msg, ...); |
| 449 | 434 |
| 450 // Lithium translation support. | 435 // Lithium translation support. |
| 451 // Record a use of an input operand in the current instruction. | 436 // Record a use of an input operand in the current instruction. |
| 452 void RecordUse(HValue* value, LUnallocated* operand); | 437 void RecordUse(HValue* value, LUnallocated* operand); |
| 453 // Record the definition of the output operand. | 438 // Record the definition of the output operand. |
| 454 void RecordDefinition(HInstruction* instr, LUnallocated* operand); | 439 void RecordDefinition(HInstruction* instr, LUnallocated* operand); |
| 455 // Record a temporary operand. | 440 // Record a temporary operand. |
| 456 void RecordTemporary(LUnallocated* operand); | 441 void RecordTemporary(LUnallocated* operand); |
| 457 | 442 |
| 458 // Checks whether the value of a given virtual register is tagged. | 443 // Checks whether the value of a given virtual register is tagged. |
| 459 bool HasTaggedValue(int virtual_register) const; | 444 bool HasTaggedValue(int virtual_register) const; |
| 460 | 445 |
| 461 // Returns the register kind required by the given virtual register. | 446 // Returns the register kind required by the given virtual register. |
| 462 RegisterKind RequiredRegisterKind(int virtual_register) const; | 447 RegisterKind RequiredRegisterKind(int virtual_register) const; |
| 463 | 448 |
| 464 // Control max function size. | 449 // Control max function size. |
| 465 static int max_initial_value_ids(); | 450 static int max_initial_value_ids(); |
| 466 | 451 |
| 467 void Allocate(LChunk* chunk); | 452 void Allocate(LChunk* chunk); |
| 468 | 453 |
| 469 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; } | 454 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; } |
| 470 const ZoneList<LiveRange*>* fixed_live_ranges() const { | 455 const Vector<LiveRange*>* fixed_live_ranges() const { |
| 471 return &fixed_live_ranges_; | 456 return &fixed_live_ranges_; |
| 472 } | 457 } |
| 473 const ZoneList<LiveRange*>* fixed_double_live_ranges() const { | 458 const Vector<LiveRange*>* fixed_double_live_ranges() const { |
| 474 return &fixed_double_live_ranges_; | 459 return &fixed_double_live_ranges_; |
| 475 } | 460 } |
| 476 | 461 |
| 477 LChunk* chunk() const { return chunk_; } | 462 LChunk* chunk() const { return chunk_; } |
| 478 HGraph* graph() const { return graph_; } | 463 HGraph* graph() const { return graph_; } |
| 479 | 464 |
| 480 void MarkAsOsrEntry() { | 465 void MarkAsOsrEntry() { |
| 481 // There can be only one. | 466 // There can be only one. |
| 482 ASSERT(!has_osr_entry_); | 467 ASSERT(!has_osr_entry_); |
| 483 // Simply set a flag to find and process instruction later. | 468 // Simply set a flag to find and process instruction later. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 LChunk* chunk_; | 593 LChunk* chunk_; |
| 609 | 594 |
| 610 // During liveness analysis keep a mapping from block id to live_in sets | 595 // During liveness analysis keep a mapping from block id to live_in sets |
| 611 // for blocks already analyzed. | 596 // for blocks already analyzed. |
| 612 ZoneList<BitVector*> live_in_sets_; | 597 ZoneList<BitVector*> live_in_sets_; |
| 613 | 598 |
| 614 // Liveness analysis results. | 599 // Liveness analysis results. |
| 615 ZoneList<LiveRange*> live_ranges_; | 600 ZoneList<LiveRange*> live_ranges_; |
| 616 | 601 |
| 617 // Lists of live ranges | 602 // Lists of live ranges |
| 618 ZoneList<LiveRange*> fixed_live_ranges_; | 603 EmbeddedVector<LiveRange*, Register::kNumAllocatableRegisters> |
| 619 ZoneList<LiveRange*> fixed_double_live_ranges_; | 604 fixed_live_ranges_; |
| 605 EmbeddedVector<LiveRange*, DoubleRegister::kNumAllocatableRegisters> |
| 606 fixed_double_live_ranges_; |
| 620 ZoneList<LiveRange*> unhandled_live_ranges_; | 607 ZoneList<LiveRange*> unhandled_live_ranges_; |
| 621 ZoneList<LiveRange*> active_live_ranges_; | 608 ZoneList<LiveRange*> active_live_ranges_; |
| 622 ZoneList<LiveRange*> inactive_live_ranges_; | 609 ZoneList<LiveRange*> inactive_live_ranges_; |
| 623 ZoneList<LiveRange*> reusable_slots_; | 610 ZoneList<LiveRange*> reusable_slots_; |
| 624 | 611 |
| 625 // Next virtual register number to be assigned to temporaries. | 612 // Next virtual register number to be assigned to temporaries. |
| 626 int next_virtual_register_; | 613 int next_virtual_register_; |
| 627 int first_artificial_register_; | 614 int first_artificial_register_; |
| 628 GrowableBitVector double_artificial_registers_; | 615 GrowableBitVector double_artificial_registers_; |
| 629 | 616 |
| 630 RegisterKind mode_; | 617 RegisterKind mode_; |
| 631 int num_registers_; | 618 int num_registers_; |
| 632 | 619 |
| 633 HGraph* graph_; | 620 HGraph* graph_; |
| 634 | 621 |
| 635 bool has_osr_entry_; | 622 bool has_osr_entry_; |
| 636 | 623 |
| 637 DISALLOW_COPY_AND_ASSIGN(LAllocator); | 624 DISALLOW_COPY_AND_ASSIGN(LAllocator); |
| 638 }; | 625 }; |
| 639 | 626 |
| 640 | 627 |
| 641 } } // namespace v8::internal | 628 } } // namespace v8::internal |
| 642 | 629 |
| 643 #endif // V8_LITHIUM_ALLOCATOR_H_ | 630 #endif // V8_LITHIUM_ALLOCATOR_H_ |
| OLD | NEW |