Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 23494057: We can only use JavaScript's String.split and String.+ if both inputs are Strings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 target = backend.jsArrayRemoveLast; 292 target = backend.jsArrayRemoveLast;
293 } else if (selector.applies(backend.jsArrayAdd, compiler)) { 293 } else if (selector.applies(backend.jsArrayAdd, compiler)) {
294 // The codegen special cases array calls, but does not 294 // The codegen special cases array calls, but does not
295 // inline argument type checks. 295 // inline argument type checks.
296 if (!compiler.enableTypeAssertions) { 296 if (!compiler.enableTypeAssertions) {
297 target = backend.jsArrayAdd; 297 target = backend.jsArrayAdd;
298 } 298 }
299 } 299 }
300 } else if (input.isString(compiler)) { 300 } else if (input.isString(compiler)) {
301 if (selector.applies(backend.jsStringSplit, compiler)) { 301 if (selector.applies(backend.jsStringSplit, compiler)) {
302 if (node.inputs[2].isString(compiler)) { 302 HInstruction argument = node.inputs[2];
303 if (argument.isString(compiler) && !argument.canBeNull()) {
303 target = backend.jsStringSplit; 304 target = backend.jsStringSplit;
304 } 305 }
305 } else if (selector.applies(backend.jsStringOperatorAdd, compiler)) { 306 } else if (selector.applies(backend.jsStringOperatorAdd, compiler)) {
306 // `operator+` is turned into a JavaScript '+' so we need to 307 // `operator+` is turned into a JavaScript '+' so we need to
307 // make sure the receiver is not null. 308 // make sure the receiver and the argument are not null.
308 if (node.inputs[2].isString(compiler) && !input.canBeNull()) { 309 HInstruction argument = node.inputs[2];
310 if (argument.isString(compiler)
311 && !argument.canBeNull()
312 && !input.canBeNull()) {
309 target = backend.jsStringOperatorAdd; 313 target = backend.jsStringOperatorAdd;
310 } 314 }
311 } else if (selector.applies(backend.jsStringToString, compiler) 315 } else if (selector.applies(backend.jsStringToString, compiler)
312 && !input.canBeNull()) { 316 && !input.canBeNull()) {
313 return input; 317 return input;
314 } 318 }
315 } 319 }
316 if (target != null) { 320 if (target != null) {
317 // TODO(ngeoffray): There is a strong dependency between codegen 321 // TODO(ngeoffray): There is a strong dependency between codegen
318 // and this optimization that the dynamic invoke does not need an 322 // and this optimization that the dynamic invoke does not need an
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 // that knows it is not of a specific Type. 1551 // that knows it is not of a specific Type.
1548 } 1552 }
1549 1553
1550 for (HIf ifUser in notIfUsers) { 1554 for (HIf ifUser in notIfUsers) {
1551 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); 1555 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
1552 // TODO(ngeoffray): Also change uses for the then block on a HType 1556 // TODO(ngeoffray): Also change uses for the then block on a HType
1553 // that knows it is not of a specific Type. 1557 // that knows it is not of a specific Type.
1554 } 1558 }
1555 } 1559 }
1556 } 1560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698