| Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| index 8f3819f465407ec06aa6dc9a2cfcb502cb0dbc70..7fff9a15a8138f331fa44a886f30cfe42fa1f06e 100644
|
| --- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| @@ -1021,7 +1021,15 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| @override
|
| void visitNullCheck(tree_ir.NullCheck node) {
|
| js.Expression value = visitExpression(node.value);
|
| - js.Expression access = node.selector != null
|
| + // TODO(sra): Try to use the selector even when [useSelector] is false. The
|
| + // reason we use 'toString' is that it is always defined so avoids a slow
|
| + // lookup (in V8) of an absent property. We could use the property for the
|
| + // selector if we knew it was present. The property is present if the
|
| + // associated method was not inlined away, or if there is a noSuchMethod
|
| + // hook for that selector. We don't know these things here, but the decision
|
| + // could be deferred by creating a deferred property that was resolved after
|
| + // codegen.
|
| + js.Expression access = node.selector != null && node.useSelector
|
| ? js.js('#.#', [value, glue.invocationName(node.selector)])
|
| : js.js('#.toString', [value]);
|
| if (node.condition != null) {
|
|
|