Skip to content

Commit 58f3fdc

Browse files
committed
deps: V8: cherry-pick semver-major commits from 10.2
Includes the following commits: commit b2978927d8a96ebc814cccbc5a9f1c35910ee621 Remove dynamic map checks and custom deoptimization kinds This CL removes: - Dynamic map checks aka minimorphic property loads (TF support, builtins). - "Bailout" deopts (= drop to the interpreter once, but don't throw out optimized code). - "EagerWithResume" deopts (= part of dynamic map check functionality, we call a builtin for the deopt check and deopt or resume based on the result). Fixed: v8:12552 Change-Id: I492cf1667e0f54586690b2f72a65ea804224b840 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3401585 commit f52f934119635058b179c2359fe070b8ee0f9233 PPC/s390: Remove dynamic map checks and custom deoptimization kinds Port b2978927d8a96ebc814cccbc5a9f1c35910ee621 Original Commit Message: This CL removes: - Dynamic map checks aka minimorphic property loads (TF support, builtins). - "Bailout" deopts (= drop to the interpreter once, but don't throw out optimized code). - "EagerWithResume" deopts (= part of dynamic map check functionality, we call a builtin for the deopt check and deopt or resume based on the result). R=jgruber@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com BUG= LOG=N Change-Id: I64476f73810774c2c592231d82c4a2cbfa2bf94e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3537881 commit 38940b70986da6b43d18cb8cf8f0a3be36ca9010 [loong64][mips] Remove dynamic map checks and custom deoptimization kinds Port commit b2978927d8a96ebc814cccbc5a9f1c35910ee621 Fixed: v8:12552 Change-Id: Ic2fbded9a662ed840a0350e3ce049e147fbf03a0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3541527 commit da5b5f66a6bd27df6249602378300c6961bc62b4 [riscv64] Remove dynamic map checks and custom deoptimization kinds Port b2978927d8a96ebc814cccbc5a9f1c35910ee621 Bug: v8:12552 Change-Id: I73e76fc5cc8905a0fbfc801b2f794735866d19e8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3544725 commit ffae028b37991566c080c5528463f7d16017668c Forward deprecation for resurrecting finalizer Bug: v8:12672 Change-Id: Ib4f53086436e028b4ea32fbc960f57e91709d184 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3532256 commit f6386018d472665e36d662c8b159d95325999d69 [api] Remove TracedGlobal<> Remove deprecated TracedGlobal<>, greatly simplifying handling of traced references in general. Also saves a word per v8::TracedReference as there's no need to keep a possible callback around. Bug: v8:12603 Change-Id: Ice35d7906775b912d02e97a27a722b3e1cec28d9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3532251 commit a8beac553b0a1639bc9790c2d6f82caf6b2e150f Deprecate some signature checks Deprecate signature checks in * Template::SetNativeDataProperty * ObjectTemplate::SetAccessor These are not used in Chrome and require some complicated check in the IC code, which we want to remove. Change-Id: I413fafc8658e922fd590e7fe200600a624f019a6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3557253 commit cff2b5000a1aa417a9c4499bcfa3ffda4542f4f1 Deprecate signature checks in Set{Accessor,NativeDataProperty} Change from V8_DEPRECATE_SOON to V8_DEPRECATED. It turned out that we don't have to make changes in chrome code, so we can go to deprecated right away. Bug: chromium:1310790 Change-Id: I1bd529536d3a0098f11f13b3e44fe3dbc80eed04 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3571897 commit 9238afb0c0ee52c9111a7e9f2f055137628771ad Allow embedder to set global OOM handler Embedders can currently specify a callback for OOM errors during Isolate initialization. However, there are cases where an OOM error can be thrown in a context where we don't have access to an Isolate, for example on a task posted to a worker thread. This CL introduces an initialization API to allow the embedder to specify a process-wide OOM callback. Bug: chromium:614440 Change-Id: I326753d80767679f677e85104d9edeef92e19086 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3561916 commit ca51ae3ac8b468509603633adb6ee3b3be9306ec [api][profiler] Get StartProfiling, StopProfiling to accept integer ID rather than string This CL adds support for interacting with CpuProfile with their integer id. A String ID is problematic because it forces an allocation when stopping or cancelling a Profiler which can happen during a GC when this is not allowed. Change-Id: I9a8e754bd67214be0bbc5ca051bcadf52bf71a68 Bug: chromium:1297283 Co-Authored-By: Nicolas Dubus <nicodubus@fb.com> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3522896 Refs: v8/v8@b297892 Refs: v8/v8@f52f934 Refs: v8/v8@38940b7 Refs: v8/v8@da5b5f6 Refs: v8/v8@ffae028 Refs: v8/v8@f638601 Refs: v8/v8@a8beac5 Refs: v8/v8@cff2b50 Refs: v8/v8@9238afb Refs: v8/v8@ca51ae3 PR-URL: #42657 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent eba7d2d commit 58f3fdc

File tree

116 files changed

+935
-3418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+935
-3418
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.12',
39+
'v8_embedder_string': '-node.13',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,6 @@ filegroup(
740740
"src/builtins/function.tq",
741741
"src/builtins/growable-fixed-array.tq",
742742
"src/builtins/ic-callable.tq",
743-
"src/builtins/ic-dynamic-check-maps.tq",
744743
"src/builtins/ic.tq",
745744
"src/builtins/internal-coverage.tq",
746745
"src/builtins/internal.tq",

deps/v8/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,6 @@ torque_files = [
16701670
"src/builtins/function.tq",
16711671
"src/builtins/growable-fixed-array.tq",
16721672
"src/builtins/ic-callable.tq",
1673-
"src/builtins/ic-dynamic-check-maps.tq",
16741673
"src/builtins/ic.tq",
16751674
"src/builtins/internal-coverage.tq",
16761675
"src/builtins/internal.tq",

deps/v8/include/v8-embedder-heap.h

+10-21
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,22 @@ class V8_EXPORT EmbedderRootsHandler {
3434
virtual ~EmbedderRootsHandler() = default;
3535

3636
/**
37-
* Returns true if the TracedGlobal handle should be considered as root for
38-
* the currently running non-tracing garbage collection and false otherwise.
39-
* The default implementation will keep all TracedGlobal references as roots.
37+
* Returns true if the |TracedReference| handle should be considered as root
38+
* for the currently running non-tracing garbage collection and false
39+
* otherwise. The default implementation will keep all |TracedReference|
40+
* references as roots.
4041
*
4142
* If this returns false, then V8 may decide that the object referred to by
42-
* such a handle is reclaimed. In that case:
43-
* - No action is required if handles are used with destructors, i.e., by just
44-
* using |TracedGlobal|.
45-
* - When run without destructors, i.e., by using |TracedReference|, V8 calls
46-
* |ResetRoot|.
43+
* such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the
44+
* |TracedReference|.
4745
*
48-
* Note that the |handle| is different from the handle that the embedder holds
46+
* Note that the `handle` is different from the handle that the embedder holds
4947
* for retaining the object. The embedder may use |WrapperClassId()| to
5048
* distinguish cases where it wants handles to be treated as roots from not
5149
* being treated as roots.
5250
*/
5351
virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
5452

55-
V8_DEPRECATED("See v8::TracedGlobal class comment.")
56-
virtual bool IsRoot(const v8::TracedGlobal<v8::Value>& handle) {
57-
return true;
58-
}
59-
6053
/**
6154
* Used in combination with |IsRoot|. Called by V8 when an
6255
* object that is backed by a handle is reclaimed by a non-tracing garbage
@@ -87,13 +80,11 @@ class V8_EXPORT EmbedderHeapTracer {
8780
};
8881

8982
/**
90-
* Interface for iterating through TracedGlobal handles.
83+
* Interface for iterating through |TracedReference| handles.
9184
*/
9285
class V8_EXPORT TracedGlobalHandleVisitor {
9386
public:
9487
virtual ~TracedGlobalHandleVisitor() = default;
95-
V8_DEPRECATED("See v8::TracedGlobal class comment.")
96-
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& handle) {}
9788
virtual void VisitTracedReference(const TracedReference<Value>& handle) {}
9889
};
9990

@@ -118,8 +109,8 @@ class V8_EXPORT EmbedderHeapTracer {
118109
virtual ~EmbedderHeapTracer() = default;
119110

120111
/**
121-
* Iterates all TracedGlobal handles created for the v8::Isolate the tracer is
122-
* attached to.
112+
* Iterates all |TracedReference| handles created for the |v8::Isolate| the
113+
* tracer is attached to.
123114
*/
124115
void IterateTracedGlobalHandles(TracedGlobalHandleVisitor* visitor);
125116

@@ -194,8 +185,6 @@ class V8_EXPORT EmbedderHeapTracer {
194185
*/
195186
virtual bool IsRootForNonTracingGC(
196187
const v8::TracedReference<v8::Value>& handle);
197-
V8_DEPRECATED("See v8::TracedGlobal class comment.")
198-
virtual bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle);
199188

200189
/**
201190
* See documentation on EmbedderRootsHandler.

deps/v8/include/v8-initialization.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
#include <stddef.h>
99
#include <stdint.h>
1010

11-
#include "v8-internal.h" // NOLINT(build/include_directory)
12-
#include "v8-isolate.h" // NOLINT(build/include_directory)
13-
#include "v8-platform.h" // NOLINT(build/include_directory)
14-
#include "v8config.h" // NOLINT(build/include_directory)
11+
#include "v8-callbacks.h" // NOLINT(build/include_directory)
12+
#include "v8-internal.h" // NOLINT(build/include_directory)
13+
#include "v8-isolate.h" // NOLINT(build/include_directory)
14+
#include "v8-platform.h" // NOLINT(build/include_directory)
15+
#include "v8config.h" // NOLINT(build/include_directory)
1516

1617
// We reserve the V8_* prefix for macros defined in V8 public API and
1718
// assume there are no name conflicts with the embedder's code.
@@ -275,6 +276,14 @@ class V8_EXPORT V8 {
275276
UnhandledExceptionCallback unhandled_exception_callback);
276277
#endif
277278

279+
/**
280+
* Allows the host application to provide a callback that will be called when
281+
* v8 has encountered a fatal failure to allocate memory and is about to
282+
* terminate.
283+
*/
284+
285+
static void SetFatalMemoryErrorCallback(OOMErrorCallback oom_error_callback);
286+
278287
/**
279288
* Get statistics about the shared memory usage.
280289
*/

deps/v8/include/v8-internal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ class Internals {
365365

366366
static const uint32_t kNumIsolateDataSlots = 4;
367367
static const int kStackGuardSize = 7 * kApiSystemPointerSize;
368-
static const int kBuiltinTier0EntryTableSize = 13 * kApiSystemPointerSize;
369-
static const int kBuiltinTier0TableSize = 13 * kApiSystemPointerSize;
368+
static const int kBuiltinTier0EntryTableSize = 10 * kApiSystemPointerSize;
369+
static const int kBuiltinTier0TableSize = 10 * kApiSystemPointerSize;
370370

371371
// IsolateData layout guarantees.
372372
static const int kIsolateCageBaseOffset = 0;

deps/v8/include/v8-local-handle.h

-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class String;
4646
template <class F>
4747
class Traced;
4848
template <class F>
49-
class TracedGlobal;
50-
template <class F>
5149
class TracedReference;
5250
class TracedReferenceBase;
5351
class Utils;
@@ -312,8 +310,6 @@ class Local {
312310
template <class F>
313311
friend class Traced;
314312
template <class F>
315-
friend class TracedGlobal;
316-
template <class F>
317313
friend class BasicTracedReference;
318314
template <class F>
319315
friend class TracedReference;

deps/v8/include/v8-object.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ class V8_EXPORT Object : public Value {
493493
return object.val_->GetAlignedPointerFromInternalField(index);
494494
}
495495

496-
/** Same as above, but works for TracedGlobal. */
496+
/** Same as above, but works for TracedReference. */
497497
V8_INLINE static void* GetAlignedPointerFromInternalField(
498498
const BasicTracedReference<Object>& object, int index) {
499499
return object->GetAlignedPointerFromInternalField(index);

deps/v8/include/v8-profiler.h

+65-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum StateTag : int;
2828

2929
using NativeObject = void*;
3030
using SnapshotObjectId = uint32_t;
31+
using ProfilerId = uint32_t;
3132

3233
struct CpuProfileDeoptFrame {
3334
int script_id;
@@ -273,15 +274,33 @@ enum class CpuProfilingStatus {
273274
kErrorTooManyProfilers
274275
};
275276

277+
/**
278+
* Result from StartProfiling returning the Profiling Status, and
279+
* id of the started profiler, or 0 if profiler is not started
280+
*/
281+
struct CpuProfilingResult {
282+
const ProfilerId id;
283+
const CpuProfilingStatus status;
284+
};
285+
276286
/**
277287
* Delegate for when max samples reached and samples are discarded.
278288
*/
279289
class V8_EXPORT DiscardedSamplesDelegate {
280290
public:
281-
DiscardedSamplesDelegate() {}
291+
DiscardedSamplesDelegate() = default;
282292

283293
virtual ~DiscardedSamplesDelegate() = default;
284294
virtual void Notify() = 0;
295+
296+
ProfilerId GetId() const { return profiler_id_; }
297+
298+
private:
299+
friend internal::CpuProfile;
300+
301+
void SetId(ProfilerId id) { profiler_id_ = id; }
302+
303+
ProfilerId profiler_id_;
285304
};
286305

287306
/**
@@ -371,6 +390,45 @@ class V8_EXPORT CpuProfiler {
371390
*/
372391
void SetUsePreciseSampling(bool);
373392

393+
/**
394+
* Starts collecting a CPU profile. Several profiles may be collected at once.
395+
* Generates an anonymous profiler, without a String identifier.
396+
*/
397+
CpuProfilingResult Start(
398+
CpuProfilingOptions options,
399+
std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
400+
401+
/**
402+
* Starts collecting a CPU profile. Title may be an empty string. Several
403+
* profiles may be collected at once. Attempts to start collecting several
404+
* profiles with the same title are silently ignored.
405+
*/
406+
CpuProfilingResult Start(
407+
Local<String> title, CpuProfilingOptions options,
408+
std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
409+
410+
/**
411+
* Starts profiling with the same semantics as above, except with expanded
412+
* parameters.
413+
*
414+
* |record_samples| parameter controls whether individual samples should
415+
* be recorded in addition to the aggregated tree.
416+
*
417+
* |max_samples| controls the maximum number of samples that should be
418+
* recorded by the profiler. Samples obtained after this limit will be
419+
* discarded.
420+
*/
421+
CpuProfilingResult Start(
422+
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
423+
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
424+
425+
/**
426+
* The same as StartProfiling above, but the CpuProfilingMode defaults to
427+
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
428+
* profiler.
429+
*/
430+
CpuProfilingResult Start(Local<String> title, bool record_samples = false);
431+
374432
/**
375433
* Starts collecting a CPU profile. Title may be an empty string. Several
376434
* profiles may be collected at once. Attempts to start collecting several
@@ -394,6 +452,7 @@ class V8_EXPORT CpuProfiler {
394452
CpuProfilingStatus StartProfiling(
395453
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
396454
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
455+
397456
/**
398457
* The same as StartProfiling above, but the CpuProfilingMode defaults to
399458
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
@@ -402,6 +461,11 @@ class V8_EXPORT CpuProfiler {
402461
CpuProfilingStatus StartProfiling(Local<String> title,
403462
bool record_samples = false);
404463

464+
/**
465+
* Stops collecting CPU profile with a given id and returns it.
466+
*/
467+
CpuProfile* Stop(ProfilerId id);
468+
405469
/**
406470
* Stops collecting CPU profile with a given title and returns it.
407471
* If the title given is empty, finishes the last profile started.

deps/v8/include/v8-template.h

+31-4
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,33 @@ class V8_EXPORT Template : public Data {
8989
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
9090
* thrown and no callback is invoked.
9191
*/
92+
V8_DEPRECATED("Do signature check in accessor")
93+
void SetNativeDataProperty(
94+
Local<String> name, AccessorGetterCallback getter,
95+
AccessorSetterCallback setter, Local<Value> data,
96+
PropertyAttribute attribute, Local<AccessorSignature> signature,
97+
AccessControl settings = DEFAULT,
98+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
99+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
100+
V8_DEPRECATED("Do signature check in accessor")
101+
void SetNativeDataProperty(
102+
Local<Name> name, AccessorNameGetterCallback getter,
103+
AccessorNameSetterCallback setter, Local<Value> data,
104+
PropertyAttribute attribute, Local<AccessorSignature> signature,
105+
AccessControl settings = DEFAULT,
106+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
107+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
92108
void SetNativeDataProperty(
93109
Local<String> name, AccessorGetterCallback getter,
94110
AccessorSetterCallback setter = nullptr,
95111
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
96-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
97112
AccessControl settings = DEFAULT,
98113
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
99114
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
100115
void SetNativeDataProperty(
101116
Local<Name> name, AccessorNameGetterCallback getter,
102117
AccessorNameSetterCallback setter = nullptr,
103118
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
104-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
105119
AccessControl settings = DEFAULT,
106120
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
107121
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
@@ -813,20 +827,33 @@ class V8_EXPORT ObjectTemplate : public Template {
813827
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
814828
* thrown and no callback is invoked.
815829
*/
830+
V8_DEPRECATED("Do signature check in accessor")
831+
void SetAccessor(
832+
Local<String> name, AccessorGetterCallback getter,
833+
AccessorSetterCallback setter, Local<Value> data, AccessControl settings,
834+
PropertyAttribute attribute, Local<AccessorSignature> signature,
835+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
836+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
837+
V8_DEPRECATED("Do signature check in accessor")
838+
void SetAccessor(
839+
Local<Name> name, AccessorNameGetterCallback getter,
840+
AccessorNameSetterCallback setter, Local<Value> data,
841+
AccessControl settings, PropertyAttribute attribute,
842+
Local<AccessorSignature> signature,
843+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
844+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
816845
void SetAccessor(
817846
Local<String> name, AccessorGetterCallback getter,
818847
AccessorSetterCallback setter = nullptr,
819848
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
820849
PropertyAttribute attribute = None,
821-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
822850
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
823851
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
824852
void SetAccessor(
825853
Local<Name> name, AccessorNameGetterCallback getter,
826854
AccessorNameSetterCallback setter = nullptr,
827855
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
828856
PropertyAttribute attribute = None,
829-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
830857
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
831858
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
832859

0 commit comments

Comments
 (0)