d65a60db00
AST "without_change_elapsed_time_ms": 2863, "implementation_change_elapsed_time_ms": 6009, "interface_change_elapsed_time_ms": 5888, "with_coverage_time_ms": 2884 BYTECODE BEFORE "without_change_elapsed_time_ms": 5216, "implementation_change_elapsed_time_ms": 8517, "interface_change_elapsed_time_ms": 8895, "with_coverage_time_ms": 5462 BYTECODE AFTER "without_change_elapsed_time_ms": 3384, "implementation_change_elapsed_time_ms": 8139, "interface_change_elapsed_time_ms": 8073, "with_coverage_time_ms": 3473 Change-Id: Ic8e1c183070cb6019ea48f16c04ea5363df41a97 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119620 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
library vm.metadata.binary_cache;
|
|
|
|
import 'package:kernel/ast.dart'
|
|
show BinarySink, BinarySource, MetadataRepository, Node, TreeNode;
|
|
|
|
class BinaryCacheMetadataRepository extends MetadataRepository<List<int>> {
|
|
static const repositoryTag = 'vm.binary_cache';
|
|
|
|
@override
|
|
String get tag => repositoryTag;
|
|
|
|
@override
|
|
final Map<TreeNode, List<int>> mapping = <TreeNode, List<int>>{};
|
|
|
|
@override
|
|
void writeToBinary(List<int> metadata, Node node, BinarySink sink) {
|
|
sink.writeByteList(metadata);
|
|
}
|
|
|
|
@override
|
|
List<int> readFromBinary(Node node, BinarySource source) {
|
|
List<int> result = source.readByteList();
|
|
_weakMap[node] = result;
|
|
return result;
|
|
}
|
|
|
|
static List<int> lookup(Node node) => _weakMap[node];
|
|
static void insert(Node node, List<int> metadata) {
|
|
_weakMap[node] = metadata;
|
|
}
|
|
|
|
static final _weakMap = new Expando<List<int>>();
|
|
}
|