| 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 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 push(new js.Binary('&&', | 2300 push(new js.Binary('&&', |
| 2301 objectTest, | 2301 objectTest, |
| 2302 new js.Binary('||', arrayTest, pop()))); | 2302 new js.Binary('||', arrayTest, pop()))); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 void visitIs(HIs node) { | 2305 void visitIs(HIs node) { |
| 2306 DartType type = node.typeExpression; | 2306 DartType type = node.typeExpression; |
| 2307 world.registerIsCheck(type); | 2307 world.registerIsCheck(type); |
| 2308 Element element = type.element; | 2308 Element element = type.element; |
| 2309 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { | 2309 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { |
| 2310 compiler.unimplemented("visitIs for type variables", instruction: node); | 2310 compiler.unimplemented("visitIs for type variables", |
| 2311 instruction: node.expression); |
| 2311 } else if (identical(element.kind, ElementKind.TYPEDEF)) { | 2312 } else if (identical(element.kind, ElementKind.TYPEDEF)) { |
| 2312 compiler.unimplemented("visitIs for typedefs", instruction: node); | 2313 compiler.unimplemented("visitIs for typedefs", |
| 2314 instruction: node.expression); |
| 2313 } | 2315 } |
| 2314 LibraryElement coreLibrary = compiler.coreLibrary; | 2316 LibraryElement coreLibrary = compiler.coreLibrary; |
| 2315 ClassElement objectClass = compiler.objectClass; | 2317 ClassElement objectClass = compiler.objectClass; |
| 2316 HInstruction input = node.expression; | 2318 HInstruction input = node.expression; |
| 2317 | 2319 |
| 2318 if (identical(element, objectClass) || identical(element, compiler.dynamicCl
ass)) { | 2320 if (identical(element, objectClass) || identical(element, compiler.dynamicCl
ass)) { |
| 2319 // The constant folder also does this optimization, but we make | 2321 // The constant folder also does this optimization, but we make |
| 2320 // it safe by assuming it may have not run. | 2322 // it safe by assuming it may have not run. |
| 2321 push(new js.LiteralBool(true), node); | 2323 push(new js.LiteralBool(true), node); |
| 2322 } else if (element == compiler.stringClass) { | 2324 } else if (element == compiler.stringClass) { |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 if (leftType.canBeNull() && rightType.canBeNull()) { | 2994 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2993 if (left.isConstantNull() || right.isConstantNull() || | 2995 if (left.isConstantNull() || right.isConstantNull() || |
| 2994 (leftType.isPrimitive() && leftType == rightType)) { | 2996 (leftType.isPrimitive() && leftType == rightType)) { |
| 2995 return '=='; | 2997 return '=='; |
| 2996 } | 2998 } |
| 2997 return null; | 2999 return null; |
| 2998 } else { | 3000 } else { |
| 2999 return '==='; | 3001 return '==='; |
| 3000 } | 3002 } |
| 3001 } | 3003 } |
| OLD | NEW |