| Index: lib/compiler/implementation/ssa/codegen.dart
|
| diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
|
| index 1108f0f78ee2e506a1539adc5b801b0ebdb55f5d..3d55e7d8f5f63d26b865ebe444542bb278017a8c 100644
|
| --- a/lib/compiler/implementation/ssa/codegen.dart
|
| +++ b/lib/compiler/implementation/ssa/codegen.dart
|
| @@ -2126,42 +2126,25 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
|
| }
|
|
|
| String builtinJsName(HInvokeInterceptor interceptor) {
|
| + // Don't count the target method or the receiver in the arity.
|
| + int arity = interceptor.inputs.length - 2;
|
| HInstruction receiver = interceptor.inputs[1];
|
| bool getter = interceptor.getter;
|
| SourceString name = interceptor.name;
|
|
|
| - if (receiver.isIndexablePrimitive()) {
|
| - if (interceptor.isLengthGetter()) {
|
| - return 'length';
|
| - } else if (!getter
|
| - && name == const SourceString('indexOf')
|
| - && interceptor.inputs.length == 3) {
|
| - // If there are three inputs, the start index is not given,
|
| - // and we share the same default value with the native
|
| - // implementation.
|
| - return 'indexOf';
|
| - } else if (!getter
|
| - && name == const SourceString('lastIndexOf')
|
| - && interceptor.inputs.length == 3) {
|
| - // If there are three inputs, the start index is not given,
|
| - // and we share the same default value with the native
|
| - // implementation.
|
| - return 'lastIndexOf';
|
| - }
|
| - }
|
| -
|
| - if (receiver.isExtendableArray() && !getter) {
|
| - if (name == const SourceString('add')) {
|
| + if (interceptor.isLengthGetterOnStringOrArray()) {
|
| + return 'length';
|
| + } else if (receiver.isExtendableArray() && !getter) {
|
| + if (name == const SourceString('add') && arity == 1) {
|
| return 'push';
|
| }
|
| - if (name == const SourceString('removeLast')) {
|
| + if (name == const SourceString('removeLast') && arity == 0) {
|
| return 'pop';
|
| }
|
| - }
|
| -
|
| - if (receiver.isString() && !getter) {
|
| - if (name == const SourceString('concat')
|
| - && interceptor.inputs[2].isString()) {
|
| + } else if (receiver.isString() && !getter) {
|
| + if (name == const SourceString('concat') &&
|
| + arity == 1 &&
|
| + interceptor.inputs[2].isString()) {
|
| return '+';
|
| }
|
| }
|
|
|