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

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

Issue 10377106: Fix LOperand aliasing bug in the register allocator, avoid splitting very short live ranges. Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 7 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 | « no previous file | 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 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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 cur_input->set_virtual_register(GetVirtualRegister()); 844 cur_input->set_virtual_register(GetVirtualRegister());
845 if (!AllocationOk()) return; 845 if (!AllocationOk()) return;
846 846
847 if (RequiredRegisterKind(input_copy->virtual_register()) == 847 if (RequiredRegisterKind(input_copy->virtual_register()) ==
848 DOUBLE_REGISTERS) { 848 DOUBLE_REGISTERS) {
849 double_artificial_registers_.Add( 849 double_artificial_registers_.Add(
850 cur_input->virtual_register() - first_artificial_register_, 850 cur_input->virtual_register() - first_artificial_register_,
851 zone_); 851 zone_);
852 } 852 }
853 853
854 AddConstraintsGapMove(gap_index, input_copy, cur_input); 854 LUnallocated* cur_input_copy = cur_input->CopyUnconstrained();
855 cur_input_copy->set_policy(cur_input->policy());
856
857 AddConstraintsGapMove(gap_index, input_copy, cur_input_copy);
855 } 858 }
856 } 859 }
857 } 860 }
858 861
859 // Handle "output same as input" for second instruction. 862 // Handle "output same as input" for second instruction.
860 if (second != NULL && second->Output() != NULL) { 863 if (second != NULL && second->Output() != NULL) {
861 LUnallocated* second_output = LUnallocated::cast(second->Output()); 864 LUnallocated* second_output = LUnallocated::cast(second->Output());
862 if (second_output->HasSameAsInputPolicy()) { 865 if (second_output->HasSameAsInputPolicy()) {
863 LUnallocated* cur_input = LUnallocated::cast(second->FirstInput()); 866 LUnallocated* cur_input = LUnallocated::cast(second->FirstInput());
864 int output_vreg = second_output->virtual_register(); 867 int output_vreg = second_output->virtual_register();
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 1847
1845 void LAllocator::AllocateBlockedReg(LiveRange* current) { 1848 void LAllocator::AllocateBlockedReg(LiveRange* current) {
1846 UsePosition* register_use = current->NextRegisterPosition(current->Start()); 1849 UsePosition* register_use = current->NextRegisterPosition(current->Start());
1847 if (register_use == NULL) { 1850 if (register_use == NULL) {
1848 // There is no use in the current live range that requires a register. 1851 // There is no use in the current live range that requires a register.
1849 // We can just spill it. 1852 // We can just spill it.
1850 Spill(current); 1853 Spill(current);
1851 return; 1854 return;
1852 } 1855 }
1853 1856
1854
1855 LifetimePosition use_pos[DoubleRegister::kNumAllocatableRegisters]; 1857 LifetimePosition use_pos[DoubleRegister::kNumAllocatableRegisters];
1856 LifetimePosition block_pos[DoubleRegister::kNumAllocatableRegisters]; 1858 LifetimePosition block_pos[DoubleRegister::kNumAllocatableRegisters];
1857 1859
1858 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) { 1860 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
1859 use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition(); 1861 use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
1860 } 1862 }
1861 1863
1862 for (int i = 0; i < active_live_ranges_.length(); ++i) { 1864 for (int i = 0; i < active_live_ranges_.length(); ++i) {
1863 LiveRange* range = active_live_ranges_[i]; 1865 LiveRange* range = active_live_ranges_[i];
1864 int cur_reg = range->assigned_register(); 1866 int cur_reg = range->assigned_register();
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 LiveRange* current = live_ranges()->at(i); 2111 LiveRange* current = live_ranges()->at(i);
2110 if (current != NULL) current->Verify(); 2112 if (current != NULL) current->Verify();
2111 } 2113 }
2112 } 2114 }
2113 2115
2114 2116
2115 #endif 2117 #endif
2116 2118
2117 2119
2118 } } // namespace v8::internal 2120 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698