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
"
13
#include "
src/base/platform/mutex.h
"
14
15
namespace
v8
{
16
namespace
internal
{
17
18
// A thread-safe data structure that generates heuristic starting points in a
19
// range to process items in parallel.
20
class
V8_EXPORT_PRIVATE
IndexGenerator
{
21
public
:
22
explicit
IndexGenerator
(
size_t
size);
23
IndexGenerator
(
const
IndexGenerator
&) =
delete
;
24
IndexGenerator
&
operator=
(
const
IndexGenerator
&) =
delete
;
25
26
std::optional<size_t> GetNext();
27
28
private
:
29
base::Mutex
lock_
;
30
bool
first_use_
;
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_
v8::base::Mutex
Definition
mutex.h:36
v8::internal::IndexGenerator
Definition
index-generator.h:20
v8::internal::IndexGenerator::lock_
base::Mutex lock_
Definition
index-generator.h:29
v8::internal::IndexGenerator::first_use_
bool first_use_
Definition
index-generator.h:30
v8::internal::IndexGenerator::IndexGenerator
IndexGenerator(const IndexGenerator &)=delete
v8::internal::IndexGenerator::operator=
IndexGenerator & operator=(const IndexGenerator &)=delete
v8::internal::IndexGenerator::ranges_to_split_
std::queue< std::pair< size_t, size_t > > ranges_to_split_
Definition
index-generator.h:32
mutex.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
macros.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
src
heap
index-generator.h
Generated on Sun Apr 6 2025 21:08:54 for v8 by
1.12.0