V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
constants-table-builder.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_BUILTINS_CONSTANTS_TABLE_BUILDER_H_
6
#define V8_BUILTINS_CONSTANTS_TABLE_BUILDER_H_
7
8
#include "src/allocation.h"
9
#include "src/base/macros.h"
10
#include "src/handles.h"
11
#include "src/identity-map.h"
12
13
namespace
v8
{
14
namespace
internal {
15
16
class
Isolate;
17
class
Object;
18
19
// Utility class to build the builtins constants table and store it on the root
20
// list. The constants table contains constants used by builtins, and is there
21
// to avoid directly embedding them into code objects, which would not be
22
// possible for off-heap (and thus immutable) code objects.
23
class
BuiltinsConstantsTableBuilder
final {
24
public
:
25
explicit
BuiltinsConstantsTableBuilder
(
Isolate
* isolate);
26
27
// Returns the index within the builtins constants table for the given
28
// object, possibly adding the object to the table. Objects are deduplicated.
29
uint32_t
AddObject(
Handle<Object>
object
);
30
31
// Self-references during code generation start out by referencing a handle
32
// with a temporary dummy object. Once the final Code object exists, such
33
// entries in the constants map must be patched up.
34
void
PatchSelfReference(
Handle<Object>
self_reference,
35
Handle<Code>
code_object);
36
37
// Should be called after all affected code (e.g. builtins and bytecode
38
// handlers) has been generated.
39
void
Finalize();
40
41
private
:
42
Isolate
* isolate_;
43
44
// Maps objects to corresponding indices within the constants list.
45
typedef
IdentityMap<uint32_t, FreeStoreAllocationPolicy>
ConstantsMap
;
46
ConstantsMap
map_;
47
48
DISALLOW_COPY_AND_ASSIGN(
BuiltinsConstantsTableBuilder
)
49
};
50
51
}
// namespace internal
52
}
// namespace v8
53
54
#endif // V8_BUILTINS_CONSTANTS_TABLE_BUILDER_H_
v8::internal::BuiltinsConstantsTableBuilder
Definition:
constants-table-builder.h:23
v8
Definition:
libplatform.h:13
v8::internal::Handle< Object >
v8::internal::IdentityMap< uint32_t, FreeStoreAllocationPolicy >
v8::internal::Isolate
Definition:
isolate.h:516
uint32_t
v8
src
builtins
constants-table-builder.h
Generated on Tue Dec 25 2018 14:38:21 by
1.8.14