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

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

Issue 11437015: When spilling live range with not register uses inside the loop try to move spilling out of the loo… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 | « 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 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 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 1938
1939 void LAllocator::SplitAndSpillIntersecting(LiveRange* current) { 1939 void LAllocator::SplitAndSpillIntersecting(LiveRange* current) {
1940 ASSERT(current->HasRegisterAssigned()); 1940 ASSERT(current->HasRegisterAssigned());
1941 int reg = current->assigned_register(); 1941 int reg = current->assigned_register();
1942 LifetimePosition split_pos = current->Start(); 1942 LifetimePosition split_pos = current->Start();
1943 for (int i = 0; i < active_live_ranges_.length(); ++i) { 1943 for (int i = 0; i < active_live_ranges_.length(); ++i) {
1944 LiveRange* range = active_live_ranges_[i]; 1944 LiveRange* range = active_live_ranges_[i];
1945 if (range->assigned_register() == reg) { 1945 if (range->assigned_register() == reg) {
1946 UsePosition* next_pos = range->NextRegisterPosition(current->Start()); 1946 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1947 if (next_pos == NULL) { 1947 if (next_pos == NULL) {
1948 HBasicBlock* block = GetBlock(current->Start().InstructionStart());
1949 HBasicBlock* loop_header =
1950 block->IsLoopHeader() ? block : block->parent_loop_header();
1951 if (loop_header != NULL) {
danno 2013/01/02 17:35:14 Don't you want a loop here? If there are nested lo
Vyacheslav Egorov (Google) 2013/01/07 06:42:25 I just wanted to keep this code simple. I will add
1952 // We are going to spill live range inside the loop.
1953 // If possible try to move spilling position backwards to loop header.
1954 // This will reduce number of memory moves on the back edge.
1955 LifetimePosition pos = LifetimePosition::FromInstructionIndex(
1956 loop_header->first_instruction_index());
danno 2013/01/02 17:35:14 Don't you want last_instruction_index() in case th
Vyacheslav Egorov (Google) 2013/01/07 06:42:25 Not sure I understand. If I make it last_instructi
danno 2013/01/08 12:39:22 Maybe I'm just confused. My thought was that you w
1957 if (range->Covers(pos)) {
1958 range->ResetLastProcessedUse();
1959 if (range->NextUsePositionRegisterIsBeneficial(pos) == NULL) {
1960 // No register beneficial use since loop's start.
1961 // Move split position backwards.
1962 split_pos = pos;
danno 2013/01/02 17:35:14 Since split_pos, can be different for every live r
Vyacheslav Egorov (Google) 2013/01/07 06:42:25 Good catch. I misread where split_pos is defined.
1963 }
1964 }
1965 }
1948 SpillAfter(range, split_pos); 1966 SpillAfter(range, split_pos);
1949 } else { 1967 } else {
1950 SpillBetween(range, split_pos, next_pos->pos()); 1968 SpillBetween(range, split_pos, next_pos->pos());
danno 2013/01/02 17:35:14 Why doesn't your logic to hoist spills no also app
Vyacheslav Egorov (Google) 2013/01/07 06:42:25 It can be applied here. I just did not want to app
1951 } 1969 }
1952 ActiveToHandled(range); 1970 ActiveToHandled(range);
1953 --i; 1971 --i;
1954 } 1972 }
1955 } 1973 }
1956 1974
1957 for (int i = 0; i < inactive_live_ranges_.length(); ++i) { 1975 for (int i = 0; i < inactive_live_ranges_.length(); ++i) {
1958 LiveRange* range = inactive_live_ranges_[i]; 1976 LiveRange* range = inactive_live_ranges_[i];
1959 ASSERT(range->End().Value() > current->Start().Value()); 1977 ASSERT(range->End().Value() > current->Start().Value());
1960 if (range->assigned_register() == reg && !range->IsFixed()) { 1978 if (range->assigned_register() == reg && !range->IsFixed()) {
1961 LifetimePosition next_intersection = range->FirstIntersection(current); 1979 LifetimePosition next_intersection = range->FirstIntersection(current);
1962 if (next_intersection.IsValid()) { 1980 if (next_intersection.IsValid()) {
1963 UsePosition* next_pos = range->NextRegisterPosition(current->Start()); 1981 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1964 if (next_pos == NULL) { 1982 if (next_pos == NULL) {
1965 SpillAfter(range, split_pos); 1983 SpillAfter(range, split_pos);
danno 2013/01/02 17:35:14 Same applies here, doesn't it, or am I confused? E
Vyacheslav Egorov (Google) 2013/01/07 06:42:25 I don't think it applies here (or below): the loop
danno 2013/01/08 12:39:22 Ah, I see. Got it. On 2013/01/07 06:42:25, Vyache
1966 } else { 1984 } else {
1967 next_intersection = Min(next_intersection, next_pos->pos()); 1985 next_intersection = Min(next_intersection, next_pos->pos());
1968 SpillBetween(range, split_pos, next_intersection); 1986 SpillBetween(range, split_pos, next_intersection);
danno 2013/01/02 17:35:14 And here, too?
1969 } 1987 }
1970 InactiveToHandled(range); 1988 InactiveToHandled(range);
1971 --i; 1989 --i;
1972 } 1990 }
1973 } 1991 }
1974 } 1992 }
1975 } 1993 }
1976 1994
1977 1995
1978 bool LAllocator::IsBlockBoundary(LifetimePosition pos) { 1996 bool LAllocator::IsBlockBoundary(LifetimePosition pos) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 LiveRange* current = live_ranges()->at(i); 2128 LiveRange* current = live_ranges()->at(i);
2111 if (current != NULL) current->Verify(); 2129 if (current != NULL) current->Verify();
2112 } 2130 }
2113 } 2131 }
2114 2132
2115 2133
2116 #endif 2134 #endif
2117 2135
2118 2136
2119 } } // namespace v8::internal 2137 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lithium-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698