| Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 21808)
|
| +++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
|
| @@ -73,15 +73,24 @@
|
| }
|
| JavaScriptItemCompilationContext context = work.compilationContext;
|
| return measure(() {
|
| + SsaTypeGuardInserter inserter = new SsaTypeGuardInserter(compiler, work);
|
| +
|
| // Run the phases that will generate type guards.
|
| List<OptimizationPhase> phases = <OptimizationPhase>[
|
| - new SsaTypeGuardInserter(compiler, work),
|
| + inserter,
|
| new SsaEnvironmentBuilder(compiler),
|
| // Then run the [SsaCheckInserter] because the type propagator also
|
| // propagated types non-speculatively. For example, it might have
|
| // propagated the type array for a call to the List constructor.
|
| new SsaCheckInserter(backend, work, context.boundsChecked)];
|
| runPhases(graph, phases);
|
| +
|
| + if (work.guards.isEmpty && inserter.hasInsertedChecks) {
|
| + // If there is no guard, and we have inserted type checks
|
| + // instead, we can do the optimizations right away and avoid
|
| + // the bailout method.
|
| + optimize(work, graph, false);
|
| + }
|
| return !work.guards.isEmpty;
|
| });
|
| }
|
|
|