| 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 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if (!compiler.enableTypeAssertions) { | 286 if (!compiler.enableTypeAssertions) { |
| 287 target = backend.jsArrayAdd; | 287 target = backend.jsArrayAdd; |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 } else if (input.isString(compiler)) { | 290 } else if (input.isString(compiler)) { |
| 291 if (selector.applies(backend.jsStringSplit, compiler)) { | 291 if (selector.applies(backend.jsStringSplit, compiler)) { |
| 292 if (node.inputs[2].isString(compiler)) { | 292 if (node.inputs[2].isString(compiler)) { |
| 293 target = backend.jsStringSplit; | 293 target = backend.jsStringSplit; |
| 294 } | 294 } |
| 295 } else if (selector.applies(backend.jsStringConcat, compiler)) { | 295 } else if (selector.applies(backend.jsStringConcat, compiler)) { |
| 296 if (node.inputs[2].isString(compiler)) { | 296 // `concat` is turned into a JavaScript '+' so we need to |
| 297 // make sure the receiver is not null. |
| 298 if (node.inputs[2].isString(compiler) && !input.canBeNull()) { |
| 297 target = backend.jsStringConcat; | 299 target = backend.jsStringConcat; |
| 298 } | 300 } |
| 299 } else if (selector.applies(backend.jsStringToString, compiler)) { | 301 } else if (selector.applies(backend.jsStringToString, compiler) |
| 302 && !input.canBeNull()) { |
| 300 return input; | 303 return input; |
| 301 } | 304 } |
| 302 } | 305 } |
| 303 if (target != null) { | 306 if (target != null) { |
| 304 // TODO(ngeoffray): There is a strong dependency between codegen | 307 // TODO(ngeoffray): There is a strong dependency between codegen |
| 305 // and this optimization that the dynamic invoke does not need an | 308 // and this optimization that the dynamic invoke does not need an |
| 306 // interceptor. We currently need to keep a | 309 // interceptor. We currently need to keep a |
| 307 // HInvokeDynamicMethod and not create a HForeign because | 310 // HInvokeDynamicMethod and not create a HForeign because |
| 308 // HForeign is too opaque for the SsaCheckInserter (that adds a | 311 // HForeign is too opaque for the SsaCheckInserter (that adds a |
| 309 // bounds check on removeLast). Once we start inlining, the | 312 // bounds check on removeLast). Once we start inlining, the |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 // that knows it is not of a specific Type. | 1350 // that knows it is not of a specific Type. |
| 1348 } | 1351 } |
| 1349 | 1352 |
| 1350 for (HIf ifUser in notIfUsers) { | 1353 for (HIf ifUser in notIfUsers) { |
| 1351 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); | 1354 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); |
| 1352 // TODO(ngeoffray): Also change uses for the then block on a HType | 1355 // TODO(ngeoffray): Also change uses for the then block on a HType |
| 1353 // that knows it is not of a specific Type. | 1356 // that knows it is not of a specific Type. |
| 1354 } | 1357 } |
| 1355 } | 1358 } |
| 1356 } | 1359 } |
| OLD | NEW |