| 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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 // Generate calls to the constructor bodies. | 1351 // Generate calls to the constructor bodies. |
| 1352 HInstruction interceptor = null; | 1352 HInstruction interceptor = null; |
| 1353 for (int index = constructorResolvedAsts.length - 1; index >= 0; index--) { | 1353 for (int index = constructorResolvedAsts.length - 1; index >= 0; index--) { |
| 1354 ResolvedAst constructorResolvedAst = constructorResolvedAsts[index]; | 1354 ResolvedAst constructorResolvedAst = constructorResolvedAsts[index]; |
| 1355 ConstructorBodyElement body = getConstructorBody(constructorResolvedAst); | 1355 ConstructorBodyElement body = getConstructorBody(constructorResolvedAst); |
| 1356 if (body == null) continue; | 1356 if (body == null) continue; |
| 1357 | 1357 |
| 1358 List bodyCallInputs = <HInstruction>[]; | 1358 List bodyCallInputs = <HInstruction>[]; |
| 1359 if (isNativeUpgradeFactory) { | 1359 if (isNativeUpgradeFactory) { |
| 1360 if (interceptor == null) { | 1360 if (interceptor == null) { |
| 1361 ConstantValue constant = | 1361 ConstantValue constant = new InterceptorConstantValue(classElement); |
| 1362 new InterceptorConstantValue(classElement.thisType); | |
| 1363 interceptor = graph.addConstant(constant, closedWorld); | 1362 interceptor = graph.addConstant(constant, closedWorld); |
| 1364 } | 1363 } |
| 1365 bodyCallInputs.add(interceptor); | 1364 bodyCallInputs.add(interceptor); |
| 1366 } | 1365 } |
| 1367 bodyCallInputs.add(newObject); | 1366 bodyCallInputs.add(newObject); |
| 1368 ast.Node node = constructorResolvedAst.node; | 1367 ast.Node node = constructorResolvedAst.node; |
| 1369 ClosureClassMap parameterClosureData = compiler.closureToClassMapper | 1368 ClosureClassMap parameterClosureData = compiler.closureToClassMapper |
| 1370 .getClosureToClassMapping(constructorResolvedAst); | 1369 .getClosureToClassMapping(constructorResolvedAst); |
| 1371 | 1370 |
| 1372 FunctionSignature functionSignature = body.functionSignature; | 1371 FunctionSignature functionSignature = body.functionSignature; |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2895 | 2894 |
| 2896 void handleJsInterceptorConstant(ast.Send node) { | 2895 void handleJsInterceptorConstant(ast.Send node) { |
| 2897 // Single argument must be a TypeConstant which is converted into a | 2896 // Single argument must be a TypeConstant which is converted into a |
| 2898 // InterceptorConstant. | 2897 // InterceptorConstant. |
| 2899 if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) { | 2898 if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) { |
| 2900 ast.Node argument = node.arguments.head; | 2899 ast.Node argument = node.arguments.head; |
| 2901 visit(argument); | 2900 visit(argument); |
| 2902 HInstruction argumentInstruction = pop(); | 2901 HInstruction argumentInstruction = pop(); |
| 2903 if (argumentInstruction is HConstant) { | 2902 if (argumentInstruction is HConstant) { |
| 2904 ConstantValue argumentConstant = argumentInstruction.constant; | 2903 ConstantValue argumentConstant = argumentInstruction.constant; |
| 2905 if (argumentConstant is TypeConstantValue) { | 2904 if (argumentConstant is TypeConstantValue && |
| 2906 ConstantValue constant = | 2905 argumentConstant.representedType is ResolutionInterfaceType) { |
| 2907 new InterceptorConstantValue(argumentConstant.representedType); | 2906 ResolutionInterfaceType type = argumentConstant.representedType; |
| 2907 ConstantValue constant = new InterceptorConstantValue(type.element); |
| 2908 HInstruction instruction = graph.addConstant(constant, closedWorld); | 2908 HInstruction instruction = graph.addConstant(constant, closedWorld); |
| 2909 stack.add(instruction); | 2909 stack.add(instruction); |
| 2910 return; | 2910 return; |
| 2911 } | 2911 } |
| 2912 } | 2912 } |
| 2913 } | 2913 } |
| 2914 reporter.reportErrorMessage( | 2914 reporter.reportErrorMessage( |
| 2915 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); | 2915 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); |
| 2916 stack.add(graph.addConstantNull(closedWorld)); | 2916 stack.add(graph.addConstantNull(closedWorld)); |
| 2917 } | 2917 } |
| (...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6769 this.oldReturnLocal, | 6769 this.oldReturnLocal, |
| 6770 this.oldReturnType, | 6770 this.oldReturnType, |
| 6771 this.oldResolvedAst, | 6771 this.oldResolvedAst, |
| 6772 this.oldStack, | 6772 this.oldStack, |
| 6773 this.oldLocalsHandler, | 6773 this.oldLocalsHandler, |
| 6774 this.inTryStatement, | 6774 this.inTryStatement, |
| 6775 this.allFunctionsCalledOnce, | 6775 this.allFunctionsCalledOnce, |
| 6776 this.oldElementInferenceResults) | 6776 this.oldElementInferenceResults) |
| 6777 : super(function); | 6777 : super(function); |
| 6778 } | 6778 } |
| OLD | NEW |