| 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 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 attachLocationToLast(node); | 2388 attachLocationToLast(node); |
| 2389 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { | 2389 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { |
| 2390 checkObject(input, '==='); | 2390 checkObject(input, '==='); |
| 2391 js.Expression objectTest = pop(); | 2391 js.Expression objectTest = pop(); |
| 2392 checkType(input, type); | 2392 checkType(input, type); |
| 2393 push(new js.Binary('&&', objectTest, pop()), node); | 2393 push(new js.Binary('&&', objectTest, pop()), node); |
| 2394 } else { | 2394 } else { |
| 2395 checkType(input, type); | 2395 checkType(input, type); |
| 2396 attachLocationToLast(node); | 2396 attachLocationToLast(node); |
| 2397 } | 2397 } |
| 2398 if (node.hasArgumentChecks()) { | 2398 if (node.hasArgumentsCheck()) { |
| 2399 InterfaceType interfaceType = type; | 2399 InterfaceType interfaceType = type; |
| 2400 ClassElement cls = type.element; | 2400 ClassElement cls = type.element; |
| 2401 Link<DartType> arguments = interfaceType.typeArguments; | 2401 Link<DartType> arguments = interfaceType.typeArguments; |
| 2402 js.Expression result = pop(); | 2402 js.Expression result = pop(); |
| 2403 for (int i = 0; i < node.checkCount; i++) { | 2403 use(node.checkCall); |
| 2404 use(node.getCheck(i)); | 2404 result = new js.Binary('&&', result, pop()); |
| 2405 result = new js.Binary('&&', result, pop()); | |
| 2406 } | |
| 2407 push(result, node); | 2405 push(result, node); |
| 2408 } | 2406 } |
| 2409 if (node.nullOk) { | 2407 if (node.nullOk) { |
| 2410 checkNull(input); | 2408 checkNull(input); |
| 2411 push(new js.Binary('||', pop(), pop()), node); | 2409 push(new js.Binary('||', pop(), pop()), node); |
| 2412 } | 2410 } |
| 2413 } | 2411 } |
| 2414 | 2412 |
| 2415 // TODO(johnniwinther): Refactor this method. | 2413 // TODO(johnniwinther): Refactor this method. |
| 2416 void visitTypeConversion(HTypeConversion node) { | 2414 void visitTypeConversion(HTypeConversion node) { |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 if (leftType.canBeNull() && rightType.canBeNull()) { | 3026 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3029 if (left.isConstantNull() || right.isConstantNull() || | 3027 if (left.isConstantNull() || right.isConstantNull() || |
| 3030 (leftType.isPrimitive() && leftType == rightType)) { | 3028 (leftType.isPrimitive() && leftType == rightType)) { |
| 3031 return '=='; | 3029 return '=='; |
| 3032 } | 3030 } |
| 3033 return null; | 3031 return null; |
| 3034 } else { | 3032 } else { |
| 3035 return '==='; | 3033 return '==='; |
| 3036 } | 3034 } |
| 3037 } | 3035 } |
| OLD | NEW |