| 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 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2340 new js.Binary('||', arrayTest, pop()))); | 2340 new js.Binary('||', arrayTest, pop()))); |
| 2341 } | 2341 } |
| 2342 | 2342 |
| 2343 void visitIs(HIs node) { | 2343 void visitIs(HIs node) { |
| 2344 DartType type = node.typeExpression; | 2344 DartType type = node.typeExpression; |
| 2345 world.registerIsCheck(type); | 2345 world.registerIsCheck(type); |
| 2346 Element element = type.element; | 2346 Element element = type.element; |
| 2347 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { | 2347 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { |
| 2348 compiler.unimplemented("visitIs for type variables", | 2348 compiler.unimplemented("visitIs for type variables", |
| 2349 instruction: node.expression); | 2349 instruction: node.expression); |
| 2350 } else if (identical(element.kind, ElementKind.TYPEDEF)) { | |
| 2351 compiler.unimplemented("visitIs for typedefs", | |
| 2352 instruction: node.expression); | |
| 2353 } | 2350 } |
| 2354 LibraryElement coreLibrary = compiler.coreLibrary; | 2351 LibraryElement coreLibrary = compiler.coreLibrary; |
| 2355 ClassElement objectClass = compiler.objectClass; | 2352 ClassElement objectClass = compiler.objectClass; |
| 2356 HInstruction input = node.expression; | 2353 HInstruction input = node.expression; |
| 2357 | 2354 |
| 2358 if (identical(element, objectClass) || identical(element, compiler.dynamicCl
ass)) { | 2355 if (identical(element, objectClass) || identical(element, compiler.dynamicCl
ass)) { |
| 2359 // The constant folder also does this optimization, but we make | 2356 // The constant folder also does this optimization, but we make |
| 2360 // it safe by assuming it may have not run. | 2357 // it safe by assuming it may have not run. |
| 2361 push(newLiteralBool(true), node); | 2358 push(newLiteralBool(true), node); |
| 2362 } else if (element == compiler.stringClass) { | 2359 } else if (element == compiler.stringClass) { |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 if (leftType.canBeNull() && rightType.canBeNull()) { | 3041 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3045 if (left.isConstantNull() || right.isConstantNull() || | 3042 if (left.isConstantNull() || right.isConstantNull() || |
| 3046 (leftType.isPrimitive() && leftType == rightType)) { | 3043 (leftType.isPrimitive() && leftType == rightType)) { |
| 3047 return '=='; | 3044 return '=='; |
| 3048 } | 3045 } |
| 3049 return null; | 3046 return null; |
| 3050 } else { | 3047 } else { |
| 3051 return '==='; | 3048 return '==='; |
| 3052 } | 3049 } |
| 3053 } | 3050 } |
| OLD | NEW |