Skip to content

Commit 76c9e86

Browse files
mmarchinitargos
authored andcommitted
deps: patch V8 to 7.4.288.27
Refs: v8/v8@7.4.288.21...7.4.288.27 PR-URL: #27615 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 691866f commit 76c9e86

24 files changed

+349
-102
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 7
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 288
14-
#define V8_PATCH_LEVEL 21
14+
#define V8_PATCH_LEVEL 27
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/api.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -8538,7 +8538,8 @@ void Isolate::EnqueueMicrotask(Local<Function> v8_function) {
85388538
if (!i::JSReceiver::GetContextForMicrotask(function).ToHandle(
85398539
&handler_context))
85408540
handler_context = isolate->native_context();
8541-
handler_context->microtask_queue()->EnqueueMicrotask(this, v8_function);
8541+
MicrotaskQueue* microtask_queue = handler_context->microtask_queue();
8542+
if (microtask_queue) microtask_queue->EnqueueMicrotask(this, v8_function);
85428543
}
85438544

85448545
void Isolate::EnqueueMicrotask(MicrotaskCallback callback, void* data) {

deps/v8/src/arm64/assembler-arm64.cc

+2-13
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,9 @@ CPURegList CPURegList::GetCalleeSavedV(int size) {
109109

110110

111111
CPURegList CPURegList::GetCallerSaved(int size) {
112-
#if defined(V8_OS_WIN)
113-
// x18 is reserved as platform register on Windows arm64.
112+
// x18 is the platform register and is reserved for the use of platform ABIs.
114113
// Registers x0-x17 and lr (x30) are caller-saved.
115114
CPURegList list = CPURegList(CPURegister::kRegister, size, 0, 17);
116-
#else
117-
// Registers x0-x18 and lr (x30) are caller-saved.
118-
CPURegList list = CPURegList(CPURegister::kRegister, size, 0, 18);
119-
#endif
120115
list.Combine(lr);
121116
return list;
122117
}
@@ -149,13 +144,7 @@ CPURegList CPURegList::GetSafepointSavedRegisters() {
149144
list.Remove(16);
150145
list.Remove(17);
151146

152-
// Don't add x18 to safepoint list on Windows arm64 because it is reserved
153-
// as platform register.
154-
#if !defined(V8_OS_WIN)
155-
// Add x18 to the safepoint list, as although it's not in kJSCallerSaved, it
156-
// is a caller-saved register according to the procedure call standard.
157-
list.Combine(18);
158-
#endif
147+
// x18 is the platform register and is reserved for the use of platform ABIs.
159148

160149
// Add the link register (x30) to the safepoint list.
161150
list.Combine(30);

deps/v8/src/arm64/deoptimizer-arm64.cc

+7-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ void CopyRegListToFrame(MacroAssembler* masm, const Register& dst,
5555
masm->Sub(dst, dst, dst_offset);
5656
}
5757

58+
// TODO(jgruber): There's a hack here to explicitly skip restoration of the
59+
// so-called 'arm64 platform register' x18. The register may be in use by the
60+
// OS, thus we should not clobber it. Instead of this hack, it would be nicer
61+
// not to add x18 to the list of saved registers in the first place. The
62+
// complication here is that we require `reg_list.Count() % 2 == 0` in multiple
63+
// spots.
5864
void RestoreRegList(MacroAssembler* masm, const CPURegList& reg_list,
5965
const Register& src_base, int src_offset) {
6066
DCHECK_EQ(reg_list.Count() % 2, 0);
@@ -68,23 +74,19 @@ void RestoreRegList(MacroAssembler* masm, const CPURegList& reg_list,
6874
Register src = temps.AcquireX();
6975
masm->Add(src, src_base, src_offset);
7076

71-
#if defined(V8_OS_WIN)
72-
// x18 is reserved as platform register on Windows.
77+
// x18 is the platform register and is reserved for the use of platform ABIs.
7378
restore_list.Remove(x18);
74-
#endif
7579

7680
// Restore every register in restore_list from src.
7781
while (!restore_list.IsEmpty()) {
7882
CPURegister reg0 = restore_list.PopLowestIndex();
7983
CPURegister reg1 = restore_list.PopLowestIndex();
8084
int offset0 = reg0.code() * reg_size;
8185

82-
#if defined(V8_OS_WIN)
8386
if (reg1 == NoCPUReg) {
8487
masm->Ldr(reg0, MemOperand(src, offset0));
8588
break;
8689
}
87-
#endif
8890

8991
int offset1 = reg1.code() * reg_size;
9092

deps/v8/src/arm64/macro-assembler-arm64.cc

+18-32
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,15 @@ int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
4848
// However, we leave it in the argument list to mirror the prototype for
4949
// Push/PopCallerSaved().
5050

51-
#if defined(V8_OS_WIN)
52-
// X18 is excluded from caller-saved register list on Windows ARM64 which
53-
// makes caller-saved registers in odd number. padreg is used accordingly
54-
// to maintain the alignment.
51+
// X18 is excluded from caller-saved register list on ARM64 which makes
52+
// caller-saved registers in odd number. padreg is used accordingly to
53+
// maintain the alignment.
5554
DCHECK_EQ(list.Count() % 2, 1);
5655
if (exclusion.Is(no_reg)) {
5756
bytes += kXRegSizeInBits / 8;
5857
} else {
5958
bytes -= kXRegSizeInBits / 8;
6059
}
61-
#else
62-
DCHECK_EQ(list.Count() % 2, 0);
63-
USE(exclusion);
64-
#endif
6560

6661
bytes += list.Count() * kXRegSizeInBits / 8;
6762

@@ -77,21 +72,13 @@ int TurboAssembler::PushCallerSaved(SaveFPRegsMode fp_mode,
7772
int bytes = 0;
7873
auto list = kCallerSaved;
7974

80-
#if defined(V8_OS_WIN)
81-
// X18 is excluded from caller-saved register list on Windows ARM64, use
82-
// padreg accordingly to maintain alignment.
75+
// X18 is excluded from caller-saved register list on ARM64, use padreg
76+
// accordingly to maintain alignment.
8377
if (!exclusion.Is(no_reg)) {
8478
list.Remove(exclusion);
8579
} else {
8680
list.Combine(padreg);
8781
}
88-
#else
89-
if (!exclusion.Is(no_reg)) {
90-
// Replace the excluded register with padding to maintain alignment.
91-
list.Remove(exclusion);
92-
list.Combine(padreg);
93-
}
94-
#endif
9582

9683
DCHECK_EQ(list.Count() % 2, 0);
9784
PushCPURegList(list);
@@ -115,21 +102,13 @@ int TurboAssembler::PopCallerSaved(SaveFPRegsMode fp_mode, Register exclusion) {
115102

116103
auto list = kCallerSaved;
117104

118-
#if defined(V8_OS_WIN)
119-
// X18 is excluded from caller-saved register list on Windows ARM64, use
120-
// padreg accordingly to maintain alignment.
105+
// X18 is excluded from caller-saved register list on ARM64, use padreg
106+
// accordingly to maintain alignment.
121107
if (!exclusion.Is(no_reg)) {
122108
list.Remove(exclusion);
123109
} else {
124110
list.Combine(padreg);
125111
}
126-
#else
127-
if (!exclusion.Is(no_reg)) {
128-
// Replace the excluded register with padding to maintain alignment.
129-
list.Remove(exclusion);
130-
list.Combine(padreg);
131-
}
132-
#endif
133112

134113
DCHECK_EQ(list.Count() % 2, 0);
135114
PopCPURegList(list);
@@ -3389,14 +3368,20 @@ void MacroAssembler::Printf(const char * format,
33893368
TmpList()->set_list(0);
33903369
FPTmpList()->set_list(0);
33913370

3371+
// x18 is the platform register and is reserved for the use of platform ABIs.
3372+
// It is not part of the kCallerSaved list, but we add it here anyway to
3373+
// ensure `reg_list.Count() % 2 == 0` which is required in multiple spots.
3374+
CPURegList saved_registers = kCallerSaved;
3375+
saved_registers.Combine(x18.code());
3376+
33923377
// Preserve all caller-saved registers as well as NZCV.
33933378
// PushCPURegList asserts that the size of each list is a multiple of 16
33943379
// bytes.
3395-
PushCPURegList(kCallerSaved);
3380+
PushCPURegList(saved_registers);
33963381
PushCPURegList(kCallerSavedV);
33973382

33983383
// We can use caller-saved registers as scratch values (except for argN).
3399-
CPURegList tmp_list = kCallerSaved;
3384+
CPURegList tmp_list = saved_registers;
34003385
CPURegList fp_tmp_list = kCallerSavedV;
34013386
tmp_list.Remove(arg0, arg1, arg2, arg3);
34023387
fp_tmp_list.Remove(arg0, arg1, arg2, arg3);
@@ -3416,7 +3401,8 @@ void MacroAssembler::Printf(const char * format,
34163401
// to PrintfNoPreserve as an argument.
34173402
Register arg_sp = temps.AcquireX();
34183403
Add(arg_sp, sp,
3419-
kCallerSaved.TotalSizeInBytes() + kCallerSavedV.TotalSizeInBytes());
3404+
saved_registers.TotalSizeInBytes() +
3405+
kCallerSavedV.TotalSizeInBytes());
34203406
if (arg0_sp) arg0 = Register::Create(arg_sp.code(), arg0.SizeInBits());
34213407
if (arg1_sp) arg1 = Register::Create(arg_sp.code(), arg1.SizeInBits());
34223408
if (arg2_sp) arg2 = Register::Create(arg_sp.code(), arg2.SizeInBits());
@@ -3441,7 +3427,7 @@ void MacroAssembler::Printf(const char * format,
34413427
}
34423428

34433429
PopCPURegList(kCallerSavedV);
3444-
PopCPURegList(kCallerSaved);
3430+
PopCPURegList(saved_registers);
34453431

34463432
TmpList()->set_list(old_tmp_list);
34473433
FPTmpList()->set_list(old_fp_tmp_list);

deps/v8/src/arm64/register-arm64.h

+2-14
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,13 @@ namespace internal {
2828
R(x16) R(x17) R(x18) R(x19) R(x20) R(x21) R(x22) R(x23) \
2929
R(x24) R(x25) R(x26) R(x27) R(x28) R(x29) R(x30) R(x31)
3030

31-
#if defined(V8_OS_WIN)
32-
// x18 is reserved as platform register on Windows ARM64.
31+
// x18 is the platform register and is reserved for the use of platform ABIs.
32+
// It is known to be reserved by the OS at least on Windows and iOS.
3333
#define ALLOCATABLE_GENERAL_REGISTERS(R) \
3434
R(x0) R(x1) R(x2) R(x3) R(x4) R(x5) R(x6) R(x7) \
3535
R(x8) R(x9) R(x10) R(x11) R(x12) R(x13) R(x14) R(x15) \
3636
R(x19) R(x20) R(x21) R(x22) R(x23) R(x24) R(x25) \
3737
R(x27) R(x28)
38-
#else
39-
#define ALLOCATABLE_GENERAL_REGISTERS(R) \
40-
R(x0) R(x1) R(x2) R(x3) R(x4) R(x5) R(x6) R(x7) \
41-
R(x8) R(x9) R(x10) R(x11) R(x12) R(x13) R(x14) R(x15) \
42-
R(x18) R(x19) R(x20) R(x21) R(x22) R(x23) R(x24) R(x25) \
43-
R(x27) R(x28)
44-
#endif
4538

4639
#define FLOAT_REGISTERS(V) \
4740
V(s0) V(s1) V(s2) V(s3) V(s4) V(s5) V(s6) V(s7) \
@@ -728,12 +721,7 @@ constexpr Register kJSFunctionRegister = x1;
728721
constexpr Register kContextRegister = cp;
729722
constexpr Register kAllocateSizeRegister = x1;
730723

731-
#if defined(V8_OS_WIN)
732-
// x18 is reserved as platform register on Windows ARM64.
733724
constexpr Register kSpeculationPoisonRegister = x23;
734-
#else
735-
constexpr Register kSpeculationPoisonRegister = x18;
736-
#endif
737725

738726
constexpr Register kInterpreterAccumulatorRegister = x0;
739727
constexpr Register kInterpreterBytecodeOffsetRegister = x19;

deps/v8/src/builtins/arm64/builtins-arm64.cc

-12
Original file line numberDiff line numberDiff line change
@@ -1278,15 +1278,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
12781278
__ Mov(
12791279
kInterpreterDispatchTableRegister,
12801280
ExternalReference::interpreter_dispatch_table_address(masm->isolate()));
1281-
#if defined(V8_OS_WIN)
12821281
__ Ldrb(x23, MemOperand(kInterpreterBytecodeArrayRegister,
12831282
kInterpreterBytecodeOffsetRegister));
12841283
__ Mov(x1, Operand(x23, LSL, kSystemPointerSizeLog2));
1285-
#else
1286-
__ Ldrb(x18, MemOperand(kInterpreterBytecodeArrayRegister,
1287-
kInterpreterBytecodeOffsetRegister));
1288-
__ Mov(x1, Operand(x18, LSL, kSystemPointerSizeLog2));
1289-
#endif
12901284
__ Ldr(kJavaScriptCallCodeStartRegister,
12911285
MemOperand(kInterpreterDispatchTableRegister, x1));
12921286
__ Call(kJavaScriptCallCodeStartRegister);
@@ -1531,15 +1525,9 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
15311525
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
15321526

15331527
// Dispatch to the target bytecode.
1534-
#if defined(V8_OS_WIN)
15351528
__ Ldrb(x23, MemOperand(kInterpreterBytecodeArrayRegister,
15361529
kInterpreterBytecodeOffsetRegister));
15371530
__ Mov(x1, Operand(x23, LSL, kSystemPointerSizeLog2));
1538-
#else
1539-
__ Ldrb(x18, MemOperand(kInterpreterBytecodeArrayRegister,
1540-
kInterpreterBytecodeOffsetRegister));
1541-
__ Mov(x1, Operand(x18, LSL, kSystemPointerSizeLog2));
1542-
#endif
15431531
__ Ldr(kJavaScriptCallCodeStartRegister,
15441532
MemOperand(kInterpreterDispatchTableRegister, x1));
15451533
__ Jump(kJavaScriptCallCodeStartRegister);

deps/v8/src/compiler/access-info.cc

+8
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ bool AccessInfoFactory::ComputeDataFieldAccessInfo(
327327
PropertyDetails const details = descriptors->GetDetails(number);
328328
int index = descriptors->GetFieldIndex(number);
329329
Representation details_representation = details.representation();
330+
if (details_representation.IsNone()) {
331+
// The ICs collect feedback in PREMONOMORPHIC state already,
332+
// but at this point the {receiver_map} might still contain
333+
// fields for which the representation has not yet been
334+
// determined by the runtime. So we need to catch this case
335+
// here and fall back to use the regular IC logic instead.
336+
return false;
337+
}
330338
FieldIndex field_index =
331339
FieldIndex::ForPropertyIndex(*map, index, details_representation);
332340
Type field_type = Type::NonInternal();

deps/v8/src/compiler/int64-lowering.cc

+18-3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ int GetReturnCountAfterLowering(Signature<MachineRepresentation>* signature) {
119119

120120
void Int64Lowering::LowerWord64AtomicBinop(Node* node, const Operator* op) {
121121
DCHECK_EQ(5, node->InputCount());
122+
LowerMemoryBaseAndIndex(node);
122123
Node* value = node->InputAt(2);
123124
node->ReplaceInput(2, GetReplacementLow(value));
124125
node->InsertInput(zone(), 3, GetReplacementHigh(value));
@@ -143,9 +144,6 @@ int Int64Lowering::GetParameterCountAfterLowering(
143144

144145
void Int64Lowering::GetIndexNodes(Node* index, Node*& index_low,
145146
Node*& index_high) {
146-
if (HasReplacementLow(index)) {
147-
index = GetReplacementLow(index);
148-
}
149147
#if defined(V8_TARGET_LITTLE_ENDIAN)
150148
index_low = index;
151149
index_high = graph()->NewNode(machine()->Int32Add(), index,
@@ -179,6 +177,7 @@ void Int64Lowering::LowerNode(Node* node) {
179177
}
180178

181179
if (rep == MachineRepresentation::kWord64) {
180+
LowerMemoryBaseAndIndex(node);
182181
Node* base = node->InputAt(0);
183182
Node* index = node->InputAt(1);
184183
Node* index_low;
@@ -228,6 +227,7 @@ void Int64Lowering::LowerNode(Node* node) {
228227
// a new store node to store the high word. The effect and control edges
229228
// are copied from the original store to the new store node, the effect
230229
// edge of the original store is redirected to the new store.
230+
LowerMemoryBaseAndIndex(node);
231231
Node* base = node->InputAt(0);
232232
Node* index = node->InputAt(1);
233233
Node* index_low;
@@ -900,6 +900,7 @@ void Int64Lowering::LowerNode(Node* node) {
900900
DCHECK_EQ(5, node->InputCount());
901901
MachineRepresentation rep = AtomicStoreRepresentationOf(node->op());
902902
if (rep == MachineRepresentation::kWord64) {
903+
LowerMemoryBaseAndIndex(node);
903904
Node* value = node->InputAt(2);
904905
node->ReplaceInput(2, GetReplacementLow(value));
905906
node->InsertInput(zone(), 3, GetReplacementHigh(value));
@@ -930,6 +931,7 @@ void Int64Lowering::LowerNode(Node* node) {
930931
case IrOpcode::kWord64AtomicCompareExchange: {
931932
MachineType type = AtomicOpType(node->op());
932933
if (type == MachineType::Uint64()) {
934+
LowerMemoryBaseAndIndex(node);
933935
Node* old_value = node->InputAt(2);
934936
Node* new_value = node->InputAt(3);
935937
node->ReplaceInput(2, GetReplacementLow(old_value));
@@ -1051,6 +1053,19 @@ void Int64Lowering::ReplaceNodeWithProjections(Node* node) {
10511053
ReplaceNode(node, low_node, high_node);
10521054
}
10531055

1056+
void Int64Lowering::LowerMemoryBaseAndIndex(Node* node) {
1057+
DCHECK(node != nullptr);
1058+
// Low word only replacements for memory operands for 32-bit address space.
1059+
Node* base = node->InputAt(0);
1060+
Node* index = node->InputAt(1);
1061+
if (HasReplacementLow(base)) {
1062+
node->ReplaceInput(0, GetReplacementLow(base));
1063+
}
1064+
if (HasReplacementLow(index)) {
1065+
node->ReplaceInput(1, GetReplacementLow(index));
1066+
}
1067+
}
1068+
10541069
} // namespace compiler
10551070
} // namespace internal
10561071
} // namespace v8

deps/v8/src/compiler/int64-lowering.h

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class V8_EXPORT_PRIVATE Int64Lowering {
6161
void PreparePhiReplacement(Node* phi);
6262
void GetIndexNodes(Node* index, Node*& index_low, Node*& index_high);
6363
void ReplaceNodeWithProjections(Node* node);
64+
void LowerMemoryBaseAndIndex(Node* node);
6465

6566
struct NodeState {
6667
Node* node;

deps/v8/src/conversions-inl.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,24 @@ inline unsigned int FastD2UI(double x) {
5959

6060

6161
inline float DoubleToFloat32(double x) {
62-
typedef std::numeric_limits<float> limits;
63-
if (x > limits::max()) return limits::infinity();
64-
if (x < limits::lowest()) return -limits::infinity();
62+
using limits = std::numeric_limits<float>;
63+
if (x > limits::max()) {
64+
// kRoundingThreshold is the maximum double that rounds down to
65+
// the maximum representable float. Its mantissa bits are:
66+
// 1111111111111111111111101111111111111111111111111111
67+
// [<--- float range --->]
68+
// Note the zero-bit right after the float mantissa range, which
69+
// determines the rounding-down.
70+
static const double kRoundingThreshold = 3.4028235677973362e+38;
71+
if (x <= kRoundingThreshold) return limits::max();
72+
return limits::infinity();
73+
}
74+
if (x < limits::lowest()) {
75+
// Same as above, mirrored to negative numbers.
76+
static const double kRoundingThreshold = -3.4028235677973362e+38;
77+
if (x >= kRoundingThreshold) return limits::lowest();
78+
return -limits::infinity();
79+
}
6580
return static_cast<float>(x);
6681
}
6782

0 commit comments

Comments
 (0)