| 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 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 bool negative = relation == '!=='; | 2339 bool negative = relation == '!=='; |
| 2340 | 2340 |
| 2341 if (node.isVariableCheck || node.isCompoundCheck) { | 2341 if (node.isVariableCheck || node.isCompoundCheck) { |
| 2342 use(node.checkCall); | 2342 use(node.checkCall); |
| 2343 if (negative) push(new js.Prefix('!', pop())); | 2343 if (negative) push(new js.Prefix('!', pop())); |
| 2344 } else { | 2344 } else { |
| 2345 assert(node.isRawCheck); | 2345 assert(node.isRawCheck); |
| 2346 LibraryElement coreLibrary = compiler.coreLibrary; | 2346 LibraryElement coreLibrary = compiler.coreLibrary; |
| 2347 ClassElement objectClass = compiler.objectClass; | 2347 ClassElement objectClass = compiler.objectClass; |
| 2348 Element element = type.element; | 2348 Element element = type.element; |
| 2349 | 2349 if (element == compiler.nullClass) { |
| 2350 if (identical(element, objectClass) || type.treatAsDynamic) { | 2350 if (negative) { |
| 2351 checkNonNull(input); |
| 2352 } else { |
| 2353 checkNull(input); |
| 2354 } |
| 2355 } else if (identical(element, objectClass) || type.treatAsDynamic) { |
| 2351 // The constant folder also does this optimization, but we make | 2356 // The constant folder also does this optimization, but we make |
| 2352 // it safe by assuming it may have not run. | 2357 // it safe by assuming it may have not run. |
| 2353 push(newLiteralBool(!negative), node); | 2358 push(newLiteralBool(!negative), node); |
| 2354 } else if (element == compiler.stringClass) { | 2359 } else if (element == compiler.stringClass) { |
| 2355 checkString(input, relation); | 2360 checkString(input, relation); |
| 2356 attachLocationToLast(node); | 2361 attachLocationToLast(node); |
| 2357 } else if (element == compiler.doubleClass) { | 2362 } else if (element == compiler.doubleClass) { |
| 2358 checkDouble(input, relation); | 2363 checkDouble(input, relation); |
| 2359 attachLocationToLast(node); | 2364 attachLocationToLast(node); |
| 2360 } else if (element == compiler.numClass) { | 2365 } else if (element == compiler.numClass) { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 if (leftType.canBeNull() && rightType.canBeNull()) { | 2989 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2985 if (left.isConstantNull() || right.isConstantNull() || | 2990 if (left.isConstantNull() || right.isConstantNull() || |
| 2986 (leftType.isPrimitive(compiler) && leftType == rightType)) { | 2991 (leftType.isPrimitive(compiler) && leftType == rightType)) { |
| 2987 return '=='; | 2992 return '=='; |
| 2988 } | 2993 } |
| 2989 return null; | 2994 return null; |
| 2990 } else { | 2995 } else { |
| 2991 return '==='; | 2996 return '==='; |
| 2992 } | 2997 } |
| 2993 } | 2998 } |
| OLD | NEW |