Skip to content

Commit

Permalink
Auto update version to 12.2.281.18 (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: auto user <[email protected]>
  • Loading branch information
github-actions[bot] and auto user authored Feb 21, 2024
1 parent 9ef43a2 commit c9170c8
Show file tree
Hide file tree
Showing 21 changed files with 325 additions and 158 deletions.
2 changes: 1 addition & 1 deletion V8_DEFAULT_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.1.285.28
12.2.281.18
8 changes: 4 additions & 4 deletions v8_c_api/src/v8include/js_protocol.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ domain Runtime
# Binding function takes exactly one argument, this argument should be string,
# in case of any other input, function throws an exception.
# Each binding function call produces Runtime.bindingCalled notification.
experimental command addBinding
command addBinding
parameters
string name
# If specified, the binding would only be exposed to the specified
Expand All @@ -1675,17 +1675,17 @@ domain Runtime
# Deprecated in favor of `executionContextName` due to an unclear use case
# and bugs in implementation (crbug.com/1169639). `executionContextId` will be
# removed in the future.
deprecated optional ExecutionContextId executionContextId
experimental deprecated optional ExecutionContextId executionContextId
# If specified, the binding is exposed to the executionContext with
# matching name, even for contexts created after the binding is added.
# See also `ExecutionContext.name` and `worldName` parameter to
# `Page.addScriptToEvaluateOnNewDocument`.
# This parameter is mutually exclusive with `executionContextId`.
experimental optional string executionContextName
optional string executionContextName

# This method does not remove binding function from global object but
# unsubscribes current runtime agent from Runtime.bindingCalled notifications.
experimental command removeBinding
command removeBinding
parameters
string name

Expand Down
2 changes: 1 addition & 1 deletion v8_c_api/src/v8include/v8-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class V8_EXPORT Context : public Data {
* also be considered for freezing should be added to the children_out
* parameter. Returns true if the operation completed successfully.
*/
V8_DEPRECATE_SOON("Please use the version that takes a LocalVector&")
V8_DEPRECATED("Please use the version that takes a LocalVector&")
virtual bool FreezeEmbedderObjectAndGetChildren(
Local<Object> obj, std::vector<Local<Object>>& children_out) {
// TODO(chromium:1454114): This method is temporarily defined in order to
Expand Down
4 changes: 1 addition & 3 deletions v8_c_api/src/v8include/v8-embedder-heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class V8_EXPORT EmbedderRootsHandler {
* |TracedReference|.
*
* Note that the `handle` is different from the handle that the embedder holds
* for retaining the object. The embedder may use |WrapperClassId()| to
* distinguish cases where it wants handles to be treated as roots from not
* being treated as roots.
* for retaining the object.
*
* The concrete implementations must be thread-safe.
*/
Expand Down
39 changes: 38 additions & 1 deletion v8_c_api/src/v8include/v8-function-callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,34 +393,71 @@ template <typename T>
void ReturnValue<T>::Set(bool value) {
static_assert(std::is_base_of<T, Boolean>::value, "type check");
using I = internal::Internals;
#if V8_STATIC_ROOTS_BOOL
#ifdef V8_ENABLE_CHECKS
internal::PerformCastCheck(
internal::ValueHelper::SlotAsValue<Value, true>(value_));
#endif // V8_ENABLE_CHECKS
*value_ = I::DecompressTaggedField(
*value_, value ? I::StaticReadOnlyRoot::kTrueValue
: I::StaticReadOnlyRoot::kFalseValue);
#else
int root_index;
if (value) {
root_index = I::kTrueValueRootIndex;
} else {
root_index = I::kFalseValueRootIndex;
}
*value_ = I::GetRoot(GetIsolate(), root_index);
#endif // V8_STATIC_ROOTS_BOOL
}

template <typename T>
void ReturnValue<T>::SetNull() {
static_assert(std::is_base_of<T, Primitive>::value, "type check");
using I = internal::Internals;
#if V8_STATIC_ROOTS_BOOL
#ifdef V8_ENABLE_CHECKS
internal::PerformCastCheck(
internal::ValueHelper::SlotAsValue<Value, true>(value_));
#endif // V8_ENABLE_CHECKS
*value_ =
I::DecompressTaggedField(*value_, I::StaticReadOnlyRoot::kNullValue);
#else
*value_ = I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
#endif // V8_STATIC_ROOTS_BOOL
}

template <typename T>
void ReturnValue<T>::SetUndefined() {
static_assert(std::is_base_of<T, Primitive>::value, "type check");
using I = internal::Internals;
#if V8_STATIC_ROOTS_BOOL
#ifdef V8_ENABLE_CHECKS
internal::PerformCastCheck(
internal::ValueHelper::SlotAsValue<Value, true>(value_));
#endif // V8_ENABLE_CHECKS
*value_ =
I::DecompressTaggedField(*value_, I::StaticReadOnlyRoot::kUndefinedValue);
#else
*value_ = I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
#endif // V8_STATIC_ROOTS_BOOL
}

template <typename T>
void ReturnValue<T>::SetEmptyString() {
static_assert(std::is_base_of<T, String>::value, "type check");
using I = internal::Internals;
#if V8_STATIC_ROOTS_BOOL
#ifdef V8_ENABLE_CHECKS
internal::PerformCastCheck(
internal::ValueHelper::SlotAsValue<Value, true>(value_));
#endif // V8_ENABLE_CHECKS
*value_ =
I::DecompressTaggedField(*value_, I::StaticReadOnlyRoot::kEmptyString);
#else
*value_ = I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
#endif // V8_STATIC_ROOTS_BOOL
}

template <typename T>
Expand All @@ -435,7 +472,7 @@ Local<Value> ReturnValue<T>::Get() const {
if (I::is_identical(*value_, I::StaticReadOnlyRoot::kTheHoleValue)) {
#else
if (*value_ == I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) {
#endif
#endif // V8_STATIC_ROOTS_BOOL
return Undefined(GetIsolate());
}
return Local<Value>::New(GetIsolate(), reinterpret_cast<Value*>(value_));
Expand Down
1 change: 0 additions & 1 deletion v8_c_api/src/v8include/v8-function.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <stddef.h>
#include <stdint.h>

#include "v8-context.h" // NOLINT(build/include_directory)
#include "v8-function-callback.h" // NOLINT(build/include_directory)
#include "v8-local-handle.h" // NOLINT(build/include_directory)
#include "v8-message.h" // NOLINT(build/include_directory)
Expand Down
41 changes: 39 additions & 2 deletions v8_c_api/src/v8include/v8-handle-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,44 @@

#include "v8-internal.h" // NOLINT(build/include_directory)

namespace v8 {
namespace v8::api_internal {

template <bool check_statically_enabled>
class StackAllocated {
public:
V8_INLINE StackAllocated() = default;

protected:
struct no_checking_tag {};
static constexpr no_checking_tag do_not_check{};

V8_INLINE explicit StackAllocated(no_checking_tag) {}
V8_INLINE explicit StackAllocated(const StackAllocated& other,
no_checking_tag) {}

V8_INLINE void VerifyOnStack() const {}
};

template <>
class V8_TRIVIAL_ABI StackAllocated<true> : public StackAllocated<false> {
public:
V8_INLINE StackAllocated() { VerifyOnStack(); }

#if V8_HAS_ATTRIBUTE_TRIVIAL_ABI
// In this case, StackAllocated becomes not trivially copyable.
V8_INLINE StackAllocated(const StackAllocated& other) { VerifyOnStack(); }
StackAllocated& operator=(const StackAllocated&) = default;
#endif

protected:
V8_INLINE explicit StackAllocated(no_checking_tag tag)
: StackAllocated<false>(tag) {}
V8_INLINE explicit StackAllocated(const StackAllocated& other,
no_checking_tag tag)
: StackAllocated<false>(other, tag) {}

V8_EXPORT void VerifyOnStack() const;
};

/**
* A base class for abstract handles containing indirect pointers.
Expand Down Expand Up @@ -95,6 +132,6 @@ class DirectHandleBase {

#endif // V8_ENABLE_DIRECT_LOCAL

} // namespace v8
} // namespace v8::api_internal

#endif // INCLUDE_V8_HANDLE_BASE_H_
23 changes: 16 additions & 7 deletions v8_c_api/src/v8include/v8-inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@ class V8_EXPORT V8InspectorSession {
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
virtual ~Inspectable() = default;
};
class V8_EXPORT CommandLineAPIScope {
public:
virtual ~CommandLineAPIScope() = default;
};
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;

// Dispatching protocol messages.
Expand All @@ -185,9 +181,6 @@ class V8_EXPORT V8InspectorSession {
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
supportedDomains() = 0;

virtual std::unique_ptr<V8InspectorSession::CommandLineAPIScope>
initializeCommandLineAPIScope(int executionContextId) = 0;

// Debugger actions.
virtual void schedulePauseOnNextStatement(StringView breakReason,
StringView breakDetails) = 0;
Expand All @@ -213,6 +206,22 @@ class V8_EXPORT V8InspectorSession {
virtual void releaseObjectGroup(StringView) = 0;
virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0;

struct V8_EXPORT EvaluateResult {
enum class ResultType {
kNotRun,
kSuccess,
kException,
};

ResultType type;
v8::Local<v8::Value> value;
};
// Evalaute 'expression' in the provided context. Does the same as
// Runtime#evaluate under-the-hood but exposed on the C++ side.
virtual EvaluateResult evaluate(v8::Local<v8::Context> context,
StringView expression,
bool includeCommandLineAPI = false) = 0;

// Prepare for shutdown (disables debugger pausing, etc.).
virtual void stop() = 0;
};
Expand Down
38 changes: 29 additions & 9 deletions v8_c_api/src/v8include/v8-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,15 @@ using SandboxedPointer_t = Address;
#ifdef V8_ENABLE_SANDBOX

// Size of the sandbox, excluding the guard regions surrounding it.
#ifdef V8_TARGET_OS_ANDROID
#if defined(V8_TARGET_OS_ANDROID)
// On Android, most 64-bit devices seem to be configured with only 39 bits of
// virtual address space for userspace. As such, limit the sandbox to 128GB (a
// quarter of the total available address space).
constexpr size_t kSandboxSizeLog2 = 37; // 128 GB
#elif defined(V8_TARGET_ARCH_LOONG64)
// Some Linux distros on LoongArch64 configured with only 40 bits of virtual
// address space for userspace. Limit the sandbox to 256GB here.
constexpr size_t kSandboxSizeLog2 = 38; // 256 GB
#else
// Everywhere else use a 1TB sandbox.
constexpr size_t kSandboxSizeLog2 = 40; // 1 TB
Expand Down Expand Up @@ -606,7 +610,13 @@ constexpr int kCodePointerTableEntryCodeObjectOffset = 8;

// Constants that can be used to mark places that should be modified once
// certain types of objects are moved out of the sandbox and into trusted space.
constexpr bool kCodeObjectLiveInTrustedSpace = false;
constexpr bool kRuntimeGeneratedCodeObjectsLiveInTrustedSpace = true;
constexpr bool kBuiltinCodeObjectsLiveInTrustedSpace = false;
constexpr bool kAllCodeObjectsLiveInTrustedSpace =
kRuntimeGeneratedCodeObjectsLiveInTrustedSpace &&
kBuiltinCodeObjectsLiveInTrustedSpace;

constexpr bool kInterpreterDataObjectsLiveInTrustedSpace = false;

// {obj} must be the raw tagged pointer representation of a HeapObject
// that's guaranteed to never be in ReadOnlySpace.
Expand Down Expand Up @@ -661,7 +671,7 @@ class Internals {
static const int kBuiltinTier0EntryTableSize = 7 * kApiSystemPointerSize;
static const int kBuiltinTier0TableSize = 7 * kApiSystemPointerSize;
static const int kLinearAllocationAreaSize = 3 * kApiSystemPointerSize;
static const int kThreadLocalTopSize = 28 * kApiSystemPointerSize;
static const int kThreadLocalTopSize = 30 * kApiSystemPointerSize;
static const int kHandleScopeDataSize =
2 * kApiSystemPointerSize + 2 * kApiInt32Size;

Expand All @@ -688,8 +698,12 @@ class Internals {
kBuiltinTier0TableOffset + kBuiltinTier0TableSize;
static const int kOldAllocationInfoOffset =
kNewAllocationInfoOffset + kLinearAllocationAreaSize;

static const int kFastCCallAlignmentPaddingSize =
kApiSystemPointerSize == 8 ? 0 : kApiSystemPointerSize;
static const int kIsolateFastCCallCallerFpOffset =
kOldAllocationInfoOffset + kLinearAllocationAreaSize;
kOldAllocationInfoOffset + kLinearAllocationAreaSize +
kFastCCallAlignmentPaddingSize;
static const int kIsolateFastCCallCallerPcOffset =
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
static const int kIsolateFastApiCallTargetOffset =
Expand All @@ -708,8 +722,10 @@ class Internals {
static const int kIsolateSharedExternalPointerTableAddressOffset =
kIsolateExternalPointerTableOffset + kExternalPointerTableSize;
#ifdef V8_ENABLE_SANDBOX
static const int kIsolateTrustedPointerTableOffset =
static const int kIsolateTrustedCageBaseOffset =
kIsolateSharedExternalPointerTableAddressOffset + kApiSystemPointerSize;
static const int kIsolateTrustedPointerTableOffset =
kIsolateTrustedCageBaseOffset + kApiSystemPointerSize;
static const int kIsolateApiCallbackThunkArgumentOffset =
kIsolateTrustedPointerTableOffset + kTrustedPointerTableSize;
#else
Expand All @@ -720,12 +736,15 @@ class Internals {
static const int kIsolateApiCallbackThunkArgumentOffset =
kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize;
#endif // V8_COMPRESS_POINTERS
static const int kWasm64OOBOffsetOffset =
kIsolateApiCallbackThunkArgumentOffset + kApiSystemPointerSize;
static const int kContinuationPreservedEmbedderDataOffset =
kWasm64OOBOffsetOffset + sizeof(int64_t);
kIsolateApiCallbackThunkArgumentOffset + kApiSystemPointerSize;

static const int kWasm64OOBOffsetAlignmentPaddingSize = 0;
static const int kWasm64OOBOffsetOffset =
kContinuationPreservedEmbedderDataOffset + kApiSystemPointerSize +
kWasm64OOBOffsetAlignmentPaddingSize;
static const int kIsolateRootsOffset =
kContinuationPreservedEmbedderDataOffset + kApiSystemPointerSize;
kWasm64OOBOffsetOffset + sizeof(int64_t);

#if V8_STATIC_ROOTS_BOOL

Expand Down Expand Up @@ -1355,6 +1374,7 @@ class HandleHelper final {
return lhs.ptr() == rhs.ptr();
}

static V8_EXPORT bool IsOnStack(const void* ptr);
static V8_EXPORT void VerifyOnStack(const void* ptr);
static V8_EXPORT void VerifyOnMainThread();
};
Expand Down
26 changes: 19 additions & 7 deletions v8_c_api/src/v8include/v8-isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,13 @@ class V8_EXPORT Isolate {
*/
class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
public:
explicit SafeForTerminationScope(v8::Isolate* v8_isolate);
~SafeForTerminationScope();
V8_DEPRECATE_SOON("All code should be safe for termination")
explicit SafeForTerminationScope(v8::Isolate* v8_isolate) {}
~SafeForTerminationScope() {}

// Prevent copying of Scope objects.
SafeForTerminationScope(const SafeForTerminationScope&) = delete;
SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;

private:
internal::Isolate* i_isolate_;
bool prev_value_;
};

/**
Expand Down Expand Up @@ -558,6 +555,13 @@ class V8_EXPORT Isolate {
kTemporalObject = 130,
kWasmModuleCompilation = 131,
kInvalidatedNoUndetectableObjectsProtector = 132,
kWasmJavaScriptPromiseIntegration = 133,
kWasmReturnCall = 134,
kWasmExtendedConst = 135,
kWasmRelaxedSimd = 136,
kWasmTypeReflection = 137,
kWasmExnRef = 138,
kWasmTypedFuncRef = 139,

// If you add new values here, you'll also need to update Chromium's:
// web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
Expand Down Expand Up @@ -585,7 +589,7 @@ class V8_EXPORT Isolate {
* Only Isolate::GetData() and Isolate::SetData(), which access the
* embedder-controlled parts of the isolate, are allowed to be called on the
* uninitialized isolate. To initialize the isolate, call
* Isolate::Initialize().
* `Isolate::Initialize()` or initialize a `SnapshotCreator`.
*
* When an isolate is no longer used its resources should be freed
* by calling Dispose(). Using the delete operator is not allowed.
Expand Down Expand Up @@ -701,6 +705,14 @@ class V8_EXPORT Isolate {
*/
void MemoryPressureNotification(MemoryPressureLevel level);

/**
* Optional request from the embedder to tune v8 towards energy efficiency
* rather than speed if `battery_saver_mode_enabled` is true, because the
* embedder is in battery saver mode. If false, the correct tuning is left
* to v8 to decide.
*/
void SetBatterySaverMode(bool battery_saver_mode_enabled);

/**
* Drop non-essential caches. Should only be called from testing code.
* The method can potentially block for a long time and does not necessarily
Expand Down
Loading

0 comments on commit c9170c8

Please sign in to comment.