v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
index-generator.h
Go to the documentation of this file.
1// Copyright 2020 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_HEAP_INDEX_GENERATOR_H_
6#define V8_HEAP_INDEX_GENERATOR_H_
7
8#include <cstddef>
9#include <optional>
10#include <queue>
11
12#include "src/base/macros.h"
14
15namespace v8 {
16namespace internal {
17
18// A thread-safe data structure that generates heuristic starting points in a
19// range to process items in parallel.
21 public:
22 explicit IndexGenerator(size_t size);
25
26 std::optional<size_t> GetNext();
27
28 private:
31 // Pending [start, end) ranges to split and hand out indices from.
32 std::queue<std::pair<size_t, size_t>> ranges_to_split_;
33};
34
35} // namespace internal
36} // namespace v8
37
38#endif // V8_HEAP_INDEX_GENERATOR_H_
IndexGenerator(const IndexGenerator &)=delete
IndexGenerator & operator=(const IndexGenerator &)=delete
std::queue< std::pair< size_t, size_t > > ranges_to_split_
#define V8_EXPORT_PRIVATE
Definition macros.h:460