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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
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 * Replaces some instructions with specialized versions to make codegen easier. 8 * Replaces some instructions with specialized versions to make codegen easier.
9 * Caches codegen information on nodes. 9 * Caches codegen information on nodes.
10 */ 10 */
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 } 267 }
268 268
269 void visitTypeKnown(HTypeKnown instruction) { 269 void visitTypeKnown(HTypeKnown instruction) {
270 instruction.block.rewrite(instruction, instruction.checkedInput); 270 instruction.block.rewrite(instruction, instruction.checkedInput);
271 instruction.block.remove(instruction); 271 instruction.block.remove(instruction);
272 } 272 }
273 } 273 }
274 274
275 /** 275 /**
276 * Remove [HTypeConversion] instructions from the graph in '--trust-primitives'
277 * mode.
278 */
279 class SsaTrustedCheckRemover extends HBaseVisitor {
280
281 Compiler compiler;
282 SsaTrustedCheckRemover(this.compiler);
283
284 void visitGraph(HGraph graph) {
285 if (!compiler.trustPrimitives) return;
286 visitDominatorTree(graph);
287 }
288
289 void visitBasicBlock(HBasicBlock block) {
290 HInstruction instruction = block.first;
291 while (instruction != null) {
292 HInstruction next = instruction.next;
293 instruction.accept(this);
294 instruction = next;
295 }
296 }
297
298 void visitTypeConversion(HTypeConversion instruction) {
299 if (instruction.isReceiverTypeCheck || instruction.isArgumentTypeCheck) {
300 instruction.block.rewrite(instruction, instruction.checkedInput);
301 instruction.block.remove(instruction);
302 }
303 }
304 }
305
306 /**
276 * Instead of emitting each SSA instruction with a temporary variable 307 * Instead of emitting each SSA instruction with a temporary variable
277 * mark instructions that can be emitted at their use-site. 308 * mark instructions that can be emitted at their use-site.
278 * For example, in: 309 * For example, in:
279 * t0 = 4; 310 * t0 = 4;
280 * t1 = 3; 311 * t1 = 3;
281 * t2 = add(t0, t1); 312 * t2 = add(t0, t1);
282 * t0 and t1 would be marked and the resulting code would then be: 313 * t0 and t1 would be marked and the resulting code would then be:
283 * t2 = add(4, 3); 314 * t2 = add(4, 3);
284 */ 315 */
285 class SsaInstructionMerger extends HBaseVisitor { 316 class SsaInstructionMerger extends HBaseVisitor {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 } 725 }
695 726
696 // If [thenInput] is defined in the first predecessor, then it is only used 727 // If [thenInput] is defined in the first predecessor, then it is only used
697 // by [phi] and can be generated at use site. 728 // by [phi] and can be generated at use site.
698 if (identical(thenInput.block, end.predecessors[0])) { 729 if (identical(thenInput.block, end.predecessors[0])) {
699 assert(thenInput.usedBy.length == 1); 730 assert(thenInput.usedBy.length == 1);
700 markAsGenerateAtUseSite(thenInput); 731 markAsGenerateAtUseSite(thenInput);
701 } 732 }
702 } 733 }
703 } 734 }
OLDNEW
« 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