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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10557003: Fix most warnings and other minor cleanups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index d155f0d0b0691a4f8ac058706af24f8f8c941500..cadc8e80ec5f02faa7274ff90e81c9bbeb647681 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -501,10 +501,12 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
return false;
}
+ HBinaryArithmetic binary = instruction;
+ assert(binary.inputs.length == 3);
// Is it a builtin operation involving constant numbers?
- if (instruction.builtin && instruction.inputs.length == 3) {
- var left = instruction.inputs[1];
- var right = instruction.inputs[2];
+ if (binary.builtin) {
+ var left = binary.left;
+ var right = binary.right;
if (left.isConstantNumber() && isCommutative) {
var tmp = right;
right = left;
@@ -513,18 +515,20 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
return false;
}
// Right is constant number.
- var value = right.constant.value;
+ HConstant constantRight = right;
+ NumConstant numberConstant = constantRight.constant;
+ num value = numberConstant.value;
// Check that left has the same name as the definition and emit
// the short update definition if it is.
if (variableNames.getName(left) == name) {
- if (instruction is HAdd && right.constant.value == 1) {
+ if (binary is HAdd && value == 1) {
buffer.add('++');
declareVariable(name);
- } else if (instruction is HSubtract && right.constant.value == 1) {
+ } else if (binary is HSubtract && value == 1) {
buffer.add('--');
declareVariable(name);
} else {
- var operation = instruction.operation.name;
+ var operation = binary.operation.name;
declareVariable(name);
buffer.add(' ${operation}= ${value}');
}
@@ -2481,8 +2485,8 @@ class SsaOptimizedCodeGenerator extends SsaCodeGenerator {
void bailout(HTypeGuard guard, String reason) {
if (maxBailoutParameters === null) {
maxBailoutParameters = 0;
- work.guards.forEach((HTypeGuard guard) {
- int inputLength = guard.inputs.length;
+ work.guards.forEach((HTypeGuard workGuard) {
+ int inputLength = workGuard.inputs.length;
if (inputLength > maxBailoutParameters) {
maxBailoutParameters = inputLength;
}

Powered by Google App Engine
This is Rietveld 408576698