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 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 push(attachPosition(instruction, node)); | 1510 push(attachPosition(instruction, node)); |
1511 } | 1511 } |
1512 | 1512 |
1513 /// Pops the most recent instruction from the stack and 'boolifies' it. | 1513 /// Pops the most recent instruction from the stack and 'boolifies' it. |
1514 /// | 1514 /// |
1515 /// Boolification is checking if the value is '=== true'. | 1515 /// Boolification is checking if the value is '=== true'. |
1516 @override | 1516 @override |
1517 HInstruction popBoolified() { | 1517 HInstruction popBoolified() { |
1518 HInstruction value = pop(); | 1518 HInstruction value = pop(); |
1519 if (typeBuilder.checkOrTrustTypes) { | 1519 if (typeBuilder.checkOrTrustTypes) { |
1520 return typeBuilder.potentiallyCheckOrTrustType( | 1520 ResolutionInterfaceType boolType = compiler.commonElements.boolType; |
1521 value, compiler.commonElements.boolType, | 1521 return typeBuilder.potentiallyCheckOrTrustType(value, boolType, |
1522 kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK); | 1522 kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK); |
1523 } | 1523 } |
1524 HInstruction result = new HBoolify(value, commonMasks.boolType); | 1524 HInstruction result = new HBoolify(value, commonMasks.boolType); |
1525 add(result); | 1525 add(result); |
1526 return result; | 1526 return result; |
1527 } | 1527 } |
1528 | 1528 |
1529 HInstruction attachPosition(HInstruction target, ast.Node node) { | 1529 HInstruction attachPosition(HInstruction target, ast.Node node) { |
1530 if (node != null) { | 1530 if (node != null) { |
1531 target.sourceInformation = sourceInformationBuilder.buildGeneric(node); | 1531 target.sourceInformation = sourceInformationBuilder.buildGeneric(node); |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 targetCanThrow: false)..sourceInformation = sourceInformation); | 3015 targetCanThrow: false)..sourceInformation = sourceInformation); |
3016 } | 3016 } |
3017 | 3017 |
3018 generateSuperNoSuchMethodSend( | 3018 generateSuperNoSuchMethodSend( |
3019 ast.Send node, Selector selector, List<HInstruction> arguments) { | 3019 ast.Send node, Selector selector, List<HInstruction> arguments) { |
3020 String name = selector.name; | 3020 String name = selector.name; |
3021 | 3021 |
3022 ClassElement cls = currentNonClosureClass; | 3022 ClassElement cls = currentNonClosureClass; |
3023 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); | 3023 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); |
3024 if (!Selectors.noSuchMethod_.signatureApplies(element)) { | 3024 if (!Selectors.noSuchMethod_.signatureApplies(element)) { |
3025 element = | 3025 ClassElement objectClass = commonElements.objectClass; |
3026 commonElements.objectClass.lookupMember(Identifiers.noSuchMethod_); | 3026 element = objectClass.lookupMember(Identifiers.noSuchMethod_); |
3027 } | 3027 } |
3028 if (backend.hasInvokeOnSupport && !element.enclosingClass.isObject) { | 3028 if (backend.hasInvokeOnSupport && !element.enclosingClass.isObject) { |
3029 // Register the call as dynamic if [noSuchMethod] on the super | 3029 // Register the call as dynamic if [noSuchMethod] on the super |
3030 // class is _not_ the default implementation from [Object], in | 3030 // class is _not_ the default implementation from [Object], in |
3031 // case the [noSuchMethod] implementation calls | 3031 // case the [noSuchMethod] implementation calls |
3032 // [JSInvocationMirror._invokeOn]. | 3032 // [JSInvocationMirror._invokeOn]. |
3033 // TODO(johnniwinther): Register this more precisely. | 3033 // TODO(johnniwinther): Register this more precisely. |
3034 registry?.registerDynamicUse(new DynamicUse(selector, null)); | 3034 registry?.registerDynamicUse(new DynamicUse(selector, null)); |
3035 } | 3035 } |
3036 String publicName = name; | 3036 String publicName = name; |
(...skipping 3686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6723 this.oldReturnLocal, | 6723 this.oldReturnLocal, |
6724 this.oldReturnType, | 6724 this.oldReturnType, |
6725 this.oldResolvedAst, | 6725 this.oldResolvedAst, |
6726 this.oldStack, | 6726 this.oldStack, |
6727 this.oldLocalsHandler, | 6727 this.oldLocalsHandler, |
6728 this.inTryStatement, | 6728 this.inTryStatement, |
6729 this.allFunctionsCalledOnce, | 6729 this.allFunctionsCalledOnce, |
6730 this.oldElementInferenceResults) | 6730 this.oldElementInferenceResults) |
6731 : super(function); | 6731 : super(function); |
6732 } | 6732 } |
OLD | NEW |