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

Side by Side Diff: pkg/compiler/lib/src/constants/expressions.dart

Issue 1153243003: dart2js: Use frequency of occurence to sort metadata indices. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Addressed sra's comments Created 5 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 | « no previous file | pkg/compiler/lib/src/constants/values.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.constants.expressions; 5 library dart2js.constants.expressions;
6 6
7 import '../constants/constant_system.dart'; 7 import '../constants/constant_system.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../dart2jslib.dart' show assertDebugMode, Compiler; 9 import '../dart2jslib.dart' show assertDebugMode, Compiler;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 23 matching lines...) Expand all
34 IDENTICAL, 34 IDENTICAL,
35 INT, 35 INT,
36 INT_FROM_ENVIRONMENT, 36 INT_FROM_ENVIRONMENT,
37 LIST, 37 LIST,
38 MAP, 38 MAP,
39 NULL, 39 NULL,
40 STRING, 40 STRING,
41 STRING_FROM_ENVIRONMENT, 41 STRING_FROM_ENVIRONMENT,
42 STRING_LENGTH, 42 STRING_LENGTH,
43 SYMBOL, 43 SYMBOL,
44 SYNTHETIC,
44 TYPE, 45 TYPE,
45 UNARY, 46 UNARY,
46 VARIABLE, 47 VARIABLE,
47 48
48 POSITIONAL_REFERENCE, 49 POSITIONAL_REFERENCE,
49 NAMED_REFERENCE, 50 NAMED_REFERENCE,
50 } 51 }
51 52
52 /// Environment used for evaluating constant expressions. 53 /// Environment used for evaluating constant expressions.
53 abstract class Environment { 54 abstract class Environment {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return new NonConstantValue(); 328 return new NonConstantValue();
328 } 329 }
329 330
330 @override 331 @override
331 int _computeHashCode() => 13; 332 int _computeHashCode() => 13;
332 333
333 @override 334 @override
334 bool _equals(ErroneousConstantExpression other) => true; 335 bool _equals(ErroneousConstantExpression other) => true;
335 } 336 }
336 337
338 // TODO(johnniwinther): Avoid the need for this class.
339 class SyntheticConstantExpression extends ConstantExpression {
340 final SyntheticConstantValue value;
341
342 SyntheticConstantExpression(this.value);
343
344 @override
345 ConstantValue evaluate(Environment environment,
346 ConstantSystem constantSystem) {
347 return value;
348 }
349
350 @override
351 int _computeHashCode() => 13 * value.hashCode;
352
353 accept(ConstantExpressionVisitor visitor, [context]) {
354 throw "unsupported";
355 }
356
357 @override
358 bool _equals(SyntheticConstantExpression other) {
359 return value == other.value;
360 }
361
362 ConstantExpressionKind get kind => ConstantExpressionKind.SYNTHETIC;
363 }
364
365
366
337 /// A boolean, int, double, string, or null constant. 367 /// A boolean, int, double, string, or null constant.
338 abstract class PrimitiveConstantExpression extends ConstantExpression { 368 abstract class PrimitiveConstantExpression extends ConstantExpression {
339 /// The primitive value of this contant expression. 369 /// The primitive value of this contant expression.
340 get primitiveValue; 370 get primitiveValue;
341 } 371 }
342 372
343 /// Boolean literal constant. 373 /// Boolean literal constant.
344 class BoolConstantExpression extends PrimitiveConstantExpression { 374 class BoolConstantExpression extends PrimitiveConstantExpression {
345 final bool primitiveValue; 375 final bool primitiveValue;
346 376
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 visit(exp.name); 1804 visit(exp.name);
1775 if (exp.defaultValue != null) { 1805 if (exp.defaultValue != null) {
1776 sb.write(', defaultValue: '); 1806 sb.write(', defaultValue: ');
1777 visit(exp.defaultValue); 1807 visit(exp.defaultValue);
1778 } 1808 }
1779 sb.write(')'); 1809 sb.write(')');
1780 } 1810 }
1781 1811
1782 String toString() => sb.toString(); 1812 String toString() => sb.toString();
1783 } 1813 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/values.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698