Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 795108a

Browse filesBrowse files
committed
deps: V8: make V8 9.5 ABI-compatible with 9.6
Cherry-pick ABI-breaking changes that happened since 9.5 was branched: [api] Remove deprecated HostImportModuleDynamicallyCallback Refs: v8/v8@ab83685 [zone] Provide a way to configure allocator for zone backings Refs: v8/v8@e262e1c [isolate-data] Consistent field names Needed for the next commit. Refs: v8/v8@d09fc54 [isolate-data] Split builtin tables into tiers Refs: v8/v8@06af754 [mips][loong64][isolate-data] Split builtin tables into tiers Refs: v8/v8@1fd5561 [riscv64] Replace builtin_entry_slot_offset with BuiltinEntrySlotOffset Refs: v8/v8@b66d5f0 ppc/s390: [isolate-data] Split builtin tables into tiers Refs: v8/v8@dc88bdf PR-URL: #40422 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
1 parent f9996d5 commit 795108a
Copy full SHA for 795108a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

42 files changed

+458
-385
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
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.11',
39+
'v8_embedder_string': '-node.12',
4040

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

Collapse file

‎deps/v8/include/v8-callbacks.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-callbacks.h
-25Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -210,31 +210,6 @@ using CreateHistogramCallback = void* (*)(const char* name, int min, int max,
210210

211211
using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
212212

213-
/**
214-
* HostImportModuleDynamicallyCallback is called when we require the
215-
* embedder to load a module. This is used as part of the dynamic
216-
* import syntax.
217-
*
218-
* The referrer contains metadata about the script/module that calls
219-
* import.
220-
*
221-
* The specifier is the name of the module that should be imported.
222-
*
223-
* The embedder must compile, instantiate, evaluate the Module, and
224-
* obtain its namespace object.
225-
*
226-
* The Promise returned from this function is forwarded to userland
227-
* JavaScript. The embedder must resolve this promise with the module
228-
* namespace object. In case of an exception, the embedder must reject
229-
* this promise with the exception. If the promise creation itself
230-
* fails (e.g. due to stack overflow), the embedder must propagate
231-
* that exception by returning an empty MaybeLocal.
232-
*/
233-
using HostImportModuleDynamicallyCallback =
234-
MaybeLocal<Promise> (*)(Local<Context> context,
235-
Local<ScriptOrModule> referrer,
236-
Local<String> specifier);
237-
238213
// --- Exceptions ---
239214

240215
using FatalErrorCallback = void (*)(const char* location, const char* message);
Collapse file

‎deps/v8/include/v8-internal.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-internal.h
+15-8Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,30 @@ class Internals {
224224
static const int kExternalOneByteRepresentationTag = 0x0a;
225225

226226
static const uint32_t kNumIsolateDataSlots = 4;
227+
static const int kStackGuardSize = 7 * kApiSystemPointerSize;
228+
static const int kBuiltinTier0EntryTableSize = 13 * kApiSystemPointerSize;
229+
static const int kBuiltinTier0TableSize = 13 * kApiSystemPointerSize;
227230

228231
// IsolateData layout guarantees.
229-
static const int kIsolateEmbedderDataOffset = 0;
232+
static const int kIsolateCageBaseOffset = 0;
233+
static const int kIsolateStackGuardOffset =
234+
kIsolateCageBaseOffset + kApiSystemPointerSize;
235+
static const int kBuiltinTier0EntryTableOffset =
236+
kIsolateStackGuardOffset + kStackGuardSize;
237+
static const int kBuiltinTier0TableOffset =
238+
kBuiltinTier0EntryTableOffset + kBuiltinTier0EntryTableSize;
239+
static const int kIsolateEmbedderDataOffset =
240+
kBuiltinTier0TableOffset + kBuiltinTier0TableSize;
230241
static const int kIsolateFastCCallCallerFpOffset =
231-
kNumIsolateDataSlots * kApiSystemPointerSize;
242+
kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize;
232243
static const int kIsolateFastCCallCallerPcOffset =
233244
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
234245
static const int kIsolateFastApiCallTargetOffset =
235246
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
236-
static const int kIsolateCageBaseOffset =
237-
kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
238247
static const int kIsolateLongTaskStatsCounterOffset =
239-
kIsolateCageBaseOffset + kApiSystemPointerSize;
240-
static const int kIsolateStackGuardOffset =
241-
kIsolateLongTaskStatsCounterOffset + kApiSizetSize;
248+
kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
242249
static const int kIsolateRootsOffset =
243-
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
250+
kIsolateLongTaskStatsCounterOffset + kApiSizetSize;
244251

245252
static const int kExternalPointerTableBufferOffset = 0;
246253
static const int kExternalPointerTableLengthOffset =
Collapse file

‎deps/v8/include/v8-isolate.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-isolate.h
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,6 @@ class V8_EXPORT Isolate {
613613
void SetAbortOnUncaughtExceptionCallback(
614614
AbortOnUncaughtExceptionCallback callback);
615615

616-
/**
617-
* This specifies the callback called by the upcoming dynamic
618-
* import() language feature to load modules.
619-
*/
620-
V8_DEPRECATED(
621-
"Use the version of SetHostImportModuleDynamicallyCallback that takes a "
622-
"HostImportModuleDynamicallyWithImportAssertionsCallback instead")
623-
void SetHostImportModuleDynamicallyCallback(
624-
HostImportModuleDynamicallyCallback callback);
625-
626616
/**
627617
* This specifies the callback called by the upcoming dynamic
628618
* import() language feature to load modules.
Collapse file

‎deps/v8/include/v8-platform.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-platform.h
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,18 @@ class PageAllocator {
516516
virtual bool CanAllocateSharedPages() { return false; }
517517
};
518518

519+
/**
520+
* V8 Allocator used for allocating zone backings.
521+
*/
522+
class ZoneBackingAllocator {
523+
public:
524+
using MallocFn = void* (*)(size_t);
525+
using FreeFn = void (*)(void*);
526+
527+
virtual MallocFn GetMallocFn() const { return ::malloc; }
528+
virtual FreeFn GetFreeFn() const { return ::free; }
529+
};
530+
519531
/**
520532
* V8 Platform abstraction layer.
521533
*
@@ -534,6 +546,14 @@ class Platform {
534546
return nullptr;
535547
}
536548

549+
/**
550+
* Allows the embedder to specify a custom allocator used for zones.
551+
*/
552+
virtual ZoneBackingAllocator* GetZoneBackingAllocator() {
553+
static ZoneBackingAllocator default_allocator;
554+
return &default_allocator;
555+
}
556+
537557
/**
538558
* Enables the embedder to respond in cases where V8 can't allocate large
539559
* blocks of memory. V8 retries the failed allocation once after calling this
Collapse file

‎deps/v8/src/api/api.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/api/api.cc
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8544,12 +8544,6 @@ void Isolate::SetAbortOnUncaughtExceptionCallback(
85448544
isolate->SetAbortOnUncaughtExceptionCallback(callback);
85458545
}
85468546

8547-
void Isolate::SetHostImportModuleDynamicallyCallback(
8548-
i::Isolate::DeprecatedHostImportModuleDynamicallyCallback callback) {
8549-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8550-
isolate->SetHostImportModuleDynamicallyCallback(callback);
8551-
}
8552-
85538547
void Isolate::SetHostImportModuleDynamicallyCallback(
85548548
HostImportModuleDynamicallyWithImportAssertionsCallback callback) {
85558549
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
Collapse file

‎deps/v8/src/builtins/builtins-definitions.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/builtins/builtins-definitions.h
+50-21Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,40 @@ namespace internal {
3131
// TODO(jgruber): Remove DummyDescriptor once all ASM builtins have been
3232
// properly associated with their descriptor.
3333

34-
#define BUILTIN_LIST_BASE(CPP, TFJ, TFC, TFS, TFH, ASM) \
35-
/* GC write barrirer */ \
36-
TFC(RecordWriteEmitRememberedSetSaveFP, WriteBarrier) \
37-
TFC(RecordWriteOmitRememberedSetSaveFP, WriteBarrier) \
38-
TFC(RecordWriteEmitRememberedSetIgnoreFP, WriteBarrier) \
39-
TFC(RecordWriteOmitRememberedSetIgnoreFP, WriteBarrier) \
40-
TFC(EphemeronKeyBarrierSaveFP, WriteBarrier) \
41-
TFC(EphemeronKeyBarrierIgnoreFP, WriteBarrier) \
42-
\
43-
/* TSAN support for stores in generated code.*/ \
34+
// Builtins are additionally split into tiers, where the tier determines the
35+
// distance of the builtins table from the root register within IsolateData.
36+
//
37+
// - Tier 0 (T0) are guaranteed to be close to the root register and can thus
38+
// be accessed efficiently root-relative calls (so not, e.g., calls from
39+
// generated code when short-builtin-calls is on).
40+
// - T1 builtins have no distance guarantees.
41+
//
42+
// Note, this mechanism works only if the set of T0 builtins is kept as small
43+
// as possible. Please, resist the temptation to add your builtin here unless
44+
// there's a very good reason.
45+
#define BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM) \
46+
/* Deoptimization entries. */ \
47+
ASM(DeoptimizationEntry_Eager, DeoptimizationEntry) \
48+
ASM(DeoptimizationEntry_Soft, DeoptimizationEntry) \
49+
ASM(DeoptimizationEntry_Bailout, DeoptimizationEntry) \
50+
ASM(DeoptimizationEntry_Lazy, DeoptimizationEntry) \
51+
ASM(DynamicCheckMapsTrampoline, DynamicCheckMaps) \
52+
ASM(DynamicCheckMapsWithFeedbackVectorTrampoline, \
53+
DynamicCheckMapsWithFeedbackVector) \
54+
\
55+
/* GC write barrier. */ \
56+
TFC(RecordWriteEmitRememberedSetSaveFP, WriteBarrier) \
57+
TFC(RecordWriteOmitRememberedSetSaveFP, WriteBarrier) \
58+
TFC(RecordWriteEmitRememberedSetIgnoreFP, WriteBarrier) \
59+
TFC(RecordWriteOmitRememberedSetIgnoreFP, WriteBarrier) \
60+
TFC(EphemeronKeyBarrierSaveFP, WriteBarrier) \
61+
TFC(EphemeronKeyBarrierIgnoreFP, WriteBarrier) \
62+
\
63+
/* Adaptor for CPP builtins. */ \
64+
TFC(AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor)
65+
66+
#define BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TFC, TFS, TFH, ASM) \
67+
/* TSAN support for stores in generated code. */ \
4468
IF_TSAN(TFC, TSANRelaxedStore8IgnoreFP, TSANStore) \
4569
IF_TSAN(TFC, TSANRelaxedStore8SaveFP, TSANStore) \
4670
IF_TSAN(TFC, TSANRelaxedStore16IgnoreFP, TSANStore) \
@@ -58,15 +82,12 @@ namespace internal {
5882
IF_TSAN(TFC, TSANSeqCstStore64IgnoreFP, TSANStore) \
5983
IF_TSAN(TFC, TSANSeqCstStore64SaveFP, TSANStore) \
6084
\
61-
/* TSAN support for loads in generated code.*/ \
85+
/* TSAN support for loads in generated code. */ \
6286
IF_TSAN(TFC, TSANRelaxedLoad32IgnoreFP, TSANLoad) \
6387
IF_TSAN(TFC, TSANRelaxedLoad32SaveFP, TSANLoad) \
6488
IF_TSAN(TFC, TSANRelaxedLoad64IgnoreFP, TSANLoad) \
6589
IF_TSAN(TFC, TSANRelaxedLoad64SaveFP, TSANLoad) \
6690
\
67-
/* Adaptor for CPP builtin */ \
68-
TFC(AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor) \
69-
\
7091
/* Calls */ \
7192
/* ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) */ \
7293
ASM(CallFunction_ReceiverIsNullOrUndefined, CallTrampoline) \
@@ -187,10 +208,6 @@ namespace internal {
187208
TFC(CompileLazyDeoptimizedCode, JSTrampoline) \
188209
TFC(InstantiateAsmJs, JSTrampoline) \
189210
ASM(NotifyDeoptimized, Dummy) \
190-
ASM(DeoptimizationEntry_Eager, DeoptimizationEntry) \
191-
ASM(DeoptimizationEntry_Soft, DeoptimizationEntry) \
192-
ASM(DeoptimizationEntry_Bailout, DeoptimizationEntry) \
193-
ASM(DeoptimizationEntry_Lazy, DeoptimizationEntry) \
194211
\
195212
/* Trampolines called when returning from a deoptimization that expects */ \
196213
/* to continue in a JavaScript builtin to finish the functionality of a */ \
@@ -282,10 +299,7 @@ namespace internal {
282299
TFH(HasIndexedInterceptorIC, LoadWithVector) \
283300
\
284301
/* Dynamic check maps */ \
285-
ASM(DynamicCheckMapsTrampoline, DynamicCheckMaps) \
286302
TFC(DynamicCheckMaps, DynamicCheckMaps) \
287-
ASM(DynamicCheckMapsWithFeedbackVectorTrampoline, \
288-
DynamicCheckMapsWithFeedbackVector) \
289303
TFC(DynamicCheckMapsWithFeedbackVector, DynamicCheckMapsWithFeedbackVector) \
290304
\
291305
/* Microtask helpers */ \
@@ -1032,6 +1046,10 @@ namespace internal {
10321046
CPP(CallAsyncModuleFulfilled) \
10331047
CPP(CallAsyncModuleRejected)
10341048

1049+
#define BUILTIN_LIST_BASE(CPP, TFJ, TFC, TFS, TFH, ASM) \
1050+
BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM) \
1051+
BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TFC, TFS, TFH, ASM)
1052+
10351053
#ifdef V8_INTL_SUPPORT
10361054
#define BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
10371055
/* ecma402 #sec-intl.collator */ \
@@ -1218,6 +1236,17 @@ namespace internal {
12181236
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
12191237
BUILTIN_LIST_BYTECODE_HANDLERS(BCH)
12201238

1239+
// See the comment on top of BUILTIN_LIST_BASE_TIER0 for an explanation of
1240+
// tiers.
1241+
#define BUILTIN_LIST_TIER0(CPP, TFJ, TFC, TFS, TFH, BCH, ASM) \
1242+
BUILTIN_LIST_BASE_TIER0(CPP, TFJ, TFC, TFS, TFH, ASM)
1243+
1244+
#define BUILTIN_LIST_TIER1(CPP, TFJ, TFC, TFS, TFH, BCH, ASM) \
1245+
BUILTIN_LIST_BASE_TIER1(CPP, TFJ, TFC, TFS, TFH, ASM) \
1246+
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
1247+
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
1248+
BUILTIN_LIST_BYTECODE_HANDLERS(BCH)
1249+
12211250
// The exception thrown in the following builtins are caught
12221251
// internally and result in a promise rejection.
12231252
#define BUILTIN_PROMISE_REJECTION_PREDICTION_LIST(V) \
Collapse file

‎deps/v8/src/builtins/builtins.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/builtins/builtins.cc
+25-19Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ BytecodeOffset Builtins::GetContinuationBytecodeOffset(Builtin builtin) {
9292
DCHECK(Builtins::KindOf(builtin) == TFJ || Builtins::KindOf(builtin) == TFC ||
9393
Builtins::KindOf(builtin) == TFS);
9494
return BytecodeOffset(BytecodeOffset::kFirstBuiltinContinuationId +
95-
static_cast<int>(builtin));
95+
ToInt(builtin));
9696
}
9797

9898
Builtin Builtins::GetBuiltinFromBytecodeOffset(BytecodeOffset id) {
@@ -182,7 +182,7 @@ Handle<Code> Builtins::code_handle(Builtin builtin) {
182182
// static
183183
int Builtins::GetStackParameterCount(Builtin builtin) {
184184
DCHECK(Builtins::KindOf(builtin) == TFJ);
185-
return builtin_metadata[static_cast<int>(builtin)].data.parameter_count;
185+
return builtin_metadata[ToInt(builtin)].data.parameter_count;
186186
}
187187

188188
// static
@@ -224,7 +224,7 @@ bool Builtins::HasJSLinkage(Builtin builtin) {
224224

225225
// static
226226
const char* Builtins::name(Builtin builtin) {
227-
int index = static_cast<int>(builtin);
227+
int index = ToInt(builtin);
228228
DCHECK(IsBuiltinId(index));
229229
return builtin_metadata[index].name;
230230
}
@@ -262,7 +262,7 @@ void Builtins::PrintBuiltinSize() {
262262
// static
263263
Address Builtins::CppEntryOf(Builtin builtin) {
264264
DCHECK(Builtins::IsCpp(builtin));
265-
return builtin_metadata[static_cast<int>(builtin)].data.cpp_entry;
265+
return builtin_metadata[ToInt(builtin)].data.cpp_entry;
266266
}
267267

268268
// static
@@ -292,18 +292,24 @@ bool Builtins::IsIsolateIndependentBuiltin(const Code code) {
292292
}
293293

294294
// static
295-
void Builtins::InitializeBuiltinEntryTable(Isolate* isolate) {
296-
EmbeddedData d = EmbeddedData::FromBlob(isolate);
297-
Address* builtin_entry_table = isolate->builtin_entry_table();
298-
for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast;
299-
++builtin) {
300-
// TODO(jgruber,chromium:1020986): Remove the CHECK once the linked issue is
301-
// resolved.
302-
CHECK(
303-
Builtins::IsBuiltinId(isolate->heap()->builtin(builtin).builtin_id()));
304-
DCHECK(isolate->heap()->builtin(builtin).is_off_heap_trampoline());
305-
builtin_entry_table[static_cast<int>(builtin)] =
306-
d.InstructionStartOfBuiltin(builtin);
295+
void Builtins::InitializeIsolateDataTables(Isolate* isolate) {
296+
EmbeddedData embedded_data = EmbeddedData::FromBlob(isolate);
297+
IsolateData* isolate_data = isolate->isolate_data();
298+
299+
// The entry table.
300+
for (Builtin i = Builtins::kFirst; i <= Builtins::kLast; ++i) {
301+
DCHECK(Builtins::IsBuiltinId(isolate->heap()->builtin(i).builtin_id()));
302+
DCHECK(isolate->heap()->builtin(i).is_off_heap_trampoline());
303+
isolate_data->builtin_entry_table()[ToInt(i)] =
304+
embedded_data.InstructionStartOfBuiltin(i);
305+
}
306+
307+
// T0 tables.
308+
for (Builtin i = Builtins::kFirst; i <= Builtins::kLastTier0; ++i) {
309+
const int ii = ToInt(i);
310+
isolate_data->builtin_tier0_entry_table()[ii] =
311+
isolate_data->builtin_entry_table()[ii];
312+
isolate_data->builtin_tier0_table()[ii] = isolate_data->builtin_table()[ii];
307313
}
308314
}
309315

@@ -314,10 +320,10 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) {
314320
return; // No need to iterate the entire table in this case.
315321
}
316322

317-
Address* builtins = isolate->builtins_table();
323+
Address* builtins = isolate->builtin_table();
318324
int i = 0;
319325
HandleScope scope(isolate);
320-
for (; i < static_cast<int>(Builtin::kFirstBytecodeHandler); i++) {
326+
for (; i < ToInt(Builtin::kFirstBytecodeHandler); i++) {
321327
Handle<AbstractCode> code(AbstractCode::cast(Object(builtins[i])), isolate);
322328
PROFILE(isolate, CodeCreateEvent(CodeEventListener::BUILTIN_TAG, code,
323329
Builtins::name(FromInt(i))));
@@ -420,7 +426,7 @@ Handle<ByteArray> Builtins::GenerateOffHeapTrampolineRelocInfo(
420426

421427
Builtins::Kind Builtins::KindOf(Builtin builtin) {
422428
DCHECK(IsBuiltinId(builtin));
423-
return builtin_metadata[static_cast<int>(builtin)].kind;
429+
return builtin_metadata[ToInt(builtin)].kind;
424430
}
425431

426432
// static

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.