Chromium Code Reviews| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 | 6 |
| 7 final JavaScriptBackend backend; | 7 final JavaScriptBackend backend; |
| 8 | 8 |
| 9 SsaCodeGeneratorTask(JavaScriptBackend backend) | 9 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 10 : this.backend = backend, | 10 : this.backend = backend, |
| (...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 js.Expression result = pop(); | 2370 js.Expression result = pop(); |
| 2371 for (TypeVariableType typeVariable in cls.typeVariables) { | 2371 for (TypeVariableType typeVariable in cls.typeVariables) { |
| 2372 use(node.typeInfoCall); | 2372 use(node.typeInfoCall); |
| 2373 // TODO(johnniwinther): Retrieve the type name properly and not through | 2373 // TODO(johnniwinther): Retrieve the type name properly and not through |
| 2374 // [toString]. Note: Two cases below [typeVariable] and | 2374 // [toString]. Note: Two cases below [typeVariable] and |
| 2375 // [arguments.head]. | 2375 // [arguments.head]. |
| 2376 js.PropertyAccess field = | 2376 js.PropertyAccess field = |
| 2377 new js.PropertyAccess.field(pop(), typeVariable.toString()); | 2377 new js.PropertyAccess.field(pop(), typeVariable.toString()); |
| 2378 js.Expression genericName = new js.LiteralString("'${arguments.head}'"); | 2378 js.Expression genericName = new js.LiteralString("'${arguments.head}'"); |
| 2379 js.Binary eqTest = new js.Binary('===', field, genericName); | 2379 js.Binary eqTest = new js.Binary('===', field, genericName); |
| 2380 result = new js.Binary('&&', result, eqTest); | 2380 js.Prefix nullTest = new js.Prefix('!', field); |
|
kasperl
2012/09/12 12:19:04
Add a comment that explains why it is necessary to
ngeoffray
2012/09/12 12:30:39
Done.
| |
| 2381 result = new js.Binary( | |
| 2382 '&&', result, new js.Binary('||', eqTest, nullTest)); | |
| 2381 } | 2383 } |
| 2382 push(result, node); | 2384 push(result, node); |
| 2383 } | 2385 } |
| 2384 if (node.nullOk) { | 2386 if (node.nullOk) { |
| 2385 checkNull(input); | 2387 checkNull(input); |
| 2386 push(new js.Binary('||', pop(), pop()), node); | 2388 push(new js.Binary('||', pop(), pop()), node); |
| 2387 } | 2389 } |
| 2388 } | 2390 } |
| 2389 | 2391 |
| 2390 void visitTypeConversion(HTypeConversion node) { | 2392 void visitTypeConversion(HTypeConversion node) { |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2981 if (leftType.canBeNull() && rightType.canBeNull()) { | 2983 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2982 if (left.isConstantNull() || right.isConstantNull() || | 2984 if (left.isConstantNull() || right.isConstantNull() || |
| 2983 (leftType.isPrimitive() && leftType == rightType)) { | 2985 (leftType.isPrimitive() && leftType == rightType)) { |
| 2984 return '=='; | 2986 return '=='; |
| 2985 } | 2987 } |
| 2986 return null; | 2988 return null; |
| 2987 } else { | 2989 } else { |
| 2988 return '==='; | 2990 return '==='; |
| 2989 } | 2991 } |
| 2990 } | 2992 } |
| OLD | NEW |