Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/optimize.dart | 
| diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart | 
| index 28f0632fd1ad6a96d65176f166615ed9a5305a26..3672a9b135ef0aad3e12576af994aaba3d0e16d1 100644 | 
| --- a/pkg/compiler/lib/src/ssa/optimize.dart | 
| +++ b/pkg/compiler/lib/src/ssa/optimize.dart | 
| @@ -46,9 +46,9 @@ class SsaOptimizerTask extends CompilerTask { | 
| // After type propagation, more instructions can be | 
| // simplified. | 
| new SsaInstructionSimplifier(constantSystem, backend, work), | 
| - new SsaCheckInserter(backend, work, context.boundsChecked), | 
| + new SsaCheckInserter(compiler, backend, work, context.boundsChecked), | 
| new SsaInstructionSimplifier(constantSystem, backend, work), | 
| - new SsaCheckInserter(backend, work, context.boundsChecked), | 
| + new SsaCheckInserter(compiler, backend, work, context.boundsChecked), | 
| new SsaTypePropagator(compiler), | 
| // Run a dead code eliminator before LICM because dead | 
| // interceptors are often in the way of LICM'able instructions. | 
| @@ -65,7 +65,7 @@ class SsaOptimizerTask extends CompilerTask { | 
| // Previous optimizations may have generated new | 
| // opportunities for instruction simplification. | 
| new SsaInstructionSimplifier(constantSystem, backend, work), | 
| - new SsaCheckInserter(backend, work, context.boundsChecked), | 
| + new SsaCheckInserter(compiler, backend, work, context.boundsChecked), | 
| new SsaSimplifyInterceptors(compiler, constantSystem, work), | 
| dce = new SsaDeadCodeEliminator(compiler), | 
| new SsaTypePropagator(compiler)]; | 
| @@ -76,7 +76,8 @@ class SsaOptimizerTask extends CompilerTask { | 
| new SsaCodeMotion(), | 
| new SsaValueRangeAnalyzer(compiler, constantSystem, work), | 
| new SsaInstructionSimplifier(constantSystem, backend, work), | 
| - new SsaCheckInserter(backend, work, context.boundsChecked), | 
| + new SsaCheckInserter( | 
| + compiler, backend, work, context.boundsChecked), | 
| new SsaSimplifyInterceptors(compiler, constantSystem, work), | 
| new SsaDeadCodeEliminator(compiler)]; | 
| } else { | 
| @@ -886,16 +887,24 @@ class SsaInstructionSimplifier extends HBaseVisitor | 
| class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase { | 
| final Set<HInstruction> boundsChecked; | 
| final CodegenWorkItem work; | 
| + final Compiler compiler; | 
| final JavaScriptBackend backend; | 
| final String name = "SsaCheckInserter"; | 
| HGraph graph; | 
| - SsaCheckInserter(this.backend, | 
| + SsaCheckInserter(this.compiler, | 
| + this.backend, | 
| this.work, | 
| this.boundsChecked); | 
| void visitGraph(HGraph graph) { | 
| this.graph = graph; | 
| + | 
| + // In --trust-primitives mode we don't add bounds checks. This is better | 
| + // than trying to remove them later as the limit expression would become | 
| + // dead and require DCE. | 
| + if (compiler.trustPrimitives) return; | 
| 
 
floitsch
2014/11/11 10:02:04
Ok for this CL, but in the future (i.e. the CPS IR
 
sra1
2014/11/12 02:27:37
I passed the bool.
 
 | 
| + | 
| visitDominatorTree(graph); | 
| } |