| Index: pkg/analyzer/lib/src/generated/utilities_general.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/utilities_general.dart b/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| index 158a3cc82afddc769ab2a23550a2374d15236cd7..1ae55e6a1d3abb57865e79f728e6c8197c895f29 100644
|
| --- a/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| +++ b/pkg/analyzer/lib/src/generated/utilities_general.dart
|
| @@ -10,16 +10,38 @@ library engine.utilities.general;
|
| import 'dart:profiler';
|
|
|
| /**
|
| + * Jenkins hash function, optimized for small integers.
|
| + * Borrowed from sdk/lib/math/jenkins_smi_hash.dart.
|
| + */
|
| +class JenkinsSmiHash {
|
| + static int combine(int hash, int value) {
|
| + hash = 0x1fffffff & (hash + value);
|
| + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
| + return hash ^ (hash >> 6);
|
| + }
|
| +
|
| + static int finish(int hash) {
|
| + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
| + hash = hash ^ (hash >> 11);
|
| + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
| + }
|
| +
|
| + static int hash2(a, b) => finish(combine(combine(0, a), b));
|
| +
|
| + static int hash4(a, b, c, d) =>
|
| + finish(combine(combine(combine(combine(0, a), b), c), d));
|
| +}
|
| +
|
| +/**
|
| * Helper class for gathering performance statistics. This class is modeled on
|
| * the UserTag class in dart:profiler so that it can interoperate easily with
|
| * it.
|
| */
|
| abstract class PerformanceTag {
|
| /**
|
| - * Return the [PerformanceTag] that is initially current. This is intended
|
| - * to track time when the system is performing unknown operations.
|
| + * Return a list of all [PerformanceTag]s which have been created.
|
| */
|
| - static PerformanceTag get UNKNOWN => _PerformanceTagImpl.UNKNOWN;
|
| + static List<PerformanceTag> get all => _PerformanceTagImpl.all.toList();
|
|
|
| /**
|
| * Return the current [PerformanceTag] for the isolate.
|
| @@ -27,6 +49,12 @@ abstract class PerformanceTag {
|
| static PerformanceTag get current => _PerformanceTagImpl.current;
|
|
|
| /**
|
| + * Return the [PerformanceTag] that is initially current. This is intended
|
| + * to track time when the system is performing unknown operations.
|
| + */
|
| + static PerformanceTag get UNKNOWN => _PerformanceTagImpl.UNKNOWN;
|
| +
|
| + /**
|
| * Create a [PerformanceTag] having the given [label]. A [UserTag] will also
|
| * be created, having the same [label], so that performance information can
|
| * be queried using the observatory.
|
| @@ -34,16 +62,6 @@ abstract class PerformanceTag {
|
| factory PerformanceTag(String label) = _PerformanceTagImpl;
|
|
|
| /**
|
| - * Return the label for this [PerformanceTag].
|
| - */
|
| - String get label;
|
| -
|
| - /**
|
| - * Return a list of all [PerformanceTag]s which have been created.
|
| - */
|
| - static List<PerformanceTag> get all => _PerformanceTagImpl.all.toList();
|
| -
|
| - /**
|
| * Return the total number of milliseconds that this [PerformanceTag] has
|
| * been the current [PerformanceTag] for the isolate.
|
| *
|
| @@ -52,6 +70,11 @@ abstract class PerformanceTag {
|
| int get elapsedMs;
|
|
|
| /**
|
| + * Return the label for this [PerformanceTag].
|
| + */
|
| + String get label;
|
| +
|
| + /**
|
| * Make this the current tag for the isolate, and return the previous tag.
|
| */
|
| PerformanceTag makeCurrent();
|
| @@ -79,9 +102,6 @@ class _PerformanceTagImpl implements PerformanceTag {
|
| */
|
| static List<_PerformanceTagImpl> all = <_PerformanceTagImpl>[];
|
|
|
| - @override
|
| - String get label => userTag.label;
|
| -
|
| /**
|
| * The [UserTag] associated with this [PerformanceTag].
|
| */
|
| @@ -99,6 +119,12 @@ class _PerformanceTagImpl implements PerformanceTag {
|
| }
|
|
|
| @override
|
| + int get elapsedMs => stopwatch.elapsedMilliseconds;
|
| +
|
| + @override
|
| + String get label => userTag.label;
|
| +
|
| + @override
|
| PerformanceTag makeCurrent() {
|
| if (identical(this, current)) {
|
| return current;
|
| @@ -110,7 +136,4 @@ class _PerformanceTagImpl implements PerformanceTag {
|
| userTag.makeCurrent();
|
| return previous;
|
| }
|
| -
|
| - @override
|
| - int get elapsedMs => stopwatch.elapsedMilliseconds;
|
| }
|
|
|