v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bit-vector.cc
Go to the documentation of this file.
1
// Copyright 2010 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
#include "
src/utils/bit-vector.h
"
6
7
#include <numeric>
8
9
#include "
src/base/bits.h
"
10
#include "
src/utils/utils.h
"
11
12
namespace
v8
{
13
namespace
internal
{
14
15
#ifdef DEBUG
16
void
BitVector::Print()
const
{
17
bool
first =
true
;
18
PrintF
(
"{"
);
19
for
(
int
i
= 0;
i
<
length
();
i
++) {
20
if
(
Contains
(
i
)) {
21
if
(!first)
PrintF
(
","
);
22
first =
false
;
23
PrintF
(
"%d"
,
i
);
24
}
25
}
26
PrintF
(
"}\n"
);
27
}
28
#endif
29
30
int
BitVector::Count
()
const
{
31
auto
accumulate_popcnt = [](
int
cnt, uintptr_t
word
) ->
int
{
32
return
cnt +
base::bits::CountPopulation
(
word
);
33
};
34
return
std::accumulate(
data_begin_
,
data_end_
, 0, accumulate_popcnt);
35
}
36
37
}
// namespace internal
38
}
// namespace v8
bit-vector.h
bits.h
v8::internal::BitVector::Count
int Count() const
Definition
bit-vector.cc:30
v8::internal::BitVector::length
int length() const
Definition
bit-vector.h:257
v8::internal::BitVector::data_end_
uintptr_t * data_end_
Definition
bit-vector.h:289
v8::internal::BitVector::Contains
bool Contains(int i) const
Definition
bit-vector.h:180
v8::internal::BitVector::word
static V8_INLINE int word(int index)
Definition
bit-vector.h:278
v8::internal::BitVector::data_begin_
uintptr_t * data_begin_
Definition
bit-vector.h:288
v8::base::bits::CountPopulation
constexpr unsigned CountPopulation(T value)
Definition
bits.h:26
v8::internal
Definition
api-arguments-inl.h:20
v8::internal::PrintF
void PrintF(const char *format,...)
Definition
utils.cc:39
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
utils.h
src
utils
bit-vector.cc
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0