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

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: Created 5 years, 7 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
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 '../dart2jslib.dart' show assertDebugMode, Compiler; 8 import '../dart2jslib.dart' show assertDebugMode, Compiler;
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart' show 10 import '../elements/elements.dart' show
(...skipping 10 matching lines...) Expand all
21 21
22 enum ConstantExpressionKind { 22 enum ConstantExpressionKind {
23 BINARY, 23 BINARY,
24 BOOL, 24 BOOL,
25 BOOL_FROM_ENVIRONMENT, 25 BOOL_FROM_ENVIRONMENT,
26 CONCATENATE, 26 CONCATENATE,
27 CONDITIONAL, 27 CONDITIONAL,
28 CONSTRUCTED, 28 CONSTRUCTED,
29 DEFERRED, 29 DEFERRED,
30 DOUBLE, 30 DOUBLE,
31 DUMMY,
31 ERRONEOUS, 32 ERRONEOUS,
32 FUNCTION, 33 FUNCTION,
33 IDENTICAL, 34 IDENTICAL,
34 INT, 35 INT,
35 INT_FROM_ENVIRONMENT, 36 INT_FROM_ENVIRONMENT,
36 LIST, 37 LIST,
37 MAP, 38 MAP,
38 NULL, 39 NULL,
39 STRING, 40 STRING,
40 STRING_FROM_ENVIRONMENT, 41 STRING_FROM_ENVIRONMENT,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return value; 329 return value;
329 } 330 }
330 331
331 @override 332 @override
332 int _computeHashCode() => 13; 333 int _computeHashCode() => 13;
333 334
334 @override 335 @override
335 bool _equals(ErroneousConstantExpression other) => true; 336 bool _equals(ErroneousConstantExpression other) => true;
336 } 337 }
337 338
339 class DummyConstantExpression extends ConstantExpression {
Johnni Winther 2015/05/28 12:07:17 Add a TODO for me to see if we can avoid the need
herhut 2015/06/01 12:09:41 Done.
340 final DummyConstantValue value;
341
342 DummyConstantExpression(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(BoolConstantExpression other) {
359 return value == other.value;
360 }
361
362 ConstantExpressionKind get kind => ConstantExpressionKind.DUMMY;
363 }
364
365
366
338 /// A boolean, int, double, string, or null constant. 367 /// A boolean, int, double, string, or null constant.
339 abstract class PrimitiveConstantExpression extends ConstantExpression { 368 abstract class PrimitiveConstantExpression extends ConstantExpression {
340 final PrimitiveConstantValue value; 369 final PrimitiveConstantValue value;
341 370
342 PrimitiveConstantExpression(this.value); 371 PrimitiveConstantExpression(this.value);
343 372
344 /// The primitive value of this contant expression. 373 /// The primitive value of this contant expression.
345 get primitiveValue; 374 get primitiveValue;
346 } 375 }
347 376
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 @override 1604 @override
1576 void visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp, 1605 void visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp,
1577 [_]) { 1606 [_]) {
1578 sb.write('const String.fromEnvironment("${exp.name}", defaultValue: '); 1607 sb.write('const String.fromEnvironment("${exp.name}", defaultValue: ');
1579 visit(exp.defaultValue); 1608 visit(exp.defaultValue);
1580 sb.write(')'); 1609 sb.write(')');
1581 } 1610 }
1582 1611
1583 String toString() => sb.toString(); 1612 String toString() => sb.toString();
1584 } 1613 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/constants/values.dart » ('j') | pkg/compiler/lib/src/constants/values.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698