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

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

Issue 2545153002: Handle synthetic nodes use to throw exceptions (Closed)
Patch Set: Also handle malformed type Created 4 years 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 789
790 @override 790 @override
791 void visitNullLiteral(ir.NullLiteral nullLiteral) { 791 void visitNullLiteral(ir.NullLiteral nullLiteral) {
792 stack.add(graph.addConstantNull(compiler)); 792 stack.add(graph.addConstantNull(compiler));
793 } 793 }
794 794
795 /// Set the runtime type information if necessary. 795 /// Set the runtime type information if necessary.
796 HInstruction setListRuntimeTypeInfoIfNeeded( 796 HInstruction setListRuntimeTypeInfoIfNeeded(
797 HInstruction object, ir.ListLiteral listLiteral) { 797 HInstruction object, ir.ListLiteral listLiteral) {
798 InterfaceType type = localsHandler 798 InterfaceType type = localsHandler
799 .substInContext(elements.getType(astAdapter.getNode(listLiteral))); 799 .substInContext(astAdapter.getDartTypeOfListLiteral(listLiteral));
800 if (!backend.classNeedsRti(type.element) || type.treatAsRaw) { 800 if (!backend.classNeedsRti(type.element) || type.treatAsRaw) {
801 return object; 801 return object;
802 } 802 }
803 List<HInstruction> arguments = <HInstruction>[]; 803 List<HInstruction> arguments = <HInstruction>[];
804 for (DartType argument in type.typeArguments) { 804 for (DartType argument in type.typeArguments) {
805 arguments.add(typeBuilder.analyzeTypeArgument(argument, sourceElement)); 805 arguments.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
806 } 806 }
807 // TODO(15489): Register at codegen. 807 // TODO(15489): Register at codegen.
808 registry?.registerInstantiation(type); 808 registry?.registerInstantiation(type);
809 return callSetRuntimeTypeInfoWithTypeArguments(type, arguments, object); 809 return callSetRuntimeTypeInfoWithTypeArguments(type, arguments, object);
(...skipping 10 matching lines...) Expand all
820 for (ir.Expression element in listLiteral.expressions) { 820 for (ir.Expression element in listLiteral.expressions) {
821 element.accept(this); 821 element.accept(this);
822 elements.add(pop()); 822 elements.add(pop());
823 } 823 }
824 listInstruction = new HLiteralList(elements, backend.extendableArrayType); 824 listInstruction = new HLiteralList(elements, backend.extendableArrayType);
825 add(listInstruction); 825 add(listInstruction);
826 listInstruction = 826 listInstruction =
827 setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral); 827 setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
828 } 828 }
829 829
830 TypeMask type = astAdapter.typeOfNewList(targetElement, listLiteral); 830 TypeMask type = astAdapter.typeOfListLiteral(targetElement, listLiteral);
831 if (!type.containsAll(compiler.closedWorld)) { 831 if (!type.containsAll(compiler.closedWorld)) {
832 listInstruction.instructionType = type; 832 listInstruction.instructionType = type;
833 } 833 }
834 stack.add(listInstruction); 834 stack.add(listInstruction);
835 } 835 }
836 836
837 @override 837 @override
838 void visitMapLiteral(ir.MapLiteral mapLiteral) { 838 void visitMapLiteral(ir.MapLiteral mapLiteral) {
839 if (mapLiteral.isConst) { 839 if (mapLiteral.isConst) {
840 stack.add( 840 stack.add(
(...skipping 18 matching lines...) Expand all
859 constructor = astAdapter.mapLiteralConstructor; 859 constructor = astAdapter.mapLiteralConstructor;
860 HLiteralList argList = 860 HLiteralList argList =
861 new HLiteralList(constructorArgs, backend.extendableArrayType); 861 new HLiteralList(constructorArgs, backend.extendableArrayType);
862 add(argList); 862 add(argList);
863 inputs.add(argList); 863 inputs.add(argList);
864 } 864 }
865 865
866 assert(constructor.kind == ir.ProcedureKind.Factory); 866 assert(constructor.kind == ir.ProcedureKind.Factory);
867 867
868 InterfaceType type = localsHandler 868 InterfaceType type = localsHandler
869 .substInContext(elements.getType(astAdapter.getNode(mapLiteral))); 869 .substInContext(astAdapter.getDartTypeOfMapLiteral(mapLiteral));
870 870
871 ir.Class cls = constructor.enclosingClass; 871 ir.Class cls = constructor.enclosingClass;
872 872
873 if (backend.classNeedsRti(astAdapter.getElement(cls))) { 873 if (backend.classNeedsRti(astAdapter.getElement(cls))) {
874 List<HInstruction> typeInputs = <HInstruction>[]; 874 List<HInstruction> typeInputs = <HInstruction>[];
875 type.typeArguments.forEach((DartType argument) { 875 type.typeArguments.forEach((DartType argument) {
876 typeInputs 876 typeInputs
877 .add(typeBuilder.analyzeTypeArgument(argument, sourceElement)); 877 .add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
878 }); 878 });
879 879
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 push(new HNot(popBoolified(), backend.boolType)); 1711 push(new HNot(popBoolified(), backend.boolType));
1712 } 1712 }
1713 1713
1714 @override 1714 @override
1715 void visitStringConcatenation(ir.StringConcatenation stringConcat) { 1715 void visitStringConcatenation(ir.StringConcatenation stringConcat) {
1716 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); 1716 KernelStringBuilder stringBuilder = new KernelStringBuilder(this);
1717 stringConcat.accept(stringBuilder); 1717 stringConcat.accept(stringBuilder);
1718 stack.add(stringBuilder.result); 1718 stack.add(stringBuilder.result);
1719 } 1719 }
1720 } 1720 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698