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

Side by Side Diff: lib/compiler/implementation/ssa/bailout.dart

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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
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 class BailoutInfo { 5 class BailoutInfo {
6 int instructionId; 6 int instructionId;
7 int bailoutId; 7 int bailoutId;
8 BailoutInfo(this.instructionId, this.bailoutId); 8 BailoutInfo(this.instructionId, this.bailoutId);
9 } 9 }
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void removeLoopMarker(HBasicBlock block) { 53 void removeLoopMarker(HBasicBlock block) {
54 loopMarkers.remove(block); 54 loopMarkers.remove(block);
55 } 55 }
56 56
57 void addAll(Environment other) { 57 void addAll(Environment other) {
58 lives.addAll(other.lives); 58 lives.addAll(other.lives);
59 loopMarkers.addAll(other.loopMarkers); 59 loopMarkers.addAll(other.loopMarkers);
60 } 60 }
61 61
62 bool isEmpty() => lives.isEmpty() && loopMarkers.isEmpty(); 62 bool get isEmpty => lives.isEmpty && loopMarkers.isEmpty;
63 } 63 }
64 64
65 65
66 /** 66 /**
67 * Visits the graph in dominator order and inserts TypeGuards in places where 67 * Visits the graph in dominator order and inserts TypeGuards in places where
68 * we consider the guard to be of value. 68 * we consider the guard to be of value.
69 * 69 *
70 * Might modify the [types] in an inconsistent way. No further analysis should 70 * Might modify the [types] in an inconsistent way. No further analysis should
71 * rely on them. 71 * rely on them.
72 */ 72 */
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 final Map<HBasicBlock, Environment> liveInstructions; 256 final Map<HBasicBlock, Environment> liveInstructions;
257 Environment environment; 257 Environment environment;
258 258
259 SsaEnvironmentBuilder(Compiler this.compiler) 259 SsaEnvironmentBuilder(Compiler this.compiler)
260 : capturedEnvironments = new Map<HBailoutTarget, Environment>(), 260 : capturedEnvironments = new Map<HBailoutTarget, Environment>(),
261 liveInstructions = new Map<HBasicBlock, Environment>(); 261 liveInstructions = new Map<HBasicBlock, Environment>();
262 262
263 263
264 void visitGraph(HGraph graph) { 264 void visitGraph(HGraph graph) {
265 visitPostDominatorTree(graph); 265 visitPostDominatorTree(graph);
266 if (!liveInstructions[graph.entry].isEmpty()) { 266 if (!liveInstructions[graph.entry].isEmpty) {
267 compiler.internalError('Bailout environment computation', 267 compiler.internalError('Bailout environment computation',
268 node: compiler.currentElement.parseNode(compiler)); 268 node: compiler.currentElement.parseNode(compiler));
269 } 269 }
270 updateLoopMarkers(); 270 updateLoopMarkers();
271 insertCapturedEnvironments(); 271 insertCapturedEnvironments();
272 } 272 }
273 273
274 void updateLoopMarkers() { 274 void updateLoopMarkers() {
275 // If the block is a loop header, we need to merge the loop 275 // If the block is a loop header, we need to merge the loop
276 // header's live instructions into every environment that contains 276 // header's live instructions into every environment that contains
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 * version. 410 * version.
411 */ 411 */
412 412
413 SsaBailoutPropagator(this.compiler, this.generateAtUseSite) 413 SsaBailoutPropagator(this.compiler, this.generateAtUseSite)
414 : blocks = <HBasicBlock>[], 414 : blocks = <HBasicBlock>[],
415 labeledBlockInformations = <HLabeledBlockInformation>[]; 415 labeledBlockInformations = <HLabeledBlockInformation>[];
416 416
417 void visitGraph(HGraph graph) { 417 void visitGraph(HGraph graph) {
418 subGraph = new SubGraph(graph.entry, graph.exit); 418 subGraph = new SubGraph(graph.entry, graph.exit);
419 visitBasicBlock(graph.entry); 419 visitBasicBlock(graph.entry);
420 if (!blocks.isEmpty()) { 420 if (!blocks.isEmpty) {
421 compiler.internalError('Bailout propagation', 421 compiler.internalError('Bailout propagation',
422 node: compiler.currentElement.parseNode(compiler)); 422 node: compiler.currentElement.parseNode(compiler));
423 } 423 }
424 } 424 }
425 425
426 void visitBasicBlock(HBasicBlock block) { 426 void visitBasicBlock(HBasicBlock block) {
427 // Abort traversal if we are leaving the currently active sub-graph. 427 // Abort traversal if we are leaving the currently active sub-graph.
428 if (!subGraph.contains(block)) return; 428 if (!subGraph.contains(block)) return;
429 429
430 if (block.isLoopHeader()) { 430 if (block.isLoopHeader()) {
431 blocks.addLast(block); 431 blocks.addLast(block);
432 } else if (block.isLabeledBlock() 432 } else if (block.isLabeledBlock()
433 && (blocks.isEmpty() || !identical(blocks.last(), block))) { 433 && (blocks.isEmpty || !identical(blocks.last(), block))) {
434 HLabeledBlockInformation info = block.blockFlow.body; 434 HLabeledBlockInformation info = block.blockFlow.body;
435 visitStatements(info.body); 435 visitStatements(info.body);
436 return; 436 return;
437 } 437 }
438 438
439 HInstruction instruction = block.first; 439 HInstruction instruction = block.first;
440 while (instruction != null) { 440 while (instruction != null) {
441 instruction.accept(this); 441 instruction.accept(this);
442 instruction = instruction.next; 442 instruction = instruction.next;
443 } 443 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 visitBasicBlock(dominated[i]); 523 visitBasicBlock(dominated[i]);
524 } 524 }
525 } 525 }
526 } 526 }
527 527
528 visitBailoutTarget(HBailoutTarget target) { 528 visitBailoutTarget(HBailoutTarget target) {
529 int inputLength = target.inputs.length; 529 int inputLength = target.inputs.length;
530 if (inputLength > maxBailoutParameters) { 530 if (inputLength > maxBailoutParameters) {
531 maxBailoutParameters = inputLength; 531 maxBailoutParameters = inputLength;
532 } 532 }
533 if (blocks.isEmpty()) { 533 if (blocks.isEmpty) {
534 if (firstBailoutTarget == null) { 534 if (firstBailoutTarget == null) {
535 firstBailoutTarget = target; 535 firstBailoutTarget = target;
536 } else { 536 } else {
537 hasComplexBailoutTargets = true; 537 hasComplexBailoutTargets = true;
538 } 538 }
539 } else { 539 } else {
540 hasComplexBailoutTargets = true; 540 hasComplexBailoutTargets = true;
541 blocks.forEach((HBasicBlock block) { 541 blocks.forEach((HBasicBlock block) {
542 block.bailoutTargets.add(target); 542 block.bailoutTargets.add(target);
543 }); 543 });
544 } 544 }
545 } 545 }
546 } 546 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/token.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698