| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
| 8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 ir.Primitive receiver = visit(expression); | 870 ir.Primitive receiver = visit(expression); |
| 871 return irBuilder.buildTypeOperator(receiver, type, isTypeTest: false); | 871 return irBuilder.buildTypeOperator(receiver, type, isTypeTest: false); |
| 872 } | 872 } |
| 873 | 873 |
| 874 @override | 874 @override |
| 875 ir.Primitive visitIs( | 875 ir.Primitive visitIs( |
| 876 ast.Send node, | 876 ast.Send node, |
| 877 ast.Node expression, | 877 ast.Node expression, |
| 878 DartType type, | 878 DartType type, |
| 879 _) { | 879 _) { |
| 880 ir.Primitive value = visit(expression); | 880 ir.Primitive receiver = visit(expression); |
| 881 return irBuilder.buildTypeOperator(value, type, isTypeTest: true); | 881 return irBuilder.buildTypeOperator( |
| 882 receiver, type, |
| 883 isTypeTest: true, |
| 884 isNotCheck: false); |
| 882 } | 885 } |
| 883 | 886 |
| 884 @override | 887 @override |
| 885 ir.Primitive visitIsNot(ast.Send node, | 888 ir.Primitive visitIsNot(ast.Send node, |
| 886 ast.Node expression, DartType type, _) { | 889 ast.Node expression, DartType type, _) { |
| 887 ir.Primitive value = visit(expression); | 890 ir.Primitive receiver = visit(expression); |
| 888 ir.Primitive check = irBuilder.buildTypeOperator( | 891 return irBuilder.buildTypeOperator( |
| 889 value, type, isTypeTest: true); | 892 receiver, type, |
| 890 return irBuilder.buildNegation(check); | 893 isTypeTest: true, |
| 894 isNotCheck: true); |
| 891 } | 895 } |
| 892 | 896 |
| 893 ir.Primitive translateBinary(ast.Node left, | 897 ir.Primitive translateBinary(ast.Node left, |
| 894 op.BinaryOperator operator, | 898 op.BinaryOperator operator, |
| 895 ast.Node right) { | 899 ast.Node right) { |
| 896 Selector selector = new Selector.binaryOperator(operator.selectorName); | 900 Selector selector = new Selector.binaryOperator(operator.selectorName); |
| 897 ir.Primitive receiver = visit(left); | 901 ir.Primitive receiver = visit(left); |
| 898 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; | 902 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; |
| 899 arguments = normalizeDynamicArguments(selector.callStructure, arguments); | 903 arguments = normalizeDynamicArguments(selector.callStructure, arguments); |
| 900 return irBuilder.buildDynamicInvocation(receiver, selector, arguments); | 904 return irBuilder.buildDynamicInvocation(receiver, selector, arguments); |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 JavaScriptBackend get _backend => _compiler.backend; | 2300 JavaScriptBackend get _backend => _compiler.backend; |
| 2297 | 2301 |
| 2298 GlobalProgramInformation(this._compiler); | 2302 GlobalProgramInformation(this._compiler); |
| 2299 | 2303 |
| 2300 /// Returns [true], if the analysis could not determine that the type | 2304 /// Returns [true], if the analysis could not determine that the type |
| 2301 /// arguments for the class [cls] are never used in the program. | 2305 /// arguments for the class [cls] are never used in the program. |
| 2302 bool requiresRuntimeTypesFor(ClassElement cls) { | 2306 bool requiresRuntimeTypesFor(ClassElement cls) { |
| 2303 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); | 2307 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); |
| 2304 } | 2308 } |
| 2305 | 2309 |
| 2306 ClassElement get nullClass => _compiler.nullClass; | 2310 Set<ClassElement> get interceptedClasses => _backend.interceptedClasses; |
| 2307 } | 2311 } |
| 2308 | 2312 |
| 2309 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder]. | 2313 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder]. |
| 2310 class JsIrBuilderVisitor extends IrBuilderVisitor { | 2314 class JsIrBuilderVisitor extends IrBuilderVisitor { |
| 2311 /// Promote the type of [irBuilder] to [JsIrBuilder]. | 2315 /// Promote the type of [irBuilder] to [JsIrBuilder]. |
| 2312 JsIrBuilder get irBuilder => super.irBuilder; | 2316 JsIrBuilder get irBuilder => super.irBuilder; |
| 2313 | 2317 |
| 2314 JavaScriptBackend get backend => compiler.backend; | 2318 JavaScriptBackend get backend => compiler.backend; |
| 2315 | 2319 |
| 2316 /// Result of closure conversion for the current body of code. | 2320 /// Result of closure conversion for the current body of code. |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3075 node.body = replacementFor(node.body); | 3079 node.body = replacementFor(node.body); |
| 3076 } | 3080 } |
| 3077 } | 3081 } |
| 3078 | 3082 |
| 3079 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 3083 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 3080 class RemovalVisitor extends ir.RecursiveVisitor { | 3084 class RemovalVisitor extends ir.RecursiveVisitor { |
| 3081 processReference(ir.Reference reference) { | 3085 processReference(ir.Reference reference) { |
| 3082 reference.unlink(); | 3086 reference.unlink(); |
| 3083 } | 3087 } |
| 3084 } | 3088 } |
| OLD | NEW |