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

Side by Side Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10558022: Better bitwise and binary arithmetic when the left operand is known to be a number. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup HTypeConversion usage. Created 8 years, 6 months 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
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 /** 5 /**
6 * Instead of emitting each SSA instruction with a temporary variable 6 * Instead of emitting each SSA instruction with a temporary variable
7 * mark instructions that can be emitted at their use-site. 7 * mark instructions that can be emitted at their use-site.
8 * For example, in: 8 * For example, in:
9 * t0 = 4; 9 * t0 = 4;
10 * t1 = 3; 10 * t1 = 3;
(...skipping 30 matching lines...) Expand all
41 41
42 // A check method must not have its input generate at use site, 42 // A check method must not have its input generate at use site,
43 // because it's using it multiple times. 43 // because it's using it multiple times.
44 void visitCheck(HCheck instruction) {} 44 void visitCheck(HCheck instruction) {}
45 45
46 // A type guard should not generate its input at use site, otherwise 46 // A type guard should not generate its input at use site, otherwise
47 // they would not be alive. 47 // they would not be alive.
48 void visitTypeGuard(HTypeGuard instruction) {} 48 void visitTypeGuard(HTypeGuard instruction) {}
49 49
50 void visitTypeConversion(HTypeConversion instruction) { 50 void visitTypeConversion(HTypeConversion instruction) {
51 if (!instruction.checked) generateAtUseSite.add(instruction); 51 if (!instruction.isChecked()) {
52 visitInstruction(instruction); 52 generateAtUseSite.add(instruction);
53 } else if (instruction.isCheckedModeCheck()) {
54 // Checked mode checks compile to code that only use their input
55 // once, so we can safely visit them an try to merge the input.
floitsch 2012/06/19 11:15:58 and
kasperl 2012/06/19 11:22:06 Done.
56 visitInstruction(instruction);
57 }
53 } 58 }
54 59
55 void tryGenerateAtUseSite(HInstruction instruction) { 60 void tryGenerateAtUseSite(HInstruction instruction) {
56 if (instruction.isControlFlow()) return; 61 if (instruction.isControlFlow()) return;
57 generateAtUseSite.add(instruction); 62 generateAtUseSite.add(instruction);
58 } 63 }
59 64
60 bool isBlockSinglePredecessor(HBasicBlock block) { 65 bool isBlockSinglePredecessor(HBasicBlock block) {
61 return block.successors.length === 1 66 return block.successors.length === 1
62 && block.successors[0].predecessors.length === 1; 67 && block.successors[0].predecessors.length === 1;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 }; 335 };
331 } 336 }
332 337
333 class JSBinaryOperatorPrecedence { 338 class JSBinaryOperatorPrecedence {
334 final int left; 339 final int left;
335 final int right; 340 final int right;
336 const JSBinaryOperatorPrecedence(this.left, this.right); 341 const JSBinaryOperatorPrecedence(this.left, this.right);
337 // All binary operators (excluding assignment) are left associative. 342 // All binary operators (excluding assignment) are left associative.
338 int get precedence() => left; 343 int get precedence() => left;
339 } 344 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698