Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2630743002: Remove use of FunctionSignature et al from call_structure.dart (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 Map<Element, HInstruction> fieldValues) { 1063 Map<Element, HInstruction> fieldValues) {
1064 assert(invariant(constructor, constructor.isSynthesized, 1064 assert(invariant(constructor, constructor.isSynthesized,
1065 message: "Unexpected unsynthesized constructor: $constructor")); 1065 message: "Unexpected unsynthesized constructor: $constructor"));
1066 List<HInstruction> arguments = <HInstruction>[]; 1066 List<HInstruction> arguments = <HInstruction>[];
1067 HInstruction compileArgument(ParameterElement parameter) { 1067 HInstruction compileArgument(ParameterElement parameter) {
1068 return localsHandler.readLocal(parameter); 1068 return localsHandler.readLocal(parameter);
1069 } 1069 }
1070 1070
1071 ConstructorElement target = constructor.definingConstructor.implementation; 1071 ConstructorElement target = constructor.definingConstructor.implementation;
1072 bool match = !target.isMalformed && 1072 bool match = !target.isMalformed &&
1073 CallStructure.addForwardingElementArgumentsToList( 1073 Elements.addForwardingElementArgumentsToList<HInstruction>(
1074 constructor, 1074 constructor,
1075 arguments, 1075 arguments,
1076 target, 1076 target,
1077 compileArgument, 1077 compileArgument,
1078 handleConstantForOptionalParameter); 1078 handleConstantForOptionalParameter);
1079 if (!match) { 1079 if (!match) {
1080 if (compiler.elementHasCompileTimeError(constructor)) { 1080 if (compiler.elementHasCompileTimeError(constructor)) {
1081 return; 1081 return;
1082 } 1082 }
1083 // If this fails, the selector we constructed for the call to a 1083 // If this fails, the selector we constructed for the call to a
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 ClassElement superClass = enclosingClass.superclass; 1156 ClassElement superClass = enclosingClass.superclass;
1157 if (!enclosingClass.isObject) { 1157 if (!enclosingClass.isObject) {
1158 assert(superClass != null); 1158 assert(superClass != null);
1159 assert(superClass.isResolved); 1159 assert(superClass.isResolved);
1160 // TODO(johnniwinther): Should we find injected constructors as well? 1160 // TODO(johnniwinther): Should we find injected constructors as well?
1161 FunctionElement target = superClass.lookupDefaultConstructor(); 1161 FunctionElement target = superClass.lookupDefaultConstructor();
1162 if (target == null) { 1162 if (target == null) {
1163 reporter.internalError( 1163 reporter.internalError(
1164 superClass, "No default constructor available."); 1164 superClass, "No default constructor available.");
1165 } 1165 }
1166 List<HInstruction> arguments = CallStructure.NO_ARGS.makeArgumentsList( 1166 List<HInstruction> arguments = Elements.makeArgumentsList<HInstruction>(
1167 CallStructure.NO_ARGS,
1167 const Link<ast.Node>(), 1168 const Link<ast.Node>(),
1168 target.implementation, 1169 target.implementation,
1169 null, 1170 null,
1170 handleConstantForOptionalParameter); 1171 handleConstantForOptionalParameter);
1171 inlineSuperOrRedirect(target.resolvedAst, arguments, 1172 inlineSuperOrRedirect(target.resolvedAst, arguments,
1172 constructorResolvedAsts, fieldValues, constructor); 1173 constructorResolvedAsts, fieldValues, constructor);
1173 } 1174 }
1174 } 1175 }
1175 } 1176 }
1176 1177
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 */ 2541 */
2541 List<HInstruction> makeStaticArgumentList(CallStructure callStructure, 2542 List<HInstruction> makeStaticArgumentList(CallStructure callStructure,
2542 Link<ast.Node> arguments, FunctionElement element) { 2543 Link<ast.Node> arguments, FunctionElement element) {
2543 assert(invariant(element, element.isImplementation)); 2544 assert(invariant(element, element.isImplementation));
2544 2545
2545 HInstruction compileArgument(ast.Node argument) { 2546 HInstruction compileArgument(ast.Node argument) {
2546 visit(argument); 2547 visit(argument);
2547 return pop(); 2548 return pop();
2548 } 2549 }
2549 2550
2550 return callStructure.makeArgumentsList( 2551 return Elements.makeArgumentsList<HInstruction>(
2552 callStructure,
2551 arguments, 2553 arguments,
2552 element, 2554 element,
2553 compileArgument, 2555 compileArgument,
2554 backend.isJsInterop(element) 2556 backend.isJsInterop(element)
2555 ? handleConstantForOptionalParameterJsInterop 2557 ? handleConstantForOptionalParameterJsInterop
2556 : handleConstantForOptionalParameter); 2558 : handleConstantForOptionalParameter);
2557 } 2559 }
2558 2560
2559 void addGenericSendArgumentsToList( 2561 void addGenericSendArgumentsToList(
2560 Link<ast.Node> link, List<HInstruction> list) { 2562 Link<ast.Node> link, List<HInstruction> list) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
3428 pop(); 3430 pop();
3429 }); 3431 });
3430 generateAbstractClassInstantiationError(send, cls.name); 3432 generateAbstractClassInstantiationError(send, cls.name);
3431 return; 3433 return;
3432 } 3434 }
3433 3435
3434 // TODO(5347): Try to avoid the need for calling [implementation] before 3436 // TODO(5347): Try to avoid the need for calling [implementation] before
3435 // calling [makeStaticArgumentList]. 3437 // calling [makeStaticArgumentList].
3436 constructorImplementation = constructor.implementation; 3438 constructorImplementation = constructor.implementation;
3437 if (constructorImplementation.isMalformed || 3439 if (constructorImplementation.isMalformed ||
3438 !callStructure 3440 !callStructure.signatureApplies(constructorImplementation.type)) {
3439 .signatureApplies(constructorImplementation.functionSignature)) {
3440 generateWrongArgumentCountError(send, constructor, send.arguments); 3441 generateWrongArgumentCountError(send, constructor, send.arguments);
3441 return; 3442 return;
3442 } 3443 }
3443 3444
3444 List<HInstruction> inputs = <HInstruction>[]; 3445 List<HInstruction> inputs = <HInstruction>[];
3445 if (constructor.isGenerativeConstructor && 3446 if (constructor.isGenerativeConstructor &&
3446 backend.isNativeOrExtendsNative(constructor.enclosingClass) && 3447 backend.isNativeOrExtendsNative(constructor.enclosingClass) &&
3447 !backend.isJsInterop(constructor)) { 3448 !backend.isJsInterop(constructor)) {
3448 // Native class generative constructors take a pre-constructed object. 3449 // Native class generative constructors take a pre-constructed object.
3449 inputs.add(graph.addConstantNull(closedWorld)); 3450 inputs.add(graph.addConstantNull(closedWorld));
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 this.oldReturnLocal, 6771 this.oldReturnLocal,
6771 this.oldReturnType, 6772 this.oldReturnType,
6772 this.oldResolvedAst, 6773 this.oldResolvedAst,
6773 this.oldStack, 6774 this.oldStack,
6774 this.oldLocalsHandler, 6775 this.oldLocalsHandler,
6775 this.inTryStatement, 6776 this.inTryStatement,
6776 this.allFunctionsCalledOnce, 6777 this.allFunctionsCalledOnce,
6777 this.oldElementInferenceResults) 6778 this.oldElementInferenceResults)
6778 : super(function); 6779 : super(function);
6779 } 6780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698