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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart

Issue 14487008: When a phi is generated at use site, the names of its inputs must be freed by the user of the phi. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | tests/language/issue10204_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * The [LiveRange] class covers a range where an instruction is live. 8 * The [LiveRange] class covers a range where an instruction is live.
9 */ 9 */
10 class LiveRange { 10 class LiveRange {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 HInstruction unwrap(instruction) { 225 HInstruction unwrap(instruction) {
226 do { 226 do {
227 instruction = instruction.checkedInput; 227 instruction = instruction.checkedInput;
228 } while (instruction is HCheck); 228 } while (instruction is HCheck);
229 return instruction; 229 return instruction;
230 } 230 }
231 231
232 void markAsLiveInEnvironment(HInstruction instruction, 232 void markAsLiveInEnvironment(HInstruction instruction,
233 LiveEnvironment environment) { 233 LiveEnvironment environment) {
234 // The inputs of a [HPhi] are being handled at the entry of a 234 if (generateAtUseSite.contains(instruction)) {
235 // block.
236 if (generateAtUseSite.contains(instruction) && instruction is !HPhi) {
237 markInputsAsLiveInEnvironment(instruction, environment); 235 markInputsAsLiveInEnvironment(instruction, environment);
238 } else { 236 } else {
239 environment.add(instruction, instructionId); 237 environment.add(instruction, instructionId);
240 // Special case the HCheck instruction to mark the actual 238 // Special case the HCheck instruction to mark the actual
241 // checked instruction live. The checked instruction and the 239 // checked instruction live. The checked instruction and the
242 // [HCheck] will share the same live ranges. 240 // [HCheck] will share the same live ranges.
243 if (instruction is HCheck) { 241 if (instruction is HCheck) {
244 HInstruction checked = unwrap(instruction); 242 HInstruction checked = unwrap(instruction);
245 if (!generateAtUseSite.contains(checked)) { 243 if (!generateAtUseSite.contains(checked)) {
246 environment.add(checked, instructionId); 244 environment.add(checked, instructionId);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 removeFromEnvironment(instruction, environment); 293 removeFromEnvironment(instruction, environment);
296 markInputsAsLiveInEnvironment(instruction, environment); 294 markInputsAsLiveInEnvironment(instruction, environment);
297 } 295 }
298 instructionId--; 296 instructionId--;
299 instruction = instruction.previous; 297 instruction = instruction.previous;
300 } 298 }
301 299
302 // We just remove the phis from the environment. The inputs of the 300 // We just remove the phis from the environment. The inputs of the
303 // phis will be put in the environment of the predecessors. 301 // phis will be put in the environment of the predecessors.
304 for (HPhi phi = block.phis.first; phi != null; phi = phi.next) { 302 for (HPhi phi = block.phis.first; phi != null; phi = phi.next) {
305 environment.remove(phi, instructionId); 303 if (!generateAtUseSite.contains(phi)) {
304 environment.remove(phi, instructionId);
305 }
306 } 306 }
307 307
308 // Save the liveInstructions of that block. 308 // Save the liveInstructions of that block.
309 environment.startId = instructionId + 1; 309 environment.startId = instructionId + 1;
310 liveInstructions[block] = environment; 310 liveInstructions[block] = environment;
311 311
312 // If the block is a loop header, we can remove the loop marker, 312 // If the block is a loop header, we can remove the loop marker,
313 // because it will just recompute the loop phis. 313 // because it will just recompute the loop phis.
314 // We also check if this loop header has any back edges. If not, 314 // We also check if this loop header has any back edges. If not,
315 // we know there is no loop marker for it. 315 // we know there is no loop marker for it.
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 if (!needsName(input)) { 692 if (!needsName(input)) {
693 names.addAssignment(predecessor, input, phi); 693 names.addAssignment(predecessor, input, phi);
694 } else { 694 } else {
695 names.addCopy(predecessor, input, phi); 695 names.addCopy(predecessor, input, phi);
696 } 696 }
697 } 697 }
698 698
699 namer.allocateName(phi); 699 namer.allocateName(phi);
700 } 700 }
701 } 701 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/issue10204_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698