v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
perfetto-utils.cc
Go to the documentation of this file.
1
// Copyright 2024 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/tracing/perfetto-utils.h
"
6
7
#include "
include/v8config.h
"
8
#include "
src/objects/string-inl.h
"
9
#include "
src/objects/string.h
"
10
#include "
src/objects/tagged.h
"
11
12
namespace
v8
{
13
namespace
internal
{
14
15
PerfettoV8String::PerfettoV8String
(
Tagged<String>
string
)
16
: is_one_byte_(string->IsOneByteRepresentation()),
size_
(0) {
17
if
(string->length() <= 0) {
18
return;
19
}
20
size_
=
static_cast<
size_t
>
(string->length()) *
21
(string->IsOneByteRepresentation() ?
sizeof
(uint8_t)
22
:
sizeof
(
base::uc16
));
23
buffer_
.reset(
new
uint8_t[
size_
]);
24
if (
is_one_byte_
) {
25
String::WriteToFlat
(
string
,
buffer_
.get(), 0, string->length());
26
}
else
{
27
String::WriteToFlat
(
string
,
reinterpret_cast<
base::uc16
*
>
(
buffer_
.get()), 0,
28
string->length());
29
}
30
}
31
32
}
// namespace internal
33
}
// namespace v8
v8::internal::PerfettoV8String::PerfettoV8String
PerfettoV8String(Tagged< String > string)
Definition
perfetto-utils.cc:15
v8::internal::PerfettoV8String::size_
size_t size_
Definition
perfetto-utils.h:65
v8::internal::PerfettoV8String::buffer_
std::unique_ptr< uint8_t[]> buffer_
Definition
perfetto-utils.h:66
v8::internal::PerfettoV8String::is_one_byte_
bool is_one_byte_
Definition
perfetto-utils.h:64
v8::internal::String::WriteToFlat
static void WriteToFlat(Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length)
Definition
string.cc:772
v8::internal::Tagged
Definition
waiter-queue-node.h:21
size_
const int size_
Definition
assembler.cc:132
v8::base::uc16
uint16_t uc16
Definition
strings.h:18
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
perfetto-utils.h
string-inl.h
string.h
tagged.h
v8config.h
src
tracing
perfetto-utils.cc
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0