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

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

Issue 6065010: Remember required register kind when creating artificial virtual register. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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
« src/lithium-allocator.h ('K') | « src/lithium-allocator.h ('k') | no next file » | 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 #include "lithium-allocator.h" 28 #include "lithium-allocator.h"
29 29
30 #include "data-flow.h"
31 #include "hydrogen.h" 30 #include "hydrogen.h"
32 #include "string-stream.h" 31 #include "string-stream.h"
33 32
34 #if V8_TARGET_ARCH_IA32 33 #if V8_TARGET_ARCH_IA32
35 #include "ia32/lithium-ia32.h" 34 #include "ia32/lithium-ia32.h"
36 #elif V8_TARGET_ARCH_X64 35 #elif V8_TARGET_ARCH_X64
37 #include "x64/lithium-x64.h" 36 #include "x64/lithium-x64.h"
38 #elif V8_TARGET_ARCH_ARM 37 #elif V8_TARGET_ARCH_ARM
39 #include "arm/lithium-arm.h" 38 #include "arm/lithium-arm.h"
40 #else 39 #else
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return; 755 return;
757 } 756 }
758 } 757 }
759 } 758 }
760 } 759 }
761 move->AddMove(from, to); 760 move->AddMove(from, to);
762 } 761 }
763 762
764 763
765 void LAllocator::MeetRegisterConstraints(HBasicBlock* block) { 764 void LAllocator::MeetRegisterConstraints(HBasicBlock* block) {
765 first_artificial_register_ = next_virtual_register_;
766 int start = block->first_instruction_index(); 766 int start = block->first_instruction_index();
767 int end = block->last_instruction_index(); 767 int end = block->last_instruction_index();
768 for (int i = start; i <= end; ++i) { 768 for (int i = start; i <= end; ++i) {
769 if (chunk_->IsGapAt(i)) { 769 if (chunk_->IsGapAt(i)) {
770 InstructionSummary* summary = NULL; 770 InstructionSummary* summary = NULL;
771 InstructionSummary* prev_summary = NULL; 771 InstructionSummary* prev_summary = NULL;
772 if (i < end) summary = GetSummary(i + 1); 772 if (i < end) summary = GetSummary(i + 1);
773 if (i > start) prev_summary = GetSummary(i - 1); 773 if (i > start) prev_summary = GetSummary(i - 1);
774 MeetConstraintsBetween(prev_summary, summary, i); 774 MeetConstraintsBetween(prev_summary, summary, i);
775 } 775 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 for (int i = 0; i < second->InputCount(); ++i) { 827 for (int i = 0; i < second->InputCount(); ++i) {
828 LUnallocated* cur_input = LUnallocated::cast(second->InputAt(i)); 828 LUnallocated* cur_input = LUnallocated::cast(second->InputAt(i));
829 if (cur_input->HasFixedPolicy()) { 829 if (cur_input->HasFixedPolicy()) {
830 LUnallocated* input_copy = cur_input->CopyUnconstrained(); 830 LUnallocated* input_copy = cur_input->CopyUnconstrained();
831 bool is_tagged = HasTaggedValue(cur_input->VirtualRegister()); 831 bool is_tagged = HasTaggedValue(cur_input->VirtualRegister());
832 AllocateFixed(cur_input, gap_index + 1, is_tagged); 832 AllocateFixed(cur_input, gap_index + 1, is_tagged);
833 AddConstraintsGapMove(gap_index, input_copy, cur_input); 833 AddConstraintsGapMove(gap_index, input_copy, cur_input);
834 } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) { 834 } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) {
835 LUnallocated* input_copy = cur_input->CopyUnconstrained(); 835 LUnallocated* input_copy = cur_input->CopyUnconstrained();
836 cur_input->set_virtual_register(next_virtual_register_++); 836 cur_input->set_virtual_register(next_virtual_register_++);
837
838 if (RequiredRegisterKind(input_copy->virtual_register()) ==
839 DOUBLE_REGISTERS) {
840 double_artificial_registers_.Add(
841 cur_input->virtual_register() - first_artificial_register_);
842 }
843
837 second->AddTemp(cur_input); 844 second->AddTemp(cur_input);
838 AddConstraintsGapMove(gap_index, input_copy, cur_input); 845 AddConstraintsGapMove(gap_index, input_copy, cur_input);
839 } 846 }
840 } 847 }
841 } 848 }
842 849
843 // Handle "output same as input" for second instruction. 850 // Handle "output same as input" for second instruction.
844 if (second != NULL && second->Output() != NULL) { 851 if (second != NULL && second->Output() != NULL) {
845 LUnallocated* second_output = LUnallocated::cast(second->Output()); 852 LUnallocated* second_output = LUnallocated::cast(second->Output());
846 if (second_output->HasSameAsInputPolicy()) { 853 if (second_output->HasSameAsInputPolicy()) {
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 1564
1558 1565
1559 bool LAllocator::HasTaggedValue(int virtual_register) const { 1566 bool LAllocator::HasTaggedValue(int virtual_register) const {
1560 HValue* value = graph()->LookupValue(virtual_register); 1567 HValue* value = graph()->LookupValue(virtual_register);
1561 if (value == NULL) return false; 1568 if (value == NULL) return false;
1562 return value->representation().IsTagged(); 1569 return value->representation().IsTagged();
1563 } 1570 }
1564 1571
1565 1572
1566 RegisterKind LAllocator::RequiredRegisterKind(int virtual_register) const { 1573 RegisterKind LAllocator::RequiredRegisterKind(int virtual_register) const {
1567 HValue* value = graph()->LookupValue(virtual_register); 1574 if (virtual_register < first_artificial_register_) {
1568 if (value != NULL && value->representation().IsDouble()) { 1575 HValue* value = graph()->LookupValue(virtual_register);
1576 if (value != NULL && value->representation().IsDouble()) {
1577 return DOUBLE_REGISTERS;
1578 }
1579 } else if (double_artificial_registers_.Contains(
1580 virtual_register - first_artificial_register_)) {
1569 return DOUBLE_REGISTERS; 1581 return DOUBLE_REGISTERS;
1570 } 1582 }
1583
1571 return GENERAL_REGISTERS; 1584 return GENERAL_REGISTERS;
1572 } 1585 }
1573 1586
1574 1587
1575 void LAllocator::MarkAsCall() { 1588 void LAllocator::MarkAsCall() {
1576 current_summary()->MarkAsCall(); 1589 current_summary()->MarkAsCall();
1577 } 1590 }
1578 1591
1579 1592
1580 void LAllocator::RecordDefinition(HInstruction* instr, LUnallocated* operand) { 1593 void LAllocator::RecordDefinition(HInstruction* instr, LUnallocated* operand) {
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 LiveRange* current = live_ranges()->at(i); 2120 LiveRange* current = live_ranges()->at(i);
2108 if (current != NULL) current->Verify(); 2121 if (current != NULL) current->Verify();
2109 } 2122 }
2110 } 2123 }
2111 2124
2112 2125
2113 #endif 2126 #endif
2114 2127
2115 2128
2116 } } // namespace v8::internal 2129 } } // namespace v8::internal
OLDNEW
« src/lithium-allocator.h ('K') | « src/lithium-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698