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

Side by Side Diff: pkg/kernel/lib/binary/ast_to_binary.dart

Issue 2931813002: [kernel] Stream kernel_reader (Closed)
Patch Set: Feedback Created 3 years, 6 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
« no previous file with comments | « pkg/kernel/lib/binary/ast_from_binary.dart ('k') | runtime/vm/bootstrap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library kernel.ast_to_binary; 4 library kernel.ast_to_binary;
5 5
6 import '../ast.dart'; 6 import '../ast.dart';
7 import '../import_table.dart'; 7 import '../import_table.dart';
8 import 'tag.dart'; 8 import 'tag.dart';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 } 1089 }
1090 1090
1091 visitNamedType(NamedType node) { 1091 visitNamedType(NamedType node) {
1092 writeStringReference(node.name); 1092 writeStringReference(node.name);
1093 writeNode(node.type); 1093 writeNode(node.type);
1094 } 1094 }
1095 1095
1096 visitTypeParameterType(TypeParameterType node) { 1096 visitTypeParameterType(TypeParameterType node) {
1097 writeByte(Tag.TypeParameterType); 1097 writeByte(Tag.TypeParameterType);
1098 writeUInt30(_typeParameterIndexer[node.parameter]); 1098 writeUInt30(_typeParameterIndexer[node.parameter]);
1099 writeUInt30(node.parameter.binaryOffset); 1099 List<TypeParameter> typeParameters =
1100 _typeParameterIndexer.indexList[node.parameter];
1101 writeUInt30(typeParameters[0].binaryOffset);
1102 writeUInt30(typeParameters.indexOf(node.parameter));
1100 writeOptionalNode(node.bound); 1103 writeOptionalNode(node.bound);
1101 } 1104 }
1102 1105
1103 visitVectorType(VectorType node) { 1106 visitVectorType(VectorType node) {
1104 writeByte(Tag.VectorType); 1107 writeByte(Tag.VectorType);
1105 } 1108 }
1106 1109
1107 visitTypedefType(TypedefType node) { 1110 visitTypedefType(TypedefType node) {
1108 writeByte(Tag.TypedefType); 1111 writeByte(Tag.TypedefType);
1109 writeReference(node.typedefReference); 1112 writeReference(node.typedefReference);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 1204
1202 void exit(SwitchStatement node) { 1205 void exit(SwitchStatement node) {
1203 stackHeight -= node.cases.length; 1206 stackHeight -= node.cases.length;
1204 } 1207 }
1205 1208
1206 int operator [](SwitchCase node) => index[node]; 1209 int operator [](SwitchCase node) => index[node];
1207 } 1210 }
1208 1211
1209 class TypeParameterIndexer { 1212 class TypeParameterIndexer {
1210 final Map<TypeParameter, int> index = <TypeParameter, int>{}; 1213 final Map<TypeParameter, int> index = <TypeParameter, int>{};
1214 final Map<TypeParameter, List<TypeParameter>> indexList =
1215 <TypeParameter, List<TypeParameter>>{};
1211 int stackHeight = 0; 1216 int stackHeight = 0;
1212 1217
1213 void enter(List<TypeParameter> typeParameters) { 1218 void enter(List<TypeParameter> typeParameters) {
1214 for (var parameter in typeParameters) { 1219 for (var parameter in typeParameters) {
1215 index[parameter] = stackHeight; 1220 index[parameter] = stackHeight;
1221 indexList[parameter] = typeParameters;
1216 ++stackHeight; 1222 ++stackHeight;
1217 } 1223 }
1218 } 1224 }
1219 1225
1220 void exit(List<TypeParameter> typeParameters) { 1226 void exit(List<TypeParameter> typeParameters) {
1221 stackHeight -= typeParameters.length; 1227 stackHeight -= typeParameters.length;
1222 } 1228 }
1223 1229
1224 int operator [](TypeParameter parameter) => index[parameter]; 1230 int operator [](TypeParameter parameter) => index[parameter];
1225 } 1231 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 _sink.add(_buffer.sublist(0, length)); 1471 _sink.add(_buffer.sublist(0, length));
1466 _buffer = new Uint8List(SIZE); 1472 _buffer = new Uint8List(SIZE);
1467 flushedLength += length; 1473 flushedLength += length;
1468 length = 0; 1474 length = 0;
1469 } 1475 }
1470 1476
1471 void flushAndDestroy() { 1477 void flushAndDestroy() {
1472 _sink.add(_buffer.sublist(0, length)); 1478 _sink.add(_buffer.sublist(0, length));
1473 } 1479 }
1474 } 1480 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/binary/ast_from_binary.dart ('k') | runtime/vm/bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698