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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 | 2022 |
2023 LifetimePosition LAllocator::FindOptimalSplitPos(LifetimePosition start, | 2023 LifetimePosition LAllocator::FindOptimalSplitPos(LifetimePosition start, |
2024 LifetimePosition end) { | 2024 LifetimePosition end) { |
2025 int start_instr = start.InstructionIndex(); | 2025 int start_instr = start.InstructionIndex(); |
2026 int end_instr = end.InstructionIndex(); | 2026 int end_instr = end.InstructionIndex(); |
2027 ASSERT(start_instr <= end_instr); | 2027 ASSERT(start_instr <= end_instr); |
2028 | 2028 |
2029 // We have no choice | 2029 // We have no choice |
2030 if (start_instr == end_instr) return end; | 2030 if (start_instr == end_instr) return end; |
2031 | 2031 |
2032 HBasicBlock* end_block = GetBlock(start); | 2032 HBasicBlock* start_block = GetBlock(start); |
2033 HBasicBlock* start_block = GetBlock(end); | 2033 HBasicBlock* end_block = GetBlock(end); |
2034 | 2034 |
2035 if (end_block == start_block) { | 2035 if (end_block == start_block) { |
2036 // The interval is split in the same basic block. Split at latest possible | 2036 // The interval is split in the same basic block. Split at the latest |
2037 // position. | 2037 // possible position. |
2038 return end; | 2038 return end; |
2039 } | 2039 } |
2040 | 2040 |
2041 HBasicBlock* block = end_block; | 2041 HBasicBlock* block = end_block; |
2042 // Find header of outermost loop. | 2042 // Find header of outermost loop. |
2043 while (block->parent_loop_header() != NULL && | 2043 while (block->parent_loop_header() != NULL && |
2044 block->parent_loop_header()->block_id() > start_block->block_id()) { | 2044 block->parent_loop_header()->block_id() > start_block->block_id()) { |
2045 block = block->parent_loop_header(); | 2045 block = block->parent_loop_header(); |
2046 } | 2046 } |
2047 | 2047 |
2048 if (block == end_block) return end; | 2048 // We did not find any suitable outer loop. Split at the latest possible |
| 2049 // position unless end_block is a loop header itself. |
| 2050 if (block == end_block && !end_block->IsLoopHeader()) return end; |
2049 | 2051 |
2050 return LifetimePosition::FromInstructionIndex( | 2052 return LifetimePosition::FromInstructionIndex( |
2051 block->first_instruction_index()); | 2053 block->first_instruction_index()); |
2052 } | 2054 } |
2053 | 2055 |
2054 | 2056 |
2055 void LAllocator::SpillAfter(LiveRange* range, LifetimePosition pos) { | 2057 void LAllocator::SpillAfter(LiveRange* range, LifetimePosition pos) { |
2056 LiveRange* second_part = SplitAt(range, pos); | 2058 LiveRange* second_part = SplitAt(range, pos); |
2057 Spill(second_part); | 2059 Spill(second_part); |
2058 } | 2060 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 LiveRange* current = live_ranges()->at(i); | 2114 LiveRange* current = live_ranges()->at(i); |
2113 if (current != NULL) current->Verify(); | 2115 if (current != NULL) current->Verify(); |
2114 } | 2116 } |
2115 } | 2117 } |
2116 | 2118 |
2117 | 2119 |
2118 #endif | 2120 #endif |
2119 | 2121 |
2120 | 2122 |
2121 } } // namespace v8::internal | 2123 } } // namespace v8::internal |
OLD | NEW |