V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
refs-map.h
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_REFS_MAP_H_
6
#define V8_COMPILER_REFS_MAP_H_
7
8
#include "src/base/hashmap.h"
9
#include "src/globals.h"
10
#include "src/zone/zone.h"
11
12
namespace
v8
{
13
namespace
internal {
14
namespace
compiler {
15
16
class
ObjectData;
17
18
class
AddressMatcher
:
public
base::KeyEqualityMatcher
<Address> {
19
public
:
20
bool
operator()(
uint32_t
hash1,
uint32_t
hash2,
const
Address
& key1,
21
const
Address
& key2)
const
{
22
return
key1 == key2;
23
}
24
};
25
26
// This class employs our own implementation of hash map for the purpose of
27
// storing the mapping between canonical Addresses and allocated ObjectData.
28
// It's used as the refs map in JSHeapBroker and as the snapshot in
29
// PerIsolateCompilerCache, as we need a cheap copy between the two and
30
// std::unordered_map doesn't satisfy this requirement, as it rehashes the
31
// whole map and copies all entries one by one.
32
class
RefsMap
33
:
public
base::TemplateHashMapImpl
<Address, ObjectData*, AddressMatcher,
34
ZoneAllocationPolicy>,
35
public
ZoneObject
{
36
public
:
37
RefsMap
(
uint32_t
capacity,
AddressMatcher
match,
Zone
* zone);
38
RefsMap
(
const
RefsMap
* other,
Zone
* zone);
39
40
bool
IsEmpty()
const
{
return
occupancy() == 0; }
41
42
// Wrappers around methods from UnderlyingMap
43
Entry
* Lookup(
const
Address
& key)
const
;
44
Entry
* LookupOrInsert(
const
Address
& key,
Zone
* zone);
45
46
private
:
47
static
uint32_t
Hash(
Address
addr);
48
};
49
50
}
// namespace compiler
51
}
// namespace internal
52
}
// namespace v8
53
54
#endif // V8_COMPILER_REFS_MAP_H_
uintptr_t
v8::internal::ZoneObject
Definition:
zone.h:144
v8
Definition:
libplatform.h:13
v8::internal::compiler::AddressMatcher
Definition:
refs-map.h:18
v8::internal::Zone
Definition:
zone.h:42
uint32_t
v8::internal::compiler::RefsMap
Definition:
refs-map.h:32
v8::base::KeyEqualityMatcher
Definition:
hashmap.h:420
v8::base::TemplateHashMapEntry
Definition:
hashmap-entry.h:17
v8::base::TemplateHashMapImpl
Definition:
hashmap.h:28
v8
src
compiler
refs-map.h
Generated on Tue Dec 25 2018 14:38:42 by
1.8.14