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

Unified Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 703083002: --trust-primitives: Remove bounds checks and receiver and argument type checks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen_helpers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..43300de10847e01f9f77fbdcec0b598ad766fc20 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -33,6 +33,7 @@ class SsaOptimizerTask extends CompilerTask {
void optimize(CodegenWorkItem work, HGraph graph) {
ConstantSystem constantSystem = compiler.backend.constantSystem;
JavaScriptItemCompilationContext context = work.compilationContext;
+ bool trustPrimitives = compiler.trustPrimitives;
measure(() {
SsaDeadCodeEliminator dce;
List<OptimizationPhase> phases = <OptimizationPhase>[
@@ -46,9 +47,11 @@ 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(
+ trustPrimitives, backend, work, context.boundsChecked),
new SsaInstructionSimplifier(constantSystem, backend, work),
- new SsaCheckInserter(backend, work, context.boundsChecked),
+ new SsaCheckInserter(
+ trustPrimitives, 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 +68,8 @@ 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(
+ trustPrimitives, backend, work, context.boundsChecked),
new SsaSimplifyInterceptors(compiler, constantSystem, work),
dce = new SsaDeadCodeEliminator(compiler),
new SsaTypePropagator(compiler)];
@@ -76,7 +80,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(
+ trustPrimitives, backend, work, context.boundsChecked),
new SsaSimplifyInterceptors(compiler, constantSystem, work),
new SsaDeadCodeEliminator(compiler)];
} else {
@@ -886,16 +891,24 @@ class SsaInstructionSimplifier extends HBaseVisitor
class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase {
final Set<HInstruction> boundsChecked;
final CodegenWorkItem work;
+ final bool trustPrimitives;
final JavaScriptBackend backend;
final String name = "SsaCheckInserter";
HGraph graph;
- SsaCheckInserter(this.backend,
+ SsaCheckInserter(this.trustPrimitives,
+ 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 (trustPrimitives) return;
+
visitDominatorTree(graph);
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen_helpers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698