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

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

Issue 2767773004: Add Vector type to Kernel (Closed)
Patch Set: Reformat comment with Markdown, throw exception in type propagation Created 3 years, 8 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 return new AwaitExpression(readExpression()); 820 return new AwaitExpression(readExpression());
821 case Tag.FunctionExpression: 821 case Tag.FunctionExpression:
822 return new FunctionExpression(readFunctionNode()); 822 return new FunctionExpression(readFunctionNode());
823 case Tag.Let: 823 case Tag.Let:
824 var variable = readVariableDeclaration(); 824 var variable = readVariableDeclaration();
825 int stackHeight = variableStack.length; 825 int stackHeight = variableStack.length;
826 pushVariableDeclaration(variable); 826 pushVariableDeclaration(variable);
827 var body = readExpression(); 827 var body = readExpression();
828 variableStack.length = stackHeight; 828 variableStack.length = stackHeight;
829 return new Let(variable, body); 829 return new Let(variable, body);
830 case Tag.VectorCreation:
831 var length = readUInt();
832 return new VectorCreation(length);
833 case Tag.VectorGet:
834 var vectorExpression = readExpression();
835 var index = readUInt();
836 return new VectorGet(vectorExpression, index);
837 case Tag.VectorSet:
838 var vectorExpression = readExpression();
839 var index = readUInt();
840 var value = readExpression();
841 return new VectorSet(vectorExpression, index, value);
842 case Tag.VectorCopy:
843 var vectorExpression = readExpression();
844 return new VectorCopy(vectorExpression);
830 default: 845 default:
831 throw fail('Invalid expression tag: $tag'); 846 throw fail('Invalid expression tag: $tag');
832 } 847 }
833 } 848 }
834 849
835 List<MapEntry> readMapEntryList() { 850 List<MapEntry> readMapEntryList() {
836 return new List<MapEntry>.generate(readUInt(), (i) => readMapEntry()); 851 return new List<MapEntry>.generate(readUInt(), (i) => readMapEntry());
837 } 852 }
838 853
839 MapEntry readMapEntry() { 854 MapEntry readMapEntry() {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 return new NamedType(readStringReference(), readDartType()); 1018 return new NamedType(readStringReference(), readDartType());
1004 } 1019 }
1005 1020
1006 DartType readDartTypeOption() { 1021 DartType readDartTypeOption() {
1007 return readAndCheckOptionTag() ? readDartType() : null; 1022 return readAndCheckOptionTag() ? readDartType() : null;
1008 } 1023 }
1009 1024
1010 DartType readDartType() { 1025 DartType readDartType() {
1011 int tag = readByte(); 1026 int tag = readByte();
1012 switch (tag) { 1027 switch (tag) {
1028 case Tag.VectorType:
1029 return const VectorType();
1013 case Tag.BottomType: 1030 case Tag.BottomType:
1014 return const BottomType(); 1031 return const BottomType();
1015 case Tag.InvalidType: 1032 case Tag.InvalidType:
1016 return const InvalidType(); 1033 return const InvalidType();
1017 case Tag.DynamicType: 1034 case Tag.DynamicType:
1018 return const DynamicType(); 1035 return const DynamicType();
1019 case Tag.VoidType: 1036 case Tag.VoidType:
1020 return const VoidType(); 1037 return const VoidType();
1021 case Tag.InterfaceType: 1038 case Tag.InterfaceType:
1022 return new InterfaceType.byReference( 1039 return new InterfaceType.byReference(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 ..fileOffset = offset 1134 ..fileOffset = offset
1118 ..fileEqualsOffset = fileEqualsOffset; 1135 ..fileEqualsOffset = fileEqualsOffset;
1119 } 1136 }
1120 1137
1121 int readOffset() { 1138 int readOffset() {
1122 // Offset is saved as unsigned, 1139 // Offset is saved as unsigned,
1123 // but actually ranges from -1 and up (thus the -1) 1140 // but actually ranges from -1 and up (thus the -1)
1124 return readUInt() - 1; 1141 return readUInt() - 1;
1125 } 1142 }
1126 } 1143 }
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