| OLD | NEW |
| 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 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 attachLocationToLast(node); | 2356 attachLocationToLast(node); |
| 2357 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { | 2357 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { |
| 2358 checkObject(input, '==='); | 2358 checkObject(input, '==='); |
| 2359 js.Expression objectTest = pop(); | 2359 js.Expression objectTest = pop(); |
| 2360 checkType(input, type); | 2360 checkType(input, type); |
| 2361 push(new js.Binary('&&', objectTest, pop()), node); | 2361 push(new js.Binary('&&', objectTest, pop()), node); |
| 2362 } else { | 2362 } else { |
| 2363 checkType(input, type); | 2363 checkType(input, type); |
| 2364 attachLocationToLast(node); | 2364 attachLocationToLast(node); |
| 2365 } | 2365 } |
| 2366 if (node.hasArgumentsCheck()) { | 2366 if (node.hasArgumentChecks()) { |
| 2367 InterfaceType interfaceType = type; | 2367 InterfaceType interfaceType = type; |
| 2368 ClassElement cls = type.element; | 2368 ClassElement cls = type.element; |
| 2369 Link<DartType> arguments = interfaceType.typeArguments; | 2369 Link<DartType> arguments = interfaceType.typeArguments; |
| 2370 js.Expression result = pop(); | 2370 js.Expression result = pop(); |
| 2371 use(node.checkCall); | 2371 for (int i = 0; i < node.checkCount; i++) { |
| 2372 result = new js.Binary('&&', result, pop()); | 2372 use(node.getCheck(i)); |
| 2373 result = new js.Binary('&&', result, pop()); |
| 2374 } |
| 2373 push(result, node); | 2375 push(result, node); |
| 2374 } | 2376 } |
| 2375 if (node.nullOk) { | 2377 if (node.nullOk) { |
| 2376 checkNull(input); | 2378 checkNull(input); |
| 2377 push(new js.Binary('||', pop(), pop()), node); | 2379 push(new js.Binary('||', pop(), pop()), node); |
| 2378 } | 2380 } |
| 2379 } | 2381 } |
| 2380 | 2382 |
| 2381 // TODO(johnniwinther): Refactor this method. | 2383 // TODO(johnniwinther): Refactor this method. |
| 2382 void visitTypeConversion(HTypeConversion node) { | 2384 void visitTypeConversion(HTypeConversion node) { |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3001 if (leftType.canBeNull() && rightType.canBeNull()) { | 3003 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3002 if (left.isConstantNull() || right.isConstantNull() || | 3004 if (left.isConstantNull() || right.isConstantNull() || |
| 3003 (leftType.isPrimitive() && leftType == rightType)) { | 3005 (leftType.isPrimitive() && leftType == rightType)) { |
| 3004 return '=='; | 3006 return '=='; |
| 3005 } | 3007 } |
| 3006 return null; | 3008 return null; |
| 3007 } else { | 3009 } else { |
| 3008 return '==='; | 3010 return '==='; |
| 3009 } | 3011 } |
| 3010 } | 3012 } |
| OLD | NEW |