LCOV - code coverage report
Current view: top level - src/zone - zone-splay-tree.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2019-04-17 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2019 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_ZONE_ZONE_SPLAY_TREE_H_
       6             : #define V8_ZONE_ZONE_SPLAY_TREE_H_
       7             : 
       8             : #include "src/splay-tree.h"
       9             : #include "src/zone/zone.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14             : // A zone splay tree.  The config type parameter encapsulates the
      15             : // different configurations of a concrete splay tree (see splay-tree.h).
      16             : // The tree itself and all its elements are allocated in the Zone.
      17             : template <typename Config>
      18             : class ZoneSplayTree final : public SplayTree<Config, ZoneAllocationPolicy> {
      19             :  public:
      20             :   explicit ZoneSplayTree(Zone* zone)
      21             :       : SplayTree<Config, ZoneAllocationPolicy>(ZoneAllocationPolicy(zone)) {}
      22             :   ~ZoneSplayTree() {
      23             :     // Reset the root to avoid unneeded iteration over all tree nodes
      24             :     // in the destructor.  For a zone-allocated tree, nodes will be
      25             :     // freed by the Zone.
      26             :     SplayTree<Config, ZoneAllocationPolicy>::ResetRoot();
      27        2652 :   }
      28             : 
      29             :   void* operator new(size_t size, Zone* zone) { return zone->New(size); }
      30             : 
      31             :   void operator delete(void* pointer) { UNREACHABLE(); }
      32             :   void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); }
      33             : };
      34             : 
      35             : }  // namespace internal
      36             : }  // namespace v8
      37             : 
      38             : #endif  // V8_ZONE_ZONE_SPLAY_TREE_H_

Generated by: LCOV version 1.10