summaryrefslogtreecommitdiff
path: root/deps/v8/src/common/globals.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/common/globals.h')
-rw-r--r--deps/v8/src/common/globals.h161
1 files changed, 120 insertions, 41 deletions
diff --git a/deps/v8/src/common/globals.h b/deps/v8/src/common/globals.h
index 9288e13c5d..17057b4c5f 100644
--- a/deps/v8/src/common/globals.h
+++ b/deps/v8/src/common/globals.h
@@ -71,7 +71,9 @@ namespace internal {
// Determine whether the architecture uses an embedded constant pool
// (contiguous constant pool embedded in code object).
-#if V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64
+// Need to temporary disable the constant pool on PPC, more details can be found
+// under https://crrev.com/c/4341976.
+#if 0 && (V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64)
#define V8_EMBEDDED_CONSTANT_POOL_BOOL true
#else
#define V8_EMBEDDED_CONSTANT_POOL_BOOL false
@@ -122,6 +124,12 @@ namespace internal {
#define V8_CAN_CREATE_SHARED_HEAP_BOOL false
#endif
+#ifdef V8_STATIC_ROOT_GENERATION
+#define V8_STATIC_ROOT_GENERATION_BOOL true
+#else
+#define V8_STATIC_ROOT_GENERATION_BOOL false
+#endif
+
#ifdef V8_ENABLE_SANDBOX
#define V8_ENABLE_SANDBOX_BOOL true
#else
@@ -225,14 +233,8 @@ const size_t kShortBuiltinCallsOldSpaceSizeThreshold = size_t{2} * GB;
#ifdef V8_EXTERNAL_CODE_SPACE
#define V8_EXTERNAL_CODE_SPACE_BOOL true
-// This flag enables the mode when V8 does not create trampoline Code objects
-// for builtins. It should be enough to have only CodeDataContainer objects.
-class CodeDataContainer;
-using CodeT = CodeDataContainer;
#else
#define V8_EXTERNAL_CODE_SPACE_BOOL false
-class Code;
-using CodeT = Code;
#endif
// V8_HEAP_USE_PTHREAD_JIT_WRITE_PROTECT controls how V8 sets permissions for
@@ -298,6 +300,12 @@ using CodeT = Code;
#define V8_SFI_HAS_UNIQUE_ID false
#endif
+#if V8_SFI_HAS_UNIQUE_ID && TAGGED_SIZE_8_BYTES
+#define V8_SFI_NEEDS_PADDING true
+#else
+#define V8_SFI_NEEDS_PADDING false
+#endif
+
#if defined(V8_OS_WIN) && defined(V8_TARGET_ARCH_X64)
#define V8_OS_WIN_X64 true
#endif
@@ -380,9 +388,26 @@ constexpr int kMaxDoubleStringLength = 24;
// Total wasm code space per engine (i.e. per process) is limited to make
// certain attacks that rely on heap spraying harder.
+// Do not access directly, but via the {--wasm-max-committed-code-mb} flag.
// Just below 4GB, such that {kMaxWasmCodeMemory} fits in a 32-bit size_t.
-constexpr size_t kMaxWasmCodeMB = 4095;
-constexpr size_t kMaxWasmCodeMemory = kMaxWasmCodeMB * MB;
+constexpr uint32_t kMaxCommittedWasmCodeMB = 4095;
+
+// The actual maximum code space size used can be configured with
+// --max-wasm-code-space-size. This constant is the default value, and at the
+// same time the maximum allowed value (checked by the WasmCodeManager).
+#if V8_TARGET_ARCH_ARM64
+// ARM64 only supports direct calls within a 128 MB range.
+constexpr uint32_t kDefaultMaxWasmCodeSpaceSizeMb = 128;
+#elif V8_TARGET_ARCH_PPC64
+// Branches only take 26 bits.
+constexpr uint32_t kDefaultMaxWasmCodeSpaceSizeMb = 32;
+#else
+// Use 1024 MB limit for code spaces on other platforms. This is smaller than
+// the total allowed code space (kMaxWasmCodeMemory) to avoid unnecessarily
+// big reservations, and to ensure that distances within a code space fit
+// within a 32-bit signed integer.
+constexpr uint32_t kDefaultMaxWasmCodeSpaceSizeMb = 1024;
+#endif
#if V8_HOST_ARCH_64_BIT
constexpr int kSystemPointerSizeLog2 = 3;
@@ -652,8 +677,11 @@ enum class StoreOrigin { kMaybeKeyed, kNamed };
enum class TypeofMode { kInside, kNotInside };
-// Enums used by CEntry.
+// Whether floating point registers should be saved (and restored).
enum class SaveFPRegsMode { kIgnore, kSave };
+
+// Whether arguments are passed on a known stack location or through a
+// register.
enum class ArgvMode { kStack, kRegister };
// This constant is used as an undefined value when passing source positions.
@@ -847,8 +875,8 @@ using RuntimeArguments = Arguments<ArgumentsType::kRuntime>;
using JavaScriptArguments = Arguments<ArgumentsType::kJS>;
class Assembler;
class ClassScope;
+class InstructionStream;
class Code;
-class CodeDataContainer;
class CodeSpace;
class Context;
class DeclarationScope;
@@ -903,6 +931,7 @@ class CompressedMaybeObjectSlot;
class CompressedMapWordSlot;
class CompressedHeapObjectSlot;
class V8HeapCompressionScheme;
+class ExternalCodeCompressionScheme;
template <typename CompressionScheme>
class OffHeapCompressedObjectSlot;
class FullObjectSlot;
@@ -934,7 +963,12 @@ struct SlotTraits {
using THeapObjectSlot = CompressedHeapObjectSlot;
using TOffHeapObjectSlot =
OffHeapCompressedObjectSlot<V8HeapCompressionScheme>;
- using TCodeObjectSlot = OffHeapCompressedObjectSlot<V8HeapCompressionScheme>;
+#ifdef V8_EXTERNAL_CODE_SPACE
+ using TCodeObjectSlot =
+ OffHeapCompressedObjectSlot<ExternalCodeCompressionScheme>;
+#else
+ using TCodeObjectSlot = TObjectSlot;
+#endif // V8_EXTERNAL_CODE_SPACE
#else
using TObjectSlot = FullObjectSlot;
using TMaybeObjectSlot = FullMaybeObjectSlot;
@@ -963,9 +997,10 @@ using HeapObjectSlot = SlotTraits::THeapObjectSlot;
using OffHeapObjectSlot = SlotTraits::TOffHeapObjectSlot;
// A CodeObjectSlot instance describes a kTaggedSize-sized field ("slot")
-// holding a strong pointer to a Code object. The Code object slots might be
-// compressed and since code space might be allocated off the main heap
-// the load operations require explicit cage base value for code space.
+// holding a strong pointer to a InstructionStream object. The InstructionStream
+// object slots might be compressed and since code space might be allocated off
+// the main heap the load operations require explicit cage base value for code
+// space.
using CodeObjectSlot = SlotTraits::TCodeObjectSlot;
using WeakSlotCallback = bool (*)(FullObjectSlot pointer);
@@ -1002,10 +1037,10 @@ constexpr int kSpaceTagSize = 4;
static_assert(FIRST_SPACE == 0);
enum class AllocationType : uint8_t {
- kYoung, // Regular object allocated in NEW_SPACE or NEW_LO_SPACE
- kOld, // Regular object allocated in OLD_SPACE or LO_SPACE
- kCode, // Code object allocated in CODE_SPACE or CODE_LO_SPACE
- kMap, // Map object allocated in OLD_SPACE
+ kYoung, // Regular object allocated in NEW_SPACE or NEW_LO_SPACE
+ kOld, // Regular object allocated in OLD_SPACE or LO_SPACE
+ kCode, // InstructionStream object allocated in CODE_SPACE or CODE_LO_SPACE
+ kMap, // Map object allocated in OLD_SPACE
kReadOnly, // Object allocated in RO_SPACE
kSharedOld, // Regular object allocated in OLD_SPACE in the shared heap
kSharedMap, // Map object in OLD_SPACE in the shared heap
@@ -1124,6 +1159,8 @@ enum class CodeFlushMode {
kStressFlushCode,
};
+enum ExternalBackingStoreType { kArrayBuffer, kExternalString, kNumTypes };
+
bool inline IsBaselineCodeFlushingEnabled(base::EnumSet<CodeFlushMode> mode) {
return mode.contains(CodeFlushMode::kFlushBaselineCode);
}
@@ -1166,6 +1203,15 @@ enum ParseRestriction : bool {
ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression.
};
+enum class ScriptEventType {
+ kReserveId,
+ kCreate,
+ kDeserialize,
+ kBackgroundCompile,
+ kStreamingCompileBackground,
+ kStreamingCompileForeground
+};
+
// State for inline cache call sites. Aliased as IC::State.
enum class InlineCacheState {
// No feedback will be collected.
@@ -1376,14 +1422,15 @@ inline std::ostream& operator<<(std::ostream& os, CreateArgumentsType type) {
constexpr int kScopeInfoMaxInlinedLocalNamesSize = 75;
enum ScopeType : uint8_t {
- CLASS_SCOPE, // The scope introduced by a class.
- EVAL_SCOPE, // The top-level scope for an eval source.
- FUNCTION_SCOPE, // The top-level scope for a function.
- MODULE_SCOPE, // The scope introduced by a module literal
- SCRIPT_SCOPE, // The top-level scope for a script or a top-level eval.
- CATCH_SCOPE, // The scope introduced by catch.
- BLOCK_SCOPE, // The scope introduced by a new block.
- WITH_SCOPE // The scope introduced by with.
+ CLASS_SCOPE, // The scope introduced by a class.
+ EVAL_SCOPE, // The top-level scope for an eval source.
+ FUNCTION_SCOPE, // The top-level scope for a function.
+ MODULE_SCOPE, // The scope introduced by a module literal
+ SCRIPT_SCOPE, // The top-level scope for a script or a top-level eval.
+ CATCH_SCOPE, // The scope introduced by catch.
+ BLOCK_SCOPE, // The scope introduced by a new block.
+ WITH_SCOPE, // The scope introduced by with.
+ SHADOW_REALM_SCOPE // Synthetic scope for ShadowRealm NativeContexts.
};
inline std::ostream& operator<<(std::ostream& os, ScopeType type) {
@@ -1404,6 +1451,8 @@ inline std::ostream& operator<<(std::ostream& os, ScopeType type) {
return os << "CLASS_SCOPE";
case ScopeType::WITH_SCOPE:
return os << "WITH_SCOPE";
+ case ScopeType::SHADOW_REALM_SCOPE:
+ return os << "SHADOW_REALM_SCOPE";
}
UNREACHABLE();
}
@@ -1535,11 +1584,20 @@ inline bool IsDeclaredVariableMode(VariableMode mode) {
return mode <= VariableMode::kVar;
}
-inline bool IsPrivateMethodOrAccessorVariableMode(VariableMode mode) {
- return mode >= VariableMode::kPrivateMethod &&
+inline bool IsPrivateAccessorVariableMode(VariableMode mode) {
+ return mode >= VariableMode::kPrivateSetterOnly &&
mode <= VariableMode::kPrivateGetterAndSetter;
}
+inline bool IsPrivateMethodVariableMode(VariableMode mode) {
+ return mode == VariableMode::kPrivateMethod;
+}
+
+inline bool IsPrivateMethodOrAccessorVariableMode(VariableMode mode) {
+ return IsPrivateMethodVariableMode(mode) ||
+ IsPrivateAccessorVariableMode(mode);
+}
+
inline bool IsSerializableVariableMode(VariableMode mode) {
return IsDeclaredVariableMode(mode) ||
IsPrivateMethodOrAccessorVariableMode(mode);
@@ -1699,9 +1757,10 @@ class CompareOperationFeedback {
kInternalizedStringFlag = 1 << 4,
kOtherStringFlag = 1 << 5,
kSymbolFlag = 1 << 6,
- kBigIntFlag = 1 << 7,
- kReceiverFlag = 1 << 8,
- kAnyMask = 0x1FF,
+ kBigInt64Flag = 1 << 7,
+ kOtherBigIntFlag = 1 << 8,
+ kReceiverFlag = 1 << 9,
+ kAnyMask = 0x3FF,
};
public:
@@ -1723,7 +1782,8 @@ class CompareOperationFeedback {
kReceiver = kReceiverFlag,
kReceiverOrNullOrUndefined = kReceiver | kNullOrUndefined,
- kBigInt = kBigIntFlag,
+ kBigInt64 = kBigInt64Flag,
+ kBigInt = kBigInt64Flag | kOtherBigIntFlag,
kSymbol = kSymbolFlag,
kAny = kAnyMask,
@@ -1796,18 +1856,23 @@ inline std::ostream& operator<<(std::ostream& os, CollectionKind kind) {
UNREACHABLE();
}
-// Flags for the runtime function kDefineKeyedOwnPropertyInLiteral. A property
-// can be enumerable or not, and, in case of functions, the function name can be
-// set or not.
+// Flags for the runtime function kDefineKeyedOwnPropertyInLiteral.
+// - Whether the function name should be set or not.
enum class DefineKeyedOwnPropertyInLiteralFlag {
kNoFlags = 0,
- kDontEnum = 1 << 0,
- kSetFunctionName = 1 << 1
+ kSetFunctionName = 1 << 0
};
using DefineKeyedOwnPropertyInLiteralFlags =
base::Flags<DefineKeyedOwnPropertyInLiteralFlag>;
DEFINE_OPERATORS_FOR_FLAGS(DefineKeyedOwnPropertyInLiteralFlags)
+enum class DefineKeyedOwnPropertyFlag {
+ kNoFlags = 0,
+ kSetFunctionName = 1 << 0
+};
+using DefineKeyedOwnPropertyFlags = base::Flags<DefineKeyedOwnPropertyFlag>;
+DEFINE_OPERATORS_FOR_FLAGS(DefineKeyedOwnPropertyFlags)
+
enum ExternalArrayType {
kExternalInt8Array = 1,
kExternalUint8Array,
@@ -1853,6 +1918,12 @@ enum class TieringState : int32_t {
kLastTieringState = kRequestTurbofan_Concurrent,
};
+// The state kInProgress (= an optimization request for this function is
+// currently being serviced) currently means that no other tiering action can
+// happen. Define this constant so we can static_assert it at related code
+// sites.
+static constexpr bool kTieringStateInProgressBlocksTierup = true;
+
// To efficiently check whether a marker is kNone or kInProgress using a single
// mask, we expect the kNone to be 0 and kInProgress to be 1 so that we can
// mask off the lsb for checking.
@@ -1979,7 +2050,8 @@ enum IsolateAddressId {
V(TrapNullDereference) \
V(TrapIllegalCast) \
V(TrapArrayOutOfBounds) \
- V(TrapArrayTooLarge)
+ V(TrapArrayTooLarge) \
+ V(TrapStringOffsetOutOfBounds)
enum KeyedAccessLoadMode {
STANDARD_LOAD,
@@ -2008,7 +2080,8 @@ enum class IcCheckType { kElement, kProperty };
// Helper stubs can be called in different ways depending on where the target
// code is located and how the call sequence is expected to look like:
-// - CodeObject: Call on-heap {Code} object via {RelocInfo::CODE_TARGET}.
+// - CodeObject: Call on-heap {Code} object via
+// {RelocInfo::CODE_TARGET}.
// - WasmRuntimeStub: Call native {WasmCode} stub via
// {RelocInfo::WASM_STUB_CALL}.
// - BuiltinPointer: Call a builtin based on a builtin pointer with dynamic
@@ -2038,6 +2111,11 @@ inline constexpr int JSParameterCount(int param_count_without_receiver) {
return param_count_without_receiver + kJSArgcReceiverSlots;
}
+// A special {Parameter} index for JSCalls that represents the closure.
+// The constant is defined here for accessibility (without having to include TF
+// internals), even though it is mostly relevant to Turbofan.
+constexpr int kJSCallClosureParameterIndex = -1;
+
// Opaque data type for identifying stack frames. Used extensively
// by the debugger.
// ID_MIN_VALUE and ID_MAX_VALUE are specified to ensure that enumeration type
@@ -2065,7 +2143,7 @@ class PtrComprCageBase {
// NOLINTNEXTLINE
inline PtrComprCageBase(const LocalIsolate* isolate);
- inline Address address() const;
+ inline Address address() const { return address_; }
bool operator==(const PtrComprCageBase& other) const {
return address_ == other.address_;
@@ -2077,6 +2155,7 @@ class PtrComprCageBase {
#else
class PtrComprCageBase {
public:
+ explicit constexpr PtrComprCageBase(Address address) {}
PtrComprCageBase() = default;
// NOLINTNEXTLINE
PtrComprCageBase(const Isolate* isolate) {}