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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
8 | 8 |
9 import '../closure.dart'; | 9 import '../closure.dart'; |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 | 3127 |
3128 generateSuperNoSuchMethodSend( | 3128 generateSuperNoSuchMethodSend( |
3129 ast.Send node, Selector selector, List<HInstruction> arguments) { | 3129 ast.Send node, Selector selector, List<HInstruction> arguments) { |
3130 String name = selector.name; | 3130 String name = selector.name; |
3131 | 3131 |
3132 ClassElement cls = currentNonClosureClass; | 3132 ClassElement cls = currentNonClosureClass; |
3133 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); | 3133 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); |
3134 if (!Selectors.noSuchMethod_.signatureApplies(element)) { | 3134 if (!Selectors.noSuchMethod_.signatureApplies(element)) { |
3135 element = coreClasses.objectClass.lookupMember(Identifiers.noSuchMethod_); | 3135 element = coreClasses.objectClass.lookupMember(Identifiers.noSuchMethod_); |
3136 } | 3136 } |
3137 if (compiler.enabledInvokeOn && !element.enclosingClass.isObject) { | 3137 if (backend.hasInvokeOnSupport && !element.enclosingClass.isObject) { |
3138 // Register the call as dynamic if [noSuchMethod] on the super | 3138 // Register the call as dynamic if [noSuchMethod] on the super |
3139 // class is _not_ the default implementation from [Object], in | 3139 // class is _not_ the default implementation from [Object], in |
3140 // case the [noSuchMethod] implementation calls | 3140 // case the [noSuchMethod] implementation calls |
3141 // [JSInvocationMirror._invokeOn]. | 3141 // [JSInvocationMirror._invokeOn]. |
3142 // TODO(johnniwinther): Register this more precisely. | 3142 // TODO(johnniwinther): Register this more precisely. |
3143 registry?.registerDynamicUse(new DynamicUse(selector, null)); | 3143 registry?.registerDynamicUse(new DynamicUse(selector, null)); |
3144 } | 3144 } |
3145 String publicName = name; | 3145 String publicName = name; |
3146 if (selector.isSetter) publicName += '='; | 3146 if (selector.isSetter) publicName += '='; |
3147 | 3147 |
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 | 5481 |
5482 TypeMask type = _inferredTypeOfNewList(node); | 5482 TypeMask type = _inferredTypeOfNewList(node); |
5483 if (!type.containsAll(compiler.closedWorld)) { | 5483 if (!type.containsAll(compiler.closedWorld)) { |
5484 instruction.instructionType = type; | 5484 instruction.instructionType = type; |
5485 } | 5485 } |
5486 stack.add(instruction); | 5486 stack.add(instruction); |
5487 } | 5487 } |
5488 | 5488 |
5489 _inferredTypeOfNewList(ast.Node node) => | 5489 _inferredTypeOfNewList(ast.Node node) => |
5490 inferenceResults.typeOfNewList(sourceElement, node) ?? | 5490 inferenceResults.typeOfNewList(sourceElement, node) ?? |
5491 compiler.commonMasks.dynamicType; | 5491 compiler.closedWorld.commonMasks.dynamicType; |
5492 | 5492 |
5493 visitConditional(ast.Conditional node) { | 5493 visitConditional(ast.Conditional node) { |
5494 SsaBranchBuilder brancher = new SsaBranchBuilder(this, compiler, node); | 5494 SsaBranchBuilder brancher = new SsaBranchBuilder(this, compiler, node); |
5495 brancher.handleConditional(() => visit(node.condition), | 5495 brancher.handleConditional(() => visit(node.condition), |
5496 () => visit(node.thenExpression), () => visit(node.elseExpression)); | 5496 () => visit(node.thenExpression), () => visit(node.elseExpression)); |
5497 } | 5497 } |
5498 | 5498 |
5499 visitStringInterpolation(ast.StringInterpolation node) { | 5499 visitStringInterpolation(ast.StringInterpolation node) { |
5500 StringBuilderVisitor stringBuilder = new StringBuilderVisitor(this, node); | 5500 StringBuilderVisitor stringBuilder = new StringBuilderVisitor(this, node); |
5501 stringBuilder.visit(node); | 5501 stringBuilder.visit(node); |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7059 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7059 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
7060 unaliased.accept(this, builder); | 7060 unaliased.accept(this, builder); |
7061 } | 7061 } |
7062 | 7062 |
7063 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7063 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
7064 JavaScriptBackend backend = builder.compiler.backend; | 7064 JavaScriptBackend backend = builder.compiler.backend; |
7065 ClassElement cls = backend.helpers.DynamicRuntimeType; | 7065 ClassElement cls = backend.helpers.DynamicRuntimeType; |
7066 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); | 7066 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); |
7067 } | 7067 } |
7068 } | 7068 } |
OLD | NEW |