Skip to content

Commit e0ca993

Browse files
deps: patch V8 to 14.2.231.14
Refs: v8/v8@14.2.231.9...14.2.231.14 PR-URL: nodejs/node#60413 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 1f6b681 commit e0ca993

17 files changed

+372
-96
lines changed

deps/v8/include/v8-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 14
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 231
14-
#define V8_PATCH_LEVEL 9
14+
#define V8_PATCH_LEVEL 14
1515

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

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

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,12 +3185,9 @@ void ReloadParentStack(MacroAssembler* masm, Register return_reg,
31853185
Register parent = tmp2;
31863186
__ Ld_d(parent, MemOperand(active_stack, wasm::kStackParentOffset));
31873187

3188-
// Update active stack.
3189-
__ StoreRootRelative(IsolateData::active_stack_offset(), parent);
3190-
31913188
// Switch stack!
3192-
SwitchStacks(masm, ExternalReference::wasm_return_stack(), active_stack,
3193-
nullptr, no_reg, {return_reg, return_value, context, parent});
3189+
SwitchStacks(masm, ExternalReference::wasm_return_stack(), parent, nullptr,
3190+
no_reg, {return_reg, return_value, context, parent});
31943191
LoadJumpBuffer(masm, parent, false, tmp3);
31953192
}
31963193

@@ -3425,22 +3422,18 @@ void Builtins::Generate_WasmSuspend(MacroAssembler* masm) {
34253422
ResetWasmJspiFrameStackSlots(masm);
34263423

34273424
Label resume;
3428-
DEFINE_REG(stack);
3429-
__ LoadRootRelative(stack, IsolateData::active_stack_offset());
34303425
DEFINE_REG(scratch);
34313426

3432-
// Update active stack.
34333427
DEFINE_REG(parent);
34343428
__ LoadProtectedPointerField(
34353429
parent, FieldMemOperand(suspender, WasmSuspenderObject::kParentOffset));
34363430
DEFINE_REG(target_stack);
34373431
__ LoadExternalPointerField(
34383432
target_stack, FieldMemOperand(parent, WasmSuspenderObject::kStackOffset),
34393433
kWasmStackMemoryTag);
3440-
__ StoreRootRelative(IsolateData::active_stack_offset(), target_stack);
34413434

3442-
SwitchStacks(masm, ExternalReference::wasm_suspend_stack(), stack, &resume,
3443-
no_reg, {target_stack, suspender, parent});
3435+
SwitchStacks(masm, ExternalReference::wasm_suspend_stack(), target_stack,
3436+
&resume, no_reg, {target_stack, suspender, parent});
34443437
__ StoreRootRelative(IsolateData::active_suspender_offset(), parent);
34453438
__ LoadTaggedField(
34463439
kReturnRegister0,
@@ -3512,11 +3505,8 @@ void Generate_WasmResumeHelper(MacroAssembler* masm, wasm::OnResume on_resume) {
35123505
target_stack,
35133506
FieldMemOperand(suspender, WasmSuspenderObject::kStackOffset),
35143507
kWasmStackMemoryTag);
3515-
3516-
__ StoreRootRelative(IsolateData::active_stack_offset(), target_stack);
3517-
SwitchStacks(masm, ExternalReference::wasm_resume_jspi_stack(), active_stack,
3508+
SwitchStacks(masm, ExternalReference::wasm_resume_jspi_stack(), target_stack,
35183509
&suspend, suspender, {target_stack});
3519-
35203510
regs.ResetExcept(target_stack);
35213511

35223512
// -------------------------------------------
@@ -3563,11 +3553,8 @@ void Builtins::Generate_WasmFXResume(MacroAssembler* masm) {
35633553
__ EnterFrame(StackFrame::WASM_STACK_EXIT);
35643554
Register target_stack = WasmFXResumeDescriptor::GetRegisterParameter(0);
35653555
Label suspend;
3566-
Register active_stack = a0;
3567-
__ LoadRootRelative(active_stack, IsolateData::active_stack_offset());
3568-
__ StoreRootRelative(IsolateData::active_stack_offset(), target_stack);
35693556
SwitchStacks(masm, ExternalReference::wasm_resume_wasmfx_stack(),
3570-
active_stack, &suspend, no_reg, {target_stack});
3557+
target_stack, &suspend, no_reg, {target_stack});
35713558
LoadJumpBuffer(masm, target_stack, true, a1);
35723559
__ Trap();
35733560
__ bind(&suspend);
@@ -3580,9 +3567,8 @@ void Builtins::Generate_WasmFXReturn(MacroAssembler* masm) {
35803567
__ LoadRootRelative(active_stack, IsolateData::active_stack_offset());
35813568
Register parent = a1;
35823569
__ Move(parent, MemOperand(active_stack, wasm::kStackParentOffset));
3583-
__ StoreRootRelative(IsolateData::active_stack_offset(), parent);
3584-
SwitchStacks(masm, ExternalReference::wasm_return_stack(), active_stack,
3585-
nullptr, no_reg, {parent});
3570+
SwitchStacks(masm, ExternalReference::wasm_return_stack(), parent, nullptr,
3571+
no_reg, {parent});
35863572
LoadJumpBuffer(masm, parent, true, a2);
35873573
__ Trap();
35883574
}
@@ -3599,14 +3585,15 @@ void SwitchToAllocatedStack(MacroAssembler* masm, RegisterAllocator& regs,
35993585
Label* suspend) {
36003586
ResetWasmJspiFrameStackSlots(masm);
36013587
DEFINE_SCOPED(scratch)
3602-
DEFINE_REG(parent_stack)
3603-
__ LoadRootRelative(parent_stack, IsolateData::active_stack_offset());
3604-
__ Ld_d(parent_stack, MemOperand(parent_stack, wasm::kStackParentOffset));
3605-
3606-
SwitchStacks(masm, ExternalReference::wasm_start_stack(), parent_stack,
3607-
suspend, no_reg, {wasm_instance, wrapper_buffer});
3588+
DEFINE_REG(stack)
3589+
__ LoadRootRelative(stack, IsolateData::active_suspender_offset());
3590+
__ LoadExternalPointerField(
3591+
stack, FieldMemOperand(stack, WasmSuspenderObject::kStackOffset),
3592+
kWasmStackMemoryTag);
3593+
SwitchStacks(masm, ExternalReference::wasm_start_stack(), stack, suspend,
3594+
no_reg, {wasm_instance, wrapper_buffer});
36083595

3609-
FREE_REG(parent_stack);
3596+
FREE_REG(stack);
36103597
// Save the old stack's fp in t0, and use it to access the parameters in
36113598
// the parent frame.
36123599
regs.Pinned(t1, &original_fp);

deps/v8/src/codegen/loong64/macro-assembler-loong64.cc

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,58 @@ void MacroAssembler::PushStandardFrame(Register function_reg) {
142142
Add_d(fp, sp, Operand(offset));
143143
}
144144

145+
void MacroAssembler::PreCheckSkippedWriteBarrier(Register object,
146+
Register value,
147+
Register scratch, Label* ok) {
148+
ASM_CODE_COMMENT(this);
149+
DCHECK(!AreAliased(object, scratch));
150+
DCHECK(!AreAliased(value, scratch));
151+
152+
// The most common case: Static write barrier elimination is allowed on the
153+
// last young allocation.
154+
{
155+
UseScratchRegisterScope temps(this);
156+
Register scratch1 = temps.Acquire();
157+
Sub_d(scratch, object, kHeapObjectTag);
158+
Ld_d(scratch1, MemOperand(kRootRegister,
159+
IsolateData::last_young_allocation_offset()));
160+
Branch(ok, Condition::kEqual, scratch, Operand(scratch1));
161+
}
162+
163+
// Write barier can also be removed if value is in read-only space.
164+
CheckPageFlag(value, MemoryChunk::kIsInReadOnlyHeapMask, ne, ok);
165+
166+
Label not_ok;
167+
168+
// Handle allocation folding, allow WB removal if:
169+
// LAB start <= last_young_allocation_ < (object address+1) < LAB top
170+
// Note that object has tag bit set, so object == object address+1.
171+
{
172+
UseScratchRegisterScope temps(this);
173+
Register scratch1 = temps.Acquire();
174+
175+
// Check LAB start <= last_young_allocation_.
176+
Ld_d(scratch, MemOperand(kRootRegister,
177+
IsolateData::new_allocation_info_start_offset()));
178+
Ld_d(scratch1, MemOperand(kRootRegister,
179+
IsolateData::last_young_allocation_offset()));
180+
Branch(&not_ok, Condition::kUnsignedGreaterThan, scratch,
181+
Operand(scratch1));
182+
183+
// Check last_young_allocation_ < (object address+1).
184+
Branch(&not_ok, Condition::kUnsignedGreaterThanEqual, scratch1,
185+
Operand(object));
186+
187+
// Check (object address+1) < LAB top.
188+
Ld_d(scratch, MemOperand(kRootRegister,
189+
IsolateData::new_allocation_info_top_offset()));
190+
Branch(ok, Condition::kUnsignedLessThan, object, Operand(scratch));
191+
}
192+
193+
// Slow path: Potentially check more cases in C++.
194+
bind(&not_ok);
195+
}
196+
145197
// Clobbers object, dst, value, and ra, if (ra_status == kRAHasBeenSaved)
146198
// The register 'object' contains a heap object pointer. The heap object
147199
// tag is shifted away.
@@ -582,11 +634,33 @@ void MacroAssembler::CallVerifySkippedWriteBarrierStubSaveRegisters(
582634
void MacroAssembler::CallVerifySkippedWriteBarrierStub(Register object,
583635
Register value) {
584636
ASM_CODE_COMMENT(this);
637+
UseScratchRegisterScope temps(this);
638+
Register scratch = temps.Acquire();
639+
PrepareCallCFunction(2, scratch);
585640
MovePair(kCArgRegs[0], object, kCArgRegs[1], value);
586641
CallCFunction(ExternalReference::verify_skipped_write_barrier(), 2,
587642
SetIsolateDataSlots::kNo);
588643
}
589644

645+
void MacroAssembler::CallVerifySkippedIndirectWriteBarrierStubSaveRegisters(
646+
Register object, Register value, SaveFPRegsMode fp_mode) {
647+
ASM_CODE_COMMENT(this);
648+
PushCallerSaved(fp_mode);
649+
CallVerifySkippedIndirectWriteBarrierStub(object, value);
650+
PopCallerSaved(fp_mode);
651+
}
652+
653+
void MacroAssembler::CallVerifySkippedIndirectWriteBarrierStub(Register object,
654+
Register value) {
655+
ASM_CODE_COMMENT(this);
656+
UseScratchRegisterScope temps(this);
657+
Register scratch = temps.Acquire();
658+
PrepareCallCFunction(2, scratch);
659+
MovePair(kCArgRegs[0], object, kCArgRegs[1], value);
660+
CallCFunction(ExternalReference::verify_skipped_indirect_write_barrier(), 2,
661+
SetIsolateDataSlots::kNo);
662+
}
663+
590664
void MacroAssembler::MoveObjectAndSlot(Register dst_object, Register dst_slot,
591665
Register object, Operand offset) {
592666
ASM_CODE_COMMENT(this);

deps/v8/src/codegen/loong64/macro-assembler-loong64.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
181181
void LoadRootRelative(Register destination, int32_t offset) final;
182182
void StoreRootRelative(int32_t offset, Register value) final;
183183

184+
void PreCheckSkippedWriteBarrier(Register object, Register value,
185+
Register scratch, Label* ok);
186+
184187
// Operand pointing to an external reference.
185188
// May emit code to set up the scratch register. The operand is
186189
// only guaranteed to be correct as long as the scratch register
@@ -360,6 +363,11 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
360363
SaveFPRegsMode fp_mode);
361364
void CallVerifySkippedWriteBarrierStub(Register object, Register value);
362365

366+
void CallVerifySkippedIndirectWriteBarrierStubSaveRegisters(
367+
Register object, Register value, SaveFPRegsMode fp_mode);
368+
void CallVerifySkippedIndirectWriteBarrierStub(Register object,
369+
Register value);
370+
363371
// For a given |object| and |offset|:
364372
// - Move |object| to |dst_object|.
365373
// - Compute the address of the slot pointed to by |offset| in |object| and

deps/v8/src/codegen/source-position-table.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ struct PositionTableEntry {
3636
int code_offset;
3737
bool is_statement;
3838
bool is_breakable;
39+
40+
bool operator==(const PositionTableEntry&) const = default;
3941
};
4042

4143
class V8_EXPORT_PRIVATE SourcePositionTableBuilder {
@@ -95,6 +97,8 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator {
9597
PositionTableEntry position_;
9698
IterationFilter iteration_filter_;
9799
FunctionEntryFilter function_entry_filter_;
100+
101+
bool operator==(const IndexAndPositionState&) const = default;
98102
};
99103

100104
// We expose three flavours of the iterator, depending on the argument passed

deps/v8/src/compiler/backend/loong64/code-generator-loong64.cc

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
156156
#if V8_ENABLE_WEBASSEMBLY
157157
stub_mode_(stub_mode),
158158
#endif // V8_ENABLE_WEBASSEMBLY
159-
must_save_lr_(!gen->frame_access_state()->has_frame()),
159+
must_save_ra_(!gen->frame_access_state()->has_frame()),
160160
zone_(gen->zone()),
161161
indirect_pointer_tag_(indirect_pointer_tag) {
162162
}
@@ -175,7 +175,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
175175
SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
176176
? SaveFPRegsMode::kSave
177177
: SaveFPRegsMode::kIgnore;
178-
if (must_save_lr_) {
178+
if (must_save_ra_) {
179179
// We need to save and restore ra if the frame was elided.
180180
__ Push(ra);
181181
}
@@ -196,7 +196,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
196196
} else {
197197
__ CallRecordWriteStubSaveRegisters(object_, offset_, save_fp_mode);
198198
}
199-
if (must_save_lr_) {
199+
if (must_save_ra_) {
200200
__ Pop(ra);
201201
}
202202
}
@@ -209,7 +209,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
209209
#if V8_ENABLE_WEBASSEMBLY
210210
StubCallMode const stub_mode_;
211211
#endif // V8_ENABLE_WEBASSEMBLY
212-
bool must_save_lr_;
212+
bool must_save_ra_;
213213
Zone* zone_;
214214
IndirectPointerTag indirect_pointer_tag_;
215215
};
@@ -294,23 +294,62 @@ void RecordTrapInfoIfNeeded(Zone* zone, CodeGenerator* codegen,
294294
class OutOfLineVerifySkippedWriteBarrier final : public OutOfLineCode {
295295
public:
296296
OutOfLineVerifySkippedWriteBarrier(CodeGenerator* gen, Register object,
297-
Register value)
297+
Register value, Register scratch)
298298
: OutOfLineCode(gen),
299299
object_(object),
300300
value_(value),
301+
scratch_(scratch),
302+
must_save_ra_(!gen->frame_access_state()->has_frame()),
301303
zone_(gen->zone()) {}
302304

303305
void Generate() final {
304306
if (COMPRESS_POINTERS_BOOL) {
305307
__ DecompressTagged(value_, value_);
306308
}
307309

310+
if (must_save_ra_) {
311+
// We need to save and restore ra if the frame was elided.
312+
__ Push(ra);
313+
}
314+
315+
__ PreCheckSkippedWriteBarrier(object_, value_, scratch_, exit());
316+
308317
SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
309318
? SaveFPRegsMode::kSave
310319
: SaveFPRegsMode::kIgnore;
311320

312321
__ CallVerifySkippedWriteBarrierStubSaveRegisters(object_, value_,
313322
save_fp_mode);
323+
324+
if (must_save_ra_) {
325+
__ Pop(ra);
326+
}
327+
}
328+
329+
private:
330+
Register const object_;
331+
Register const value_;
332+
Register const scratch_;
333+
const bool must_save_ra_;
334+
Zone* zone_;
335+
};
336+
337+
class OutOfLineVerifySkippedIndirectWriteBarrier final : public OutOfLineCode {
338+
public:
339+
OutOfLineVerifySkippedIndirectWriteBarrier(CodeGenerator* gen,
340+
Register object, Register value)
341+
: OutOfLineCode(gen),
342+
object_(object),
343+
value_(value),
344+
zone_(gen->zone()) {}
345+
346+
void Generate() final {
347+
SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
348+
? SaveFPRegsMode::kSave
349+
: SaveFPRegsMode::kIgnore;
350+
351+
__ CallVerifySkippedIndirectWriteBarrierStubSaveRegisters(object_, value_,
352+
save_fp_mode);
314353
}
315354

316355
private:
@@ -1025,12 +1064,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
10251064
Operand(kClearedWeakHeapObjectLower32));
10261065
}
10271066

1028-
if (v8_flags.verify_write_barriers) {
1029-
auto ool = zone()->New<OutOfLineVerifySkippedWriteBarrier>(this, object,
1030-
value);
1031-
__ JumpIfNotSmi(value, ool->entry());
1032-
__ bind(ool->exit());
1033-
}
1067+
DCHECK(v8_flags.verify_write_barriers);
1068+
Register scratch = i.TempRegister(0);
1069+
auto ool = zone()->New<OutOfLineVerifySkippedWriteBarrier>(
1070+
this, object, value, scratch);
1071+
__ JumpIfNotSmi(value, ool->entry());
1072+
__ bind(ool->exit());
10341073

10351074
MacroAssemblerBase::BlockTrampolinePoolScope block_trampoline_pool(
10361075
masm());
@@ -1085,12 +1124,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
10851124
Register temp = i.TempRegister(0);
10861125
__ Add_d(temp, object, offset);
10871126

1088-
if (v8_flags.verify_write_barriers) {
1089-
auto ool = zone()->New<OutOfLineVerifySkippedWriteBarrier>(this, object,
1090-
value);
1091-
__ JumpIfNotSmi(value, ool->entry());
1092-
__ bind(ool->exit());
1093-
}
1127+
DCHECK(v8_flags.verify_write_barriers);
1128+
Register scratch = i.TempRegister(1);
1129+
auto ool = zone()->New<OutOfLineVerifySkippedWriteBarrier>(
1130+
this, object, value, scratch);
1131+
__ JumpIfNotSmi(value, ool->entry());
1132+
__ bind(ool->exit());
10941133

10951134
MacroAssemblerBase::BlockTrampolinePoolScope block_trampoline_pool(
10961135
masm());
@@ -1150,6 +1189,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
11501189
DCHECK(IsValidIndirectPointerTag(tag));
11511190
#endif // DEBUG
11521191

1192+
DCHECK(v8_flags.verify_write_barriers);
1193+
auto ool = zone()->New<OutOfLineVerifySkippedIndirectWriteBarrier>(
1194+
this, object, value);
1195+
__ jmp(ool->entry());
1196+
__ bind(ool->exit());
1197+
11531198
MacroAssemblerBase::BlockTrampolinePoolScope block_trampoline_pool(
11541199
masm());
11551200
Operand offset(0);

0 commit comments

Comments
 (0)