Files
sdk/runtime/vm/splay-tree.h
Ryan Macnak 737888b223 [vm] Make Dart Zones more similar to V8 Zones.
This eases the porting of Irregexp.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/56573
Change-Id: If31a0585ced3eabaf2dac6af04f83d387a8eab5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478080
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-04 10:16:41 -08:00

33 lines
1.1 KiB
C++

// 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.
#ifndef RUNTIME_VM_SPLAY_TREE_H_
#define RUNTIME_VM_SPLAY_TREE_H_
#include "platform/splay-tree.h"
#include "vm/zone.h"
namespace dart {
// A zone splay tree. The config type parameter encapsulates the
// different configurations of a concrete splay tree (see
// platform/splay-tree.h). The tree itself and all its elements are allocated
// in the Zone.
template <typename Config>
class ZoneSplayTree final : public SplayTree<Config, ZoneObject, Zone> {
public:
explicit ZoneSplayTree(Zone* zone)
: SplayTree<Config, ZoneObject, Zone>(ASSERT_NOTNULL(zone)) {}
~ZoneSplayTree() {
// Reset the root to avoid unneeded iteration over all tree nodes
// in the destructor. For a zone-allocated tree, nodes will be
// freed by the Zone.
SplayTree<Config, ZoneObject, Zone>::ResetRoot();
}
};
} // namespace dart
#endif // RUNTIME_VM_SPLAY_TREE_H_