V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
lookup-cache.h
1
// Copyright 2016 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_LOOKUP_CACHE_H_
6
#define V8_LOOKUP_CACHE_H_
7
8
#include "src/objects.h"
9
#include "src/objects/map.h"
10
#include "src/objects/name.h"
11
12
namespace
v8
{
13
namespace
internal {
14
15
// Cache for mapping (map, property name) into descriptor index.
16
// The cache contains both positive and negative results.
17
// Descriptor index equals kNotFound means the property is absent.
18
// Cleared at startup and prior to any gc.
19
class
DescriptorLookupCache
{
20
public
:
21
// Lookup descriptor index for (map, name).
22
// If absent, kAbsent is returned.
23
inline
int
Lookup(
Map
source,
Name
name);
24
25
// Update an element in the cache.
26
inline
void
Update(
Map
source,
Name
name,
int
result);
27
28
// Clear the cache.
29
void
Clear();
30
31
static
const
int
kAbsent = -2;
32
33
private
:
34
DescriptorLookupCache
() {
35
for
(
int
i
= 0;
i
< kLength; ++
i
) {
36
keys_[
i
].source =
Map
();
37
keys_[
i
].name =
Name
();
38
results_[
i
] = kAbsent;
39
}
40
}
41
42
static
inline
int
Hash(
Map
source,
Name
name);
43
44
static
const
int
kLength = 64;
45
struct
Key {
46
Map
source;
47
Name
name;
48
};
49
50
Key keys_[kLength];
51
int
results_[kLength];
52
53
friend
class
Isolate
;
54
DISALLOW_COPY_AND_ASSIGN(
DescriptorLookupCache
);
55
};
56
57
}
// namespace internal
58
}
// namespace v8
59
60
#endif // V8_LOOKUP_CACHE_H_
v8::internal
Definition:
v8-internal.h:21
v8
Definition:
libplatform.h:13
v8::internal::Map
Definition:
map.h:178
v8::internal::Name
Definition:
name.h:19
v8::internal::Isolate
Definition:
isolate.h:516
v8::internal::DescriptorLookupCache
Definition:
lookup-cache.h:19
v8
src
lookup-cache.h
Generated on Tue Dec 25 2018 14:39:06 by
1.8.14