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

Side by Side Diff: pkg/compiler/lib/src/ssa/value_range_analyzer.dart

Issue 716823002: Set up a stub pipline for using the new cps-based ir to generate js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move IrEnabled to compiler Created 6 years, 1 month 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 | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/tracer.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 class ValueRangeInfo { 8 class ValueRangeInfo {
9 final ConstantSystem constantSystem; 9 final ConstantSystem constantSystem;
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 588
589 /** 589 /**
590 * Value ranges for integer instructions. This map gets populated by 590 * Value ranges for integer instructions. This map gets populated by
591 * the dominator tree visit. 591 * the dominator tree visit.
592 */ 592 */
593 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); 593 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>();
594 594
595 final Compiler compiler; 595 final Compiler compiler;
596 final ConstantSystem constantSystem; 596 final ConstantSystem constantSystem;
597 final ValueRangeInfo info; 597 final ValueRangeInfo info;
598 final SsaOptimizerTask optimizer;
598 599
599 CodegenWorkItem work; 600 CodegenWorkItem work;
600 HGraph graph; 601 HGraph graph;
601 602
602 SsaValueRangeAnalyzer(this.compiler, constantSystem, this.work) 603 SsaValueRangeAnalyzer(this.compiler,
604 constantSystem,
605 this.optimizer,
606 this.work)
603 : info = new ValueRangeInfo(constantSystem), 607 : info = new ValueRangeInfo(constantSystem),
604 this.constantSystem = constantSystem; 608 this.constantSystem = constantSystem;
605 609
606 void visitGraph(HGraph graph) { 610 void visitGraph(HGraph graph) {
607 this.graph = graph; 611 this.graph = graph;
608 visitDominatorTree(graph); 612 visitDominatorTree(graph);
609 // We remove the range conversions after visiting the graph so 613 // We remove the range conversions after visiting the graph so
610 // that the graph does not get polluted with these instructions 614 // that the graph does not get polluted with these instructions
611 // only necessary for this phase. 615 // only necessary for this phase.
612 removeRangeConversion(); 616 removeRangeConversion();
613 JavaScriptBackend backend = compiler.backend;
614 // TODO(herhut): Find a cleaner way to pass around ranges. 617 // TODO(herhut): Find a cleaner way to pass around ranges.
615 backend.optimizer.ranges = ranges; 618 optimizer.ranges = ranges;
616 } 619 }
617 620
618 void removeRangeConversion() { 621 void removeRangeConversion() {
619 conversions.forEach((HRangeConversion instruction) { 622 conversions.forEach((HRangeConversion instruction) {
620 instruction.block.rewrite(instruction, instruction.inputs[0]);; 623 instruction.block.rewrite(instruction, instruction.inputs[0]);
621 instruction.block.remove(instruction); 624 instruction.block.remove(instruction);
622 }); 625 });
623 } 626 }
624 627
625 void visitBasicBlock(HBasicBlock block) { 628 void visitBasicBlock(HBasicBlock block) {
626 629
627 void visit(HInstruction instruction) { 630 void visit(HInstruction instruction) {
628 Range range = instruction.accept(this); 631 Range range = instruction.accept(this);
629 if (instruction.isInteger(compiler)) { 632 if (instruction.isInteger(compiler)) {
630 assert(range != null); 633 assert(range != null);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 } 1069 }
1067 1070
1068 Range handleBinaryOperation(HBinaryArithmetic instruction) { 1071 Range handleBinaryOperation(HBinaryArithmetic instruction) {
1069 Range leftRange = visit(instruction.left); 1072 Range leftRange = visit(instruction.left);
1070 Range rightRange = visit(instruction.right); 1073 Range rightRange = visit(instruction.right);
1071 if (leftRange == null || rightRange == null) return null; 1074 if (leftRange == null || rightRange == null) return null;
1072 BinaryOperation operation = instruction.operation(info.constantSystem); 1075 BinaryOperation operation = instruction.operation(info.constantSystem);
1073 return operation.apply(leftRange, rightRange); 1076 return operation.apply(leftRange, rightRange);
1074 } 1077 }
1075 } 1078 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698