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

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

Issue 2972343002: [kernel] Insert kernel bodies into VM heap (Closed)
Patch Set: Review comments Created 3 years, 4 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/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('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_from_binary; 4 library kernel.ast_from_binary;
5 5
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../transformations/flags.dart'; 10 import '../transformations/flags.dart';
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 var canonicalName = readCanonicalNameReference(); 528 var canonicalName = readCanonicalNameReference();
529 var reference = canonicalName.getReference(); 529 var reference = canonicalName.getReference();
530 Field node = reference.node; 530 Field node = reference.node;
531 bool shouldWriteData = node == null || _isReadingLibraryImplementation; 531 bool shouldWriteData = node == null || _isReadingLibraryImplementation;
532 if (node == null) { 532 if (node == null) {
533 node = new Field(null, reference: reference); 533 node = new Field(null, reference: reference);
534 } 534 }
535 int fileOffset = readOffset(); 535 int fileOffset = readOffset();
536 int fileEndOffset = readOffset(); 536 int fileEndOffset = readOffset();
537 int flags = readByte(); 537 int flags = readByte();
538 readUInt(); // parent class binary offset.
539 var name = readName(); 538 var name = readName();
540 var fileUri = readUriReference(); 539 var fileUri = readUriReference();
541 var documentationComment = readStringOrNullIfEmpty(); 540 var documentationComment = readStringOrNullIfEmpty();
542 var annotations = readAnnotationList(node); 541 var annotations = readAnnotationList(node);
543 debugPath.add(node.name?.name ?? 'field'); 542 debugPath.add(node.name?.name ?? 'field');
544 var type = readDartType(); 543 var type = readDartType();
545 var initializer = readExpressionOption(); 544 var initializer = readExpressionOption();
546 int transformerFlags = getAndResetTransformerFlags(); 545 int transformerFlags = getAndResetTransformerFlags();
547 debugPath.removeLast(); 546 debugPath.removeLast();
548 if (shouldWriteData) { 547 if (shouldWriteData) {
(...skipping 18 matching lines...) Expand all
567 var canonicalName = readCanonicalNameReference(); 566 var canonicalName = readCanonicalNameReference();
568 var reference = canonicalName.getReference(); 567 var reference = canonicalName.getReference();
569 Constructor node = reference.node; 568 Constructor node = reference.node;
570 bool shouldWriteData = node == null || _isReadingLibraryImplementation; 569 bool shouldWriteData = node == null || _isReadingLibraryImplementation;
571 if (node == null) { 570 if (node == null) {
572 node = new Constructor(null, reference: reference); 571 node = new Constructor(null, reference: reference);
573 } 572 }
574 var fileOffset = readOffset(); 573 var fileOffset = readOffset();
575 var fileEndOffset = readOffset(); 574 var fileEndOffset = readOffset();
576 var flags = readByte(); 575 var flags = readByte();
577 readUInt(); // parent class binary offset.
578 var name = readName(); 576 var name = readName();
579 var documentationComment = readStringOrNullIfEmpty(); 577 var documentationComment = readStringOrNullIfEmpty();
580 var annotations = readAnnotationList(node); 578 var annotations = readAnnotationList(node);
581 debugPath.add(node.name?.name ?? 'constructor'); 579 debugPath.add(node.name?.name ?? 'constructor');
582 var function = readFunctionNode(); 580 var function = readFunctionNode();
583 pushVariableDeclarations(function.positionalParameters); 581 pushVariableDeclarations(function.positionalParameters);
584 pushVariableDeclarations(function.namedParameters); 582 pushVariableDeclarations(function.namedParameters);
585 if (shouldWriteData) { 583 if (shouldWriteData) {
586 _fillTreeNodeList(node.initializers, readInitializer, node); 584 _fillTreeNodeList(node.initializers, readInitializer, node);
587 } else { 585 } else {
(...skipping 23 matching lines...) Expand all
611 Procedure node = reference.node; 609 Procedure node = reference.node;
612 bool shouldWriteData = node == null || _isReadingLibraryImplementation; 610 bool shouldWriteData = node == null || _isReadingLibraryImplementation;
613 if (node == null) { 611 if (node == null) {
614 node = new Procedure(null, null, null, reference: reference); 612 node = new Procedure(null, null, null, reference: reference);
615 } 613 }
616 var fileOffset = readOffset(); 614 var fileOffset = readOffset();
617 var fileEndOffset = readOffset(); 615 var fileEndOffset = readOffset();
618 int kindIndex = readByte(); 616 int kindIndex = readByte();
619 var kind = ProcedureKind.values[kindIndex]; 617 var kind = ProcedureKind.values[kindIndex];
620 var flags = readByte(); 618 var flags = readByte();
621 readUInt(); // parent class binary offset.
622 var name = readName(); 619 var name = readName();
623 var fileUri = readUriReference(); 620 var fileUri = readUriReference();
624 var documentationComment = readStringOrNullIfEmpty(); 621 var documentationComment = readStringOrNullIfEmpty();
625 var annotations = readAnnotationList(node); 622 var annotations = readAnnotationList(node);
626 debugPath.add(node.name?.name ?? 'procedure'); 623 debugPath.add(node.name?.name ?? 'procedure');
627 var function = readFunctionNodeOption(); 624 var function = readFunctionNodeOption();
628 var transformerFlags = getAndResetTransformerFlags(); 625 var transformerFlags = getAndResetTransformerFlags();
629 debugPath.removeLast(); 626 debugPath.removeLast();
630 if (shouldWriteData) { 627 if (shouldWriteData) {
631 node.fileOffset = fileOffset; 628 node.fileOffset = fileOffset;
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 ..fileOffset = offset 1276 ..fileOffset = offset
1280 ..fileEqualsOffset = fileEqualsOffset; 1277 ..fileEqualsOffset = fileEqualsOffset;
1281 } 1278 }
1282 1279
1283 int readOffset() { 1280 int readOffset() {
1284 // Offset is saved as unsigned, 1281 // Offset is saved as unsigned,
1285 // but actually ranges from -1 and up (thus the -1) 1282 // but actually ranges from -1 and up (thus the -1)
1286 return readUInt() - 1; 1283 return readUInt() - 1;
1287 } 1284 }
1288 } 1285 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698