From 2a130ff363e034c8f214521cd14d4fee1a59b397 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Mon, 31 May 2021 10:25:22 +0000 Subject: [PATCH] [vm] Remove dead code LinkedHashMap RTEs These natives are implemented in kernel_to_il.cc. Now that the bytecode interpreter has been removed, the RTEs are dead code. TEST=test/language includes many tests with Map. Change-Id: I42bb49434f4be0b0a881353f2f24816bfda7a3ed Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-simarm64c-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201820 Commit-Queue: Daco Harkes Reviewed-by: Aske Simon Christensen --- runtime/lib/collection_sources.gni | 5 -- runtime/lib/linked_hash_map.cc | 86 ------------------------------ runtime/vm/BUILD.gn | 12 ++--- runtime/vm/bootstrap_natives.h | 10 ---- 4 files changed, 5 insertions(+), 108 deletions(-) delete mode 100644 runtime/lib/collection_sources.gni delete mode 100644 runtime/lib/linked_hash_map.cc diff --git a/runtime/lib/collection_sources.gni b/runtime/lib/collection_sources.gni deleted file mode 100644 index 6a81dd3861d..00000000000 --- a/runtime/lib/collection_sources.gni +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2017, 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. - -collection_runtime_cc_files = [ "linked_hash_map.cc" ] diff --git a/runtime/lib/linked_hash_map.cc b/runtime/lib/linked_hash_map.cc deleted file mode 100644 index 89ad2bb9371..00000000000 --- a/runtime/lib/linked_hash_map.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014, 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. - -#include "platform/assert.h" - -#include "vm/bootstrap_natives.h" -#include "vm/exceptions.h" -#include "vm/flags.h" -#include "vm/native_entry.h" -#include "vm/object.h" - -namespace dart { - -DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 0, 1) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - return map.index(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 0, 2) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - const TypedData& index = - TypedData::CheckedHandle(zone, arguments->NativeArgAt(1)); - map.SetIndex(index); - return Object::null(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 0, 1) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - return map.data(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 0, 2) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - const Array& data = Array::CheckedHandle(zone, arguments->NativeArgAt(1)); - map.SetData(data); - return Object::null(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 0, 1) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - return map.hash_mask(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 0, 2) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - const Smi& hashMask = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); - map.SetHashMask(hashMask.Value()); - return Object::null(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 0, 1) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - return map.deleted_keys(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 0, 2) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - const Smi& deletedKeys = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); - map.SetDeletedKeys(deletedKeys.Value()); - return Object::null(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 0, 1) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - return map.used_data(); -} - -DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 0, 2) { - const LinkedHashMap& map = - LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); - const Smi& usedData = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); - map.SetUsedData(usedData.Value()); - return Object::null(); -} - -} // namespace dart diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn index 49c403602b6..55db0a799ef 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -21,7 +21,6 @@ import("../bin/cli_sources.gni") import("../bin/io_sources.gni") import("../configs.gni") import("../lib/async_sources.gni") -import("../lib/collection_sources.gni") import("../lib/convert_sources.gni") import("../lib/core_sources.gni") import("../lib/developer_sources.gni") @@ -147,12 +146,11 @@ library_for_all_configs("libdart_lib") { } } include_dirs = [ ".." ] - allsources = async_runtime_cc_files + collection_runtime_cc_files + - core_runtime_cc_files + developer_runtime_cc_files + - internal_runtime_cc_files + isolate_runtime_cc_files + - math_runtime_cc_files + mirrors_runtime_cc_files + - typed_data_runtime_cc_files + vmservice_runtime_cc_files + - ffi_runtime_cc_files + allsources = async_runtime_cc_files + core_runtime_cc_files + + developer_runtime_cc_files + internal_runtime_cc_files + + isolate_runtime_cc_files + math_runtime_cc_files + + mirrors_runtime_cc_files + typed_data_runtime_cc_files + + vmservice_runtime_cc_files + ffi_runtime_cc_files sources = [ "bootstrap.cc" ] + rebase_path(allsources, ".", "../lib") snapshot_sources = [] } diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h index 586c58a61e8..5965209dca6 100644 --- a/runtime/vm/bootstrap_natives.h +++ b/runtime/vm/bootstrap_natives.h @@ -348,16 +348,6 @@ namespace dart { V(Internal_writeIntoTwoByteString, 3) \ V(InvocationMirror_unpackTypeArguments, 2) \ V(NoSuchMethodError_existingMethodSignature, 3) \ - V(LinkedHashMap_getIndex, 1) \ - V(LinkedHashMap_setIndex, 2) \ - V(LinkedHashMap_getData, 1) \ - V(LinkedHashMap_setData, 2) \ - V(LinkedHashMap_getHashMask, 1) \ - V(LinkedHashMap_setHashMask, 2) \ - V(LinkedHashMap_getUsedData, 1) \ - V(LinkedHashMap_setUsedData, 2) \ - V(LinkedHashMap_getDeletedKeys, 1) \ - V(LinkedHashMap_setDeletedKeys, 2) \ V(WeakProperty_getKey, 1) \ V(WeakProperty_setKey, 2) \ V(WeakProperty_getValue, 1) \