Skip to content

Commit

Permalink
deps: make V8 9.3 abi-compatible with 9.0
Browse files Browse the repository at this point in the history
Revert "[api] Avoid handles for const API functions"
This reverts commit aee471b2ff5b1a9e622426454885b748d226535b.

Revert "[api] Remove deprecated [Shared]ArrayBuffer API"
This reverts commit 578f6be77fc5d8af975005c2baf918e7225abb62.

Revert "[Jobs]: Cleanup in v8 platform."
This reverts commit baf2b088dd9f585aa597459f30d71431171666e2.

Revert "Skip global registration of [Shared]ArrayBuffer backing stores"
This reverts commit fcdf35e6d70d51699ece063e25dc705e80673308.

Revert "[api] Remove previously deprecated Function::GetDisplayName()."
This reverts commit 6165fef8cc9dde52973e54c915e6905221b3f8fb.

Revert "[api] Remove deprecated Symbol::Name()"
This reverts commit bbc72ef6c7d6d8e2c4dd074d7713e5c841003163.

Revert API change for HeapProfiler::TakeHeapSnapshot
This reverts a small part of 7f52e4f92d3d3ded9a1701ee2f93966075ae5004.

Revert "[cpu-profiler] Reintroduce support for context filtering"
This reverts commit 0aacfb2a6ecbeda1d1d97ca113afd8253a1b9670.

Restore new argument for TakeHeapSnapshot method
This creates a new TakeHeapSnapshotV8_92 method with the signature from
7f52e4f92d3d3ded9a1701ee2f93966075ae5004.
It is necessary because the API is used internall by V8.

Silence irrelevant warning
V8 triggers it in the Name method.

Revert "[api] Add v8::metrics::LongTaskStats for the LongTasks UKM"
This reverts commit 521ae93bf652b0cc1fec1fdd788e3b80fb72a349.

Move cage_base isolate data field
Makes 3ada6f27404b4ffd6d3e97cf15be76672f60c10d ABI-compatible.

Revert ABI-breaking change in FunctionTemplate::SetCallHandler
Reverts part of a7980d43e030ba4bdb36813d4bc99f85982bf4ee and
ad4eab00e7ec96730eb2c1b6ddcef14ba2e4becd.

Revert "[api] Support PropertyAttribute in v8::Template::Set"
This reverts commit 22a32f11f7a39e4a73105608a51ebab0ad97960f.

Revert API change for FunctionTemplate::New
This reverts the API change of 5f82dbbe534635a8b1e93f27e8fd7e68c0eaf291.

Fix some reverts
- constness of internal APIs has not external effect
- restored API function must but adapted to moved internal API.

Fix compilation of d8 and cctest

PR-URL: #39947
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
targos committed Sep 1, 2021
1 parent 0140fac commit 92d83d1
Show file tree
Hide file tree
Showing 33 changed files with 1,059 additions and 617 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.9',
'v8_embedder_string': '-node.10',

##### V8 defaults for Node.js #####

Expand Down
13 changes: 1 addition & 12 deletions deps/v8/include/v8-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const int kApiSystemPointerSize = sizeof(void*);
const int kApiDoubleSize = sizeof(double);
const int kApiInt32Size = sizeof(int32_t);
const int kApiInt64Size = sizeof(int64_t);
const int kApiSizetSize = sizeof(size_t);

// Tag information for HeapObject.
const int kHeapObjectTag = 1;
Expand Down Expand Up @@ -231,12 +230,8 @@ class Internals {
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
static const int kIsolateFastApiCallTargetOffset =
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
static const int kIsolateCageBaseOffset =
kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
static const int kIsolateLongTaskStatsCounterOffset =
kIsolateCageBaseOffset + kApiSystemPointerSize;
static const int kIsolateStackGuardOffset =
kIsolateLongTaskStatsCounterOffset + kApiSizetSize;
kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
static const int kIsolateRootsOffset =
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;

Expand Down Expand Up @@ -369,12 +364,6 @@ class Internals {
return *reinterpret_cast<void* const*>(addr);
}

V8_INLINE static void IncrementLongTasksStatsCounter(v8::Isolate* isolate) {
internal::Address addr = reinterpret_cast<internal::Address>(isolate) +
kIsolateLongTaskStatsCounterOffset;
++(*reinterpret_cast<size_t*>(addr));
}

V8_INLINE static internal::Address* GetRoot(v8::Isolate* isolate, int index) {
internal::Address addr = reinterpret_cast<internal::Address>(isolate) +
kIsolateRootsOffset +
Expand Down
29 changes: 1 addition & 28 deletions deps/v8/include/v8-metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#ifndef V8_METRICS_H_
#define V8_METRICS_H_

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

namespace v8 {
namespace metrics {
Expand Down Expand Up @@ -197,32 +196,6 @@ class V8_EXPORT Recorder {
static ContextId GetContextId(Local<Context> context);
};

/**
* Experimental API intended for the LongTasks UKM (crbug.com/1173527).
* The Reset() method should be called at the start of a potential
* long task. The Get() method returns durations of V8 work that
* happened during the task.
*
* This API is experimental and may be removed/changed in the future.
*/
struct V8_EXPORT LongTaskStats {
/**
* Resets durations of V8 work for the new task.
*/
V8_INLINE static void Reset(Isolate* isolate) {
v8::internal::Internals::IncrementLongTasksStatsCounter(isolate);
}

/**
* Returns durations of V8 work that happened since the last Reset().
*/
static LongTaskStats Get(Isolate* isolate);

int64_t gc_full_atomic_wall_clock_duration_us = 0;
int64_t gc_full_incremental_wall_clock_duration_us = 0;
int64_t gc_young_wall_clock_duration_us = 0;
};

} // namespace metrics
} // namespace v8

Expand Down
18 changes: 16 additions & 2 deletions deps/v8/include/v8-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ class JobDelegate {
/**
* Returns true if the current task is called from the thread currently
* running JobHandle::Join().
* TODO(etiennep): Make pure virtual once custom embedders implement it.
*/
virtual bool IsJoiningThread() const = 0;
virtual bool IsJoiningThread() const { return false; }
};

/**
Expand Down Expand Up @@ -219,21 +220,30 @@ class JobHandle {
* Forces all existing workers to yield ASAP but doesn’t wait for them.
* Warning, this is dangerous if the Job's callback is bound to or has access
* to state which may be deleted after this call.
* TODO(etiennep): Cleanup once implemented by all embedders.
*/
virtual void CancelAndDetach() = 0;
virtual void CancelAndDetach() { Cancel(); }

/**
* Returns true if there's any work pending or any worker running.
*/
virtual bool IsActive() = 0;

// TODO(etiennep): Clean up once all overrides are removed.
V8_DEPRECATED("Use !IsActive() instead.")
virtual bool IsCompleted() { return !IsActive(); }

/**
* Returns true if associated with a Job and other methods may be called.
* Returns false after Join() or Cancel() was called. This may return true
* even if no workers are running and IsCompleted() returns true
*/
virtual bool IsValid() = 0;

// TODO(etiennep): Clean up once all overrides are removed.
V8_DEPRECATED("Use IsValid() instead.")
virtual bool IsRunning() { return IsValid(); }

/**
* Returns true if job priority can be changed.
*/
Expand Down Expand Up @@ -262,6 +272,10 @@ class JobTask {
* it must not call back any JobHandle methods.
*/
virtual size_t GetMaxConcurrency(size_t worker_count) const = 0;

// TODO(1114823): Clean up once all overrides are removed.
V8_DEPRECATED("Use the version that takes |worker_count|.")
virtual size_t GetMaxConcurrency() const { return 0; }
};

/**
Expand Down
16 changes: 10 additions & 6 deletions deps/v8/include/v8-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ class V8_EXPORT CpuProfilingOptions {
* interval, set via SetSamplingInterval(). If
* zero, the sampling interval will be equal to
* the profiler's sampling interval.
* \param filter_context If specified, profiles will only contain frames
* using this context. Other frames will be elided.
* \param filter_context Deprecated option to filter by context, currently a
* no-op.
*/
CpuProfilingOptions(
CpuProfilingMode mode = kLeafNodeLineNumbers,
Expand All @@ -304,13 +304,9 @@ class V8_EXPORT CpuProfilingOptions {
private:
friend class internal::CpuProfile;

bool has_filter_context() const { return !filter_context_.IsEmpty(); }
void* raw_filter_context() const;

CpuProfilingMode mode_;
unsigned max_samples_;
int sampling_interval_us_;
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
};

/**
Expand Down Expand Up @@ -900,6 +896,14 @@ class V8_EXPORT HeapProfiler {
* Takes a heap snapshot and returns it.
*/
const HeapSnapshot* TakeHeapSnapshot(
ActivityControl* control = nullptr,
ObjectNameResolver* global_object_name_resolver = nullptr,
bool treat_global_objects_as_roots = true);

/**
* Takes a heap snapshot and returns it.
*/
const HeapSnapshot* TakeHeapSnapshotV8_92(
ActivityControl* control = nullptr,
ObjectNameResolver* global_object_name_resolver = nullptr,
bool treat_global_objects_as_roots = true,
Expand Down
Loading

0 comments on commit 92d83d1

Please sign in to comment.