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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/native_handler.dart

Issue 177963002: Use List instead of Link in the type system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and some algorithmic bugs fixed. Created 6 years, 9 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 | Annotate | Revision Log
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 library native; 5 library native;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 import 'dart2jslib.dart'; 8 import 'dart2jslib.dart';
9 import 'dart_types.dart'; 9 import 'dart_types.dart';
10 import 'elements/elements.dart'; 10 import 'elements/elements.dart';
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 906
907 /// Models the behavior of having intances of [type] escape from Dart code 907 /// Models the behavior of having intances of [type] escape from Dart code
908 /// into native code. 908 /// into native code.
909 void _escape(DartType type, Compiler compiler) { 909 void _escape(DartType type, Compiler compiler) {
910 type = type.unalias(compiler); 910 type = type.unalias(compiler);
911 if (type is FunctionType) { 911 if (type is FunctionType) {
912 FunctionType functionType = type; 912 FunctionType functionType = type;
913 // A function might be called from native code, passing us novel 913 // A function might be called from native code, passing us novel
914 // parameters. 914 // parameters.
915 _escape(functionType.returnType, compiler); 915 _escape(functionType.returnType, compiler);
916 for (Link<DartType> parameters = functionType.parameterTypes; 916 for (DartType parameter in functionType.parameterTypes) {
917 !parameters.isEmpty; 917 _capture(parameter, compiler);
918 parameters = parameters.tail) {
919 _capture(parameters.head, compiler);
920 } 918 }
921 } 919 }
922 } 920 }
923 921
924 /// Models the behavior of Dart code receiving instances and methods of [type] 922 /// Models the behavior of Dart code receiving instances and methods of [type]
925 /// from native code. We usually start the analysis by capturing a native 923 /// from native code. We usually start the analysis by capturing a native
926 /// method that has been used. 924 /// method that has been used.
927 void _capture(DartType type, Compiler compiler) { 925 void _capture(DartType type, Compiler compiler) {
928 type = type.unalias(compiler); 926 type = type.unalias(compiler);
929 if (type is FunctionType) { 927 if (type is FunctionType) {
930 FunctionType functionType = type; 928 FunctionType functionType = type;
931 _capture(functionType.returnType, compiler); 929 _capture(functionType.returnType, compiler);
932 for (Link<DartType> parameters = functionType.parameterTypes; 930 for (DartType parameter in functionType.parameterTypes) {
933 !parameters.isEmpty; 931 _escape(parameter, compiler);
934 parameters = parameters.tail) {
935 _escape(parameters.head, compiler);
936 } 932 }
937 } else { 933 } else {
938 typesInstantiated.add(type); 934 typesInstantiated.add(type);
939 } 935 }
940 } 936 }
941 937
942 static _parseType(String typeString, Compiler compiler, 938 static _parseType(String typeString, Compiler compiler,
943 lookup(name), locationNodeOrElement) { 939 lookup(name), locationNodeOrElement) {
944 if (typeString == '=Object') return SpecialType.JsObject; 940 if (typeString == '=Object') return SpecialType.JsObject;
945 if (typeString == 'dynamic') { 941 if (typeString == 'dynamic') {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } 1131 }
1136 LiteralString jsCode = nativeBody.asLiteralString(); 1132 LiteralString jsCode = nativeBody.asLiteralString();
1137 builder.push(new HForeign.statement( 1133 builder.push(new HForeign.statement(
1138 new js.LiteralStatement(jsCode.dartString.slowToString()), 1134 new js.LiteralStatement(jsCode.dartString.slowToString()),
1139 <HInstruction>[], 1135 <HInstruction>[],
1140 new SideEffects(), 1136 new SideEffects(),
1141 null, 1137 null,
1142 backend.dynamicType)); 1138 backend.dynamicType));
1143 } 1139 }
1144 } 1140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698