v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
builtins-constructor.h
Go to the documentation of this file.
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_BUILTINS_BUILTINS_CONSTRUCTOR_H_
6
#define V8_BUILTINS_BUILTINS_CONSTRUCTOR_H_
7
8
#include "
src/objects/contexts.h
"
9
#include "
src/objects/dictionary.h
"
10
#include "
src/objects/js-array.h
"
11
#include "
src/objects/objects.h
"
12
13
namespace
v8
{
14
namespace
internal
{
15
16
class
ConstructorBuiltins
{
17
public
:
18
static
int
MaximumFunctionContextSlots
() {
19
return
v8_flags
.test_small_max_function_context_stub_size
20
?
kSmallMaximumSlots
21
:
kMaximumSlots
;
22
}
23
24
// Maximum number of elements in copied array (chosen so that even an array
25
// backed by a double backing store will fit into new-space).
26
static
const
int
kMaximumClonedShallowArrayElements
=
27
JSArray::kInitialMaxFastElementArray
;
28
// Maximum number of properties in copied object so that the properties store
29
// will fit into new-space. This constant is based on the assumption that
30
// NameDictionaries are 50% over-allocated.
31
static
const
int
kMaximumClonedShallowObjectProperties
=
32
NameDictionary::kMaxRegularCapacity / 3 * 2;
33
34
private
:
35
static
const
int
kMaximumSlots
=
36
(
kMaxRegularHeapObjectSize
-
Context::kTodoHeaderSize
) /
kTaggedSize
- 1;
37
static
const
int
kSmallMaximumSlots
= 10;
38
39
// FastNewFunctionContext can only allocate closures which fit in the
40
// new space.
41
static_assert
(
Context::SizeFor
(
kMaximumSlots
+
Context::MIN_CONTEXT_SLOTS
) <
42
kMaxRegularHeapObjectSize
);
43
};
44
45
}
// namespace internal
46
}
// namespace v8
47
48
#endif
// V8_BUILTINS_BUILTINS_CONSTRUCTOR_H_
v8::internal::ConstructorBuiltins
Definition
builtins-constructor.h:16
v8::internal::ConstructorBuiltins::kMaximumClonedShallowArrayElements
static const int kMaximumClonedShallowArrayElements
Definition
builtins-constructor.h:26
v8::internal::ConstructorBuiltins::MaximumFunctionContextSlots
static int MaximumFunctionContextSlots()
Definition
builtins-constructor.h:18
v8::internal::ConstructorBuiltins::kMaximumSlots
static const int kMaximumSlots
Definition
builtins-constructor.h:35
v8::internal::ConstructorBuiltins::kSmallMaximumSlots
static const int kSmallMaximumSlots
Definition
builtins-constructor.h:37
v8::internal::ConstructorBuiltins::kMaximumClonedShallowObjectProperties
static const int kMaximumClonedShallowObjectProperties
Definition
builtins-constructor.h:31
v8::internal::Context::SizeFor
static V8_INLINE constexpr int SizeFor(int length)
Definition
contexts.h:503
v8::internal::Context::MIN_CONTEXT_SLOTS
@ MIN_CONTEXT_SLOTS
Definition
contexts.h:551
v8::internal::Context::kTodoHeaderSize
static const int kTodoHeaderSize
Definition
contexts.h:497
v8::internal::JSArray::kInitialMaxFastElementArray
static const int kInitialMaxFastElementArray
Definition
js-array.h:144
contexts.h
dictionary.h
js-array.h
v8::internal::kTaggedSize
constexpr int kTaggedSize
Definition
globals.h:542
v8::internal::kMaxRegularHeapObjectSize
constexpr int kMaxRegularHeapObjectSize
Definition
globals.h:680
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::v8_flags
V8_EXPORT_PRIVATE FlagValues v8_flags
v8
Definition
api-arguments-inl.h:19
objects.h
src
builtins
builtins-constructor.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0