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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // There can be only one. | 438 // There can be only one. |
439 ASSERT(!has_osr_entry_); | 439 ASSERT(!has_osr_entry_); |
440 // Simply set a flag to find and process instruction later. | 440 // Simply set a flag to find and process instruction later. |
441 has_osr_entry_ = true; | 441 has_osr_entry_ = true; |
442 } | 442 } |
443 | 443 |
444 #ifdef DEBUG | 444 #ifdef DEBUG |
445 void Verify() const; | 445 void Verify() const; |
446 #endif | 446 #endif |
447 | 447 |
| 448 BitVector* assigned_registers() { |
| 449 return assigned_registers_; |
| 450 } |
| 451 BitVector* assigned_double_registers() { |
| 452 return assigned_double_registers_; |
| 453 } |
| 454 |
448 private: | 455 private: |
449 void MeetRegisterConstraints(); | 456 void MeetRegisterConstraints(); |
450 void ResolvePhis(); | 457 void ResolvePhis(); |
451 void BuildLiveRanges(); | 458 void BuildLiveRanges(); |
452 void AllocateGeneralRegisters(); | 459 void AllocateGeneralRegisters(); |
453 void AllocateDoubleRegisters(); | 460 void AllocateDoubleRegisters(); |
454 void ConnectRanges(); | 461 void ConnectRanges(); |
455 void ResolveControlFlow(); | 462 void ResolveControlFlow(); |
456 void PopulatePointerMaps(); | 463 void PopulatePointerMaps(); |
457 void ProcessOsrEntry(); | 464 void ProcessOsrEntry(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 void SplitAndSpillIntersecting(LiveRange* range); | 537 void SplitAndSpillIntersecting(LiveRange* range); |
531 | 538 |
532 void Spill(LiveRange* range); | 539 void Spill(LiveRange* range); |
533 bool IsBlockBoundary(LifetimePosition pos); | 540 bool IsBlockBoundary(LifetimePosition pos); |
534 | 541 |
535 // Helper methods for resolving control flow. | 542 // Helper methods for resolving control flow. |
536 void ResolveControlFlow(LiveRange* range, | 543 void ResolveControlFlow(LiveRange* range, |
537 HBasicBlock* block, | 544 HBasicBlock* block, |
538 HBasicBlock* pred); | 545 HBasicBlock* pred); |
539 | 546 |
| 547 inline void SetLiveRangeAssignedRegister(LiveRange* range, |
| 548 int reg, |
| 549 RegisterKind register_kind, |
| 550 Zone* zone); |
| 551 |
540 // Return parallel move that should be used to connect ranges split at the | 552 // Return parallel move that should be used to connect ranges split at the |
541 // given position. | 553 // given position. |
542 LParallelMove* GetConnectingParallelMove(LifetimePosition pos); | 554 LParallelMove* GetConnectingParallelMove(LifetimePosition pos); |
543 | 555 |
544 // Return the block which contains give lifetime position. | 556 // Return the block which contains give lifetime position. |
545 HBasicBlock* GetBlock(LifetimePosition pos); | 557 HBasicBlock* GetBlock(LifetimePosition pos); |
546 | 558 |
547 // Helper methods for the fixed registers. | 559 // Helper methods for the fixed registers. |
548 int RegisterCount() const; | 560 int RegisterCount() const; |
549 static int FixedLiveRangeID(int index) { return -index - 1; } | 561 static int FixedLiveRangeID(int index) { return -index - 1; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 ZoneList<LiveRange*> reusable_slots_; | 596 ZoneList<LiveRange*> reusable_slots_; |
585 | 597 |
586 // Next virtual register number to be assigned to temporaries. | 598 // Next virtual register number to be assigned to temporaries. |
587 int next_virtual_register_; | 599 int next_virtual_register_; |
588 int first_artificial_register_; | 600 int first_artificial_register_; |
589 GrowableBitVector double_artificial_registers_; | 601 GrowableBitVector double_artificial_registers_; |
590 | 602 |
591 RegisterKind mode_; | 603 RegisterKind mode_; |
592 int num_registers_; | 604 int num_registers_; |
593 | 605 |
| 606 BitVector* assigned_registers_; |
| 607 BitVector* assigned_double_registers_; |
| 608 |
594 HGraph* graph_; | 609 HGraph* graph_; |
595 | 610 |
596 bool has_osr_entry_; | 611 bool has_osr_entry_; |
597 | 612 |
598 // Indicates success or failure during register allocation. | 613 // Indicates success or failure during register allocation. |
599 bool allocation_ok_; | 614 bool allocation_ok_; |
600 | 615 |
601 DISALLOW_COPY_AND_ASSIGN(LAllocator); | 616 DISALLOW_COPY_AND_ASSIGN(LAllocator); |
602 }; | 617 }; |
603 | 618 |
604 | 619 |
605 } } // namespace v8::internal | 620 } } // namespace v8::internal |
606 | 621 |
607 #endif // V8_LITHIUM_ALLOCATOR_H_ | 622 #endif // V8_LITHIUM_ALLOCATOR_H_ |
OLD | NEW |