@@ -31,16 +31,40 @@ namespace internal {
31
31
// TODO(jgruber): Remove DummyDescriptor once all ASM builtins have been
32
32
// properly associated with their descriptor.
33
33
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. */ \
44
68
IF_TSAN (TFC, TSANRelaxedStore8IgnoreFP, TSANStore) \
45
69
IF_TSAN (TFC, TSANRelaxedStore8SaveFP, TSANStore) \
46
70
IF_TSAN (TFC, TSANRelaxedStore16IgnoreFP, TSANStore) \
@@ -58,15 +82,12 @@ namespace internal {
58
82
IF_TSAN (TFC, TSANSeqCstStore64IgnoreFP, TSANStore) \
59
83
IF_TSAN (TFC, TSANSeqCstStore64SaveFP, TSANStore) \
60
84
\
61
- /* TSAN support for loads in generated code.*/ \
85
+ /* TSAN support for loads in generated code. */ \
62
86
IF_TSAN (TFC, TSANRelaxedLoad32IgnoreFP, TSANLoad) \
63
87
IF_TSAN (TFC, TSANRelaxedLoad32SaveFP, TSANLoad) \
64
88
IF_TSAN (TFC, TSANRelaxedLoad64IgnoreFP, TSANLoad) \
65
89
IF_TSAN (TFC, TSANRelaxedLoad64SaveFP, TSANLoad) \
66
90
\
67
- /* Adaptor for CPP builtin */ \
68
- TFC (AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor) \
69
- \
70
91
/* Calls */ \
71
92
/* ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) */ \
72
93
ASM (CallFunction_ReceiverIsNullOrUndefined, CallTrampoline) \
@@ -187,10 +208,6 @@ namespace internal {
187
208
TFC (CompileLazyDeoptimizedCode, JSTrampoline) \
188
209
TFC (InstantiateAsmJs, JSTrampoline) \
189
210
ASM (NotifyDeoptimized, Dummy) \
190
- ASM (DeoptimizationEntry_Eager, DeoptimizationEntry) \
191
- ASM (DeoptimizationEntry_Soft, DeoptimizationEntry) \
192
- ASM (DeoptimizationEntry_Bailout, DeoptimizationEntry) \
193
- ASM (DeoptimizationEntry_Lazy, DeoptimizationEntry) \
194
211
\
195
212
/* Trampolines called when returning from a deoptimization that expects */ \
196
213
/* to continue in a JavaScript builtin to finish the functionality of a */ \
@@ -282,10 +299,7 @@ namespace internal {
282
299
TFH (HasIndexedInterceptorIC, LoadWithVector) \
283
300
\
284
301
/* Dynamic check maps */ \
285
- ASM (DynamicCheckMapsTrampoline, DynamicCheckMaps) \
286
302
TFC (DynamicCheckMaps, DynamicCheckMaps) \
287
- ASM (DynamicCheckMapsWithFeedbackVectorTrampoline, \
288
- DynamicCheckMapsWithFeedbackVector) \
289
303
TFC (DynamicCheckMapsWithFeedbackVector, DynamicCheckMapsWithFeedbackVector) \
290
304
\
291
305
/* Microtask helpers */ \
@@ -1032,6 +1046,10 @@ namespace internal {
1032
1046
CPP (CallAsyncModuleFulfilled) \
1033
1047
CPP (CallAsyncModuleRejected)
1034
1048
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
+
1035
1053
#ifdef V8_INTL_SUPPORT
1036
1054
#define BUILTIN_LIST_INTL (CPP, TFJ, TFS ) \
1037
1055
/* ecma402 #sec-intl.collator */ \
@@ -1218,6 +1236,17 @@ namespace internal {
1218
1236
BUILTIN_LIST_INTL (CPP, TFJ, TFS) \
1219
1237
BUILTIN_LIST_BYTECODE_HANDLERS (BCH)
1220
1238
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
+
1221
1250
// The exception thrown in the following builtins are caught
1222
1251
// internally and result in a promise rejection.
1223
1252
#define BUILTIN_PROMISE_REJECTION_PREDICTION_LIST (V ) \
0 commit comments