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

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

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart2js.ir_pickler; 5 part of dart2js.ir_pickler;
6 6
7 class Unpickler { 7 class Unpickler {
8 final Compiler compiler; 8 final Compiler compiler;
9 9
10 final IrConstantPool constantPool; 10 final IrConstantPool constantPool;
(...skipping 10 matching lines...) Expand all
21 /** Counter for entries in [unpickled]. */ 21 /** Counter for entries in [unpickled]. */
22 int index; 22 int index;
23 23
24 /** 24 /**
25 * This buffer is used in [readConstant] to reconstruct a double value from 25 * This buffer is used in [readConstant] to reconstruct a double value from
26 * a sequence of bytes. 26 * a sequence of bytes.
27 */ 27 */
28 ByteData doubleData = new ByteData(8); 28 ByteData doubleData = new ByteData(8);
29 29
30 ConstantSystem get constantSystem => compiler.backend.constantSystem; 30 ConstantSystem get constantSystem => compiler.backend.constantSystem;
31 31
32 // A partially constructed expression is one that has a single 'hole' where 32 // A partially constructed expression is one that has a single 'hole' where
33 // there is an expression missing. Just like the IR builder, the unpickler 33 // there is an expression missing. Just like the IR builder, the unpickler
34 // represents such an expression by its root and by the 'current' expression 34 // represents such an expression by its root and by the 'current' expression
35 // that immediately contains the hole. If there is no hole (e.g., an 35 // that immediately contains the hole. If there is no hole (e.g., an
36 // expression in tail position has been seen), then current is null. 36 // expression in tail position has been seen), then current is null.
37 ir.Expression root; 37 ir.Expression root;
38 ir.Expression current; 38 ir.Expression current;
39 39
40 ir.Function unpickle(List<int> data) { 40 ir.Function unpickle(List<int> data) {
41 this.data = data; 41 this.data = data;
(...skipping 27 matching lines...) Expand all
69 int length = readInt(); 69 int length = readInt();
70 List<int> bytes = new Uint8List(length); 70 List<int> bytes = new Uint8List(length);
71 for (int i = 0; i < length; i++) { 71 for (int i = 0; i < length; i++) {
72 bytes[i] = readByte(); 72 bytes[i] = readByte();
73 } 73 }
74 if (tag == Pickles.STRING_ASCII) { 74 if (tag == Pickles.STRING_ASCII) {
75 return new String.fromCharCodes(bytes); 75 return new String.fromCharCodes(bytes);
76 } else if (tag == Pickles.STRING_UTF8) { 76 } else if (tag == Pickles.STRING_UTF8) {
77 return UTF8.decode(bytes); 77 return UTF8.decode(bytes);
78 } else { 78 } else {
79 compiler.internalError("Unexpected string tag: $tag"); 79 compiler.internalError(NO_LOCATION_SPANNABLE,
80 "Unexpected string tag: $tag");
80 return null; 81 return null;
81 } 82 }
82 } 83 }
83 84
84 Element readElement() { 85 Element readElement() {
85 int elementIndex = readInt(); 86 int elementIndex = readInt();
86 return constantPool.get(elementIndex); 87 return constantPool.get(elementIndex);
87 } 88 }
88 89
89 Selector readSelector() { 90 Selector readSelector() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 break; 136 break;
136 case Pickles.NODE_INVOKE_STATIC: 137 case Pickles.NODE_INVOKE_STATIC:
137 addExpression(readInvokeStaticNode()); 138 addExpression(readInvokeStaticNode());
138 current = null; 139 current = null;
139 break; 140 break;
140 case Pickles.NODE_INVOKE_CONTINUATION: 141 case Pickles.NODE_INVOKE_CONTINUATION:
141 addExpression(readInvokeContinuationNode()); 142 addExpression(readInvokeContinuationNode());
142 current = null; 143 current = null;
143 break; 144 break;
144 default: 145 default:
145 compiler.internalError("Unexpected expression entry tag: $tag"); 146 compiler.internalError(NO_LOCATION_SPANNABLE,
147 "Unexpected expression entry tag: $tag");
146 break; 148 break;
147 } 149 }
148 } 150 }
149 151
150 // Iteratively read expressions until an expression in a tail position 152 // Iteratively read expressions until an expression in a tail position
151 // (e.g., an invocation) is found. Do not change the outer context. 153 // (e.g., an invocation) is found. Do not change the outer context.
152 ir.Expression readDelimitedExpressionNode() { 154 ir.Expression readDelimitedExpressionNode() {
153 ir.Expression previous_root = root; 155 ir.Expression previous_root = root;
154 ir.Expression previous_current = current; 156 ir.Expression previous_current = current;
155 root = current = null; 157 root = current = null;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 double value = doubleData.getFloat64(0, Endianness.BIG_ENDIAN); 226 double value = doubleData.getFloat64(0, Endianness.BIG_ENDIAN);
225 return constantSystem.createDouble(value); 227 return constantSystem.createDouble(value);
226 case Pickles.CONST_STRING_LITERAL: 228 case Pickles.CONST_STRING_LITERAL:
227 case Pickles.CONST_STRING_RAW: 229 case Pickles.CONST_STRING_RAW:
228 case Pickles.CONST_STRING_ESCAPED: 230 case Pickles.CONST_STRING_ESCAPED:
229 case Pickles.CONST_STRING_CONS: 231 case Pickles.CONST_STRING_CONS:
230 return constantSystem.createString(readDartString(tag)); 232 return constantSystem.createString(readDartString(tag));
231 case Pickles.CONST_NULL: 233 case Pickles.CONST_NULL:
232 return constantSystem.createNull(); 234 return constantSystem.createNull();
233 default: 235 default:
234 compiler.internalError("Unexpected constant tag: $tag"); 236 compiler.internalError(NO_LOCATION_SPANNABLE,
237 "Unexpected constant tag: $tag");
235 return null; 238 return null;
236 } 239 }
237 } 240 }
238 241
239 ast.DartString readDartString(int tag) { 242 ast.DartString readDartString(int tag) {
240 switch(tag) { 243 switch(tag) {
241 case Pickles.CONST_STRING_LITERAL: 244 case Pickles.CONST_STRING_LITERAL:
242 return new ast.LiteralDartString(readString()); 245 return new ast.LiteralDartString(readString());
243 case Pickles.CONST_STRING_RAW: 246 case Pickles.CONST_STRING_RAW:
244 return new ast.RawSourceDartString(readString(), readInt()); 247 return new ast.RawSourceDartString(readString(), readInt());
245 case Pickles.CONST_STRING_ESCAPED: 248 case Pickles.CONST_STRING_ESCAPED:
246 return new ast.EscapedSourceDartString(readString(), readInt()); 249 return new ast.EscapedSourceDartString(readString(), readInt());
247 case Pickles.CONST_STRING_CONS: 250 case Pickles.CONST_STRING_CONS:
248 return new ast.ConsDartString( 251 return new ast.ConsDartString(
249 readDartString(readByte()), readDartString(readByte())); 252 readDartString(readByte()), readDartString(readByte()));
250 default: 253 default:
251 compiler.internalError("Unexpected dart string tag: $tag"); 254 compiler.internalError(NO_LOCATION_SPANNABLE,
255 "Unexpected dart string tag: $tag");
252 return null; 256 return null;
253 } 257 }
254 } 258 }
255 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698