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

Unified Diff: pkg/compiler/lib/src/ssa/codegen_helpers.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.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen_helpers.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index abc6c8658399fa7253d83202f82b0d3e298e106e..3b5c557c617766f354cecd576021f22858df939f 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -273,6 +273,37 @@ class SsaTypeKnownRemover extends HBaseVisitor {
}
/**
+ * Remove [HTypeConversion] instructions from the graph in '--trust-primitives'
+ * mode.
+ */
+class SsaTrustedCheckRemover extends HBaseVisitor {
+
+ Compiler compiler;
+ SsaTrustedCheckRemover(this.compiler);
+
+ void visitGraph(HGraph graph) {
+ if (!compiler.trustPrimitives) return;
+ visitDominatorTree(graph);
+ }
+
+ void visitBasicBlock(HBasicBlock block) {
+ HInstruction instruction = block.first;
+ while (instruction != null) {
+ HInstruction next = instruction.next;
+ instruction.accept(this);
+ instruction = next;
+ }
+ }
+
+ void visitTypeConversion(HTypeConversion instruction) {
+ if (instruction.isReceiverTypeCheck || instruction.isArgumentTypeCheck) {
+ instruction.block.rewrite(instruction, instruction.checkedInput);
+ instruction.block.remove(instruction);
+ }
+ }
+}
+
+/**
* Instead of emitting each SSA instruction with a temporary variable
* mark instructions that can be emitted at their use-site.
* For example, in:
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698