v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
per-isolate-compiler-cache.h
Go to the documentation of this file.
1
// Copyright 2018 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_COMPILER_PER_ISOLATE_COMPILER_CACHE_H_
6
#define V8_COMPILER_PER_ISOLATE_COMPILER_CACHE_H_
7
8
#include "
src/compiler/refs-map.h
"
9
#include "
src/execution/isolate.h
"
10
11
namespace
v8
{
12
namespace
internal
{
13
14
class
Isolate;
15
class
Zone
;
16
17
namespace
compiler {
18
19
class
ObjectData;
20
21
// This class serves as a container of data that should persist across all
22
// (optimizing) compiler runs in an isolate. For now it stores serialized data
23
// for various common objects such as builtins, so that these objects don't have
24
// to be serialized in each compilation job. See JSHeapBroker::InitializeRefsMap
25
// for details.
26
class
PerIsolateCompilerCache
:
public
ZoneObject
{
27
public
:
28
explicit
PerIsolateCompilerCache
(
Zone
*
zone
)
29
:
zone_
(
zone
),
refs_snapshot_
(nullptr) {}
30
31
bool
HasSnapshot
()
const
{
return
refs_snapshot_
!=
nullptr
; }
32
RefsMap
*
GetSnapshot
() {
33
DCHECK
(
HasSnapshot
());
34
return
refs_snapshot_
;
35
}
36
void
SetSnapshot
(
RefsMap
* refs) {
37
DCHECK
(!
HasSnapshot
());
38
DCHECK
(!refs->
IsEmpty
());
39
refs_snapshot_
=
zone_
->
New
<
RefsMap
>(refs,
zone_
);
40
DCHECK
(
HasSnapshot
());
41
}
42
43
Zone
*
zone
()
const
{
return
zone_
; }
44
45
static
void
Setup
(
Isolate
* isolate) {
46
if
(isolate->compiler_cache() ==
nullptr
) {
47
Zone
*
zone
=
new
Zone
(isolate->allocator(),
"Compiler zone"
);
48
PerIsolateCompilerCache
* cache =
zone
->
New
<
PerIsolateCompilerCache
>(
zone
);
49
isolate->set_compiler_utils(cache,
zone
);
50
}
51
DCHECK_NOT_NULL
(isolate->compiler_cache());
52
}
53
54
private
:
55
Zone
*
const
zone_
;
56
RefsMap
*
refs_snapshot_
;
57
};
58
59
}
// namespace compiler
60
}
// namespace internal
61
}
// namespace v8
62
63
#endif
// V8_COMPILER_PER_ISOLATE_COMPILER_CACHE_H_
Zone
friend Zone
Definition
asm-types.cc:195
v8::internal::Isolate
Definition
isolate.h:586
v8::internal::ZoneObject
Definition
zone.h:326
v8::internal::Zone
Definition
zone.h:43
v8::internal::Zone::New
T * New(Args &&... args)
Definition
zone.h:114
v8::internal::compiler::PerIsolateCompilerCache
Definition
per-isolate-compiler-cache.h:26
v8::internal::compiler::PerIsolateCompilerCache::SetSnapshot
void SetSnapshot(RefsMap *refs)
Definition
per-isolate-compiler-cache.h:36
v8::internal::compiler::PerIsolateCompilerCache::Setup
static void Setup(Isolate *isolate)
Definition
per-isolate-compiler-cache.h:45
v8::internal::compiler::PerIsolateCompilerCache::GetSnapshot
RefsMap * GetSnapshot()
Definition
per-isolate-compiler-cache.h:32
v8::internal::compiler::PerIsolateCompilerCache::PerIsolateCompilerCache
PerIsolateCompilerCache(Zone *zone)
Definition
per-isolate-compiler-cache.h:28
v8::internal::compiler::PerIsolateCompilerCache::HasSnapshot
bool HasSnapshot() const
Definition
per-isolate-compiler-cache.h:31
v8::internal::compiler::PerIsolateCompilerCache::zone
Zone * zone() const
Definition
per-isolate-compiler-cache.h:43
v8::internal::compiler::PerIsolateCompilerCache::zone_
Zone *const zone_
Definition
per-isolate-compiler-cache.h:55
v8::internal::compiler::PerIsolateCompilerCache::refs_snapshot_
RefsMap * refs_snapshot_
Definition
per-isolate-compiler-cache.h:56
v8::internal::compiler::RefsMap
Definition
refs-map.h:34
v8::internal::compiler::RefsMap::IsEmpty
bool IsEmpty() const
Definition
refs-map.h:39
isolate.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
refs-map.h
DCHECK_NOT_NULL
#define DCHECK_NOT_NULL(val)
Definition
logging.h:492
DCHECK
#define DCHECK(condition)
Definition
logging.h:482
src
compiler
per-isolate-compiler-cache.h
Generated on Sun Apr 6 2025 21:08:52 for v8 by
1.12.0