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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 27517)
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
@@ -299,13 +299,17 @@
}
} else if (input.isString(compiler)) {
if (selector.applies(backend.jsStringSplit, compiler)) {
- if (node.inputs[2].isString(compiler)) {
+ HInstruction argument = node.inputs[2];
+ if (argument.isString(compiler) && !argument.canBeNull()) {
target = backend.jsStringSplit;
}
} else if (selector.applies(backend.jsStringOperatorAdd, compiler)) {
// `operator+` is turned into a JavaScript '+' so we need to
- // make sure the receiver is not null.
- if (node.inputs[2].isString(compiler) && !input.canBeNull()) {
+ // make sure the receiver and the argument are not null.
+ HInstruction argument = node.inputs[2];
+ if (argument.isString(compiler)
+ && !argument.canBeNull()
+ && !input.canBeNull()) {
target = backend.jsStringOperatorAdd;
}
} else if (selector.applies(backend.jsStringToString, compiler)

Powered by Google App Engine
This is Rietveld 408576698