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 2986eca

Browse filesBrowse files
Xiao-Taorichardlau
authored andcommitted
deps: V8: cherry-pick 6b1b9bca2a8
Origin commit message: [loong64][codegen] Avoid memory access under stack pointer According to LoongArch ABI doc chapter 8.2: "Procedures must not assume the persistence on-stack data of which the addresses lie below the stack pointer." Change-Id: I92735e052227495ac9884c4290b57eaffbf905e1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6786372 Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn> Reviewed-by: Matthias Liedtke <mliedtke@chromium.org> Commit-Queue: Matthias Liedtke <mliedtke@chromium.org> Cr-Commit-Position: refs/heads/main@{#101634} Refs: v8/v8@6b1b9bc Backport-PR-URL: #59663 PR-URL: #59283 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 5b83e1e commit 2986eca
Copy full SHA for 2986eca

File tree

Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-10
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
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.29',
41+
'v8_embedder_string': '-node.30',
4242

4343
##### V8 defaults for Node.js #####
4444

Collapse file

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

Copy file name to clipboardExpand all lines: deps/v8/src/codegen/loong64/macro-assembler-loong64.cc
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,21 +1526,24 @@ void MacroAssembler::li(Register rd, Operand j, LiFlags mode) {
15261526
}
15271527

15281528
void MacroAssembler::MultiPush(RegList regs) {
1529-
int16_t stack_offset = 0;
1529+
int16_t num_to_push = regs.Count();
1530+
int16_t stack_offset = num_to_push * kSystemPointerSize;
15301531

1532+
Sub_d(sp, sp, Operand(stack_offset));
15311533
for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
15321534
if ((regs.bits() & (1 << i)) != 0) {
15331535
stack_offset -= kSystemPointerSize;
15341536
St_d(ToRegister(i), MemOperand(sp, stack_offset));
15351537
}
15361538
}
1537-
addi_d(sp, sp, stack_offset);
15381539
}
15391540

15401541
void MacroAssembler::MultiPush(RegList regs1, RegList regs2) {
15411542
DCHECK((regs1 & regs2).is_empty());
1542-
int16_t stack_offset = 0;
1543+
int16_t num_to_push = regs1.Count() + regs2.Count();
1544+
int16_t stack_offset = num_to_push * kSystemPointerSize;
15431545

1546+
Sub_d(sp, sp, Operand(stack_offset));
15441547
for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
15451548
if ((regs1.bits() & (1 << i)) != 0) {
15461549
stack_offset -= kSystemPointerSize;
@@ -1553,15 +1556,16 @@ void MacroAssembler::MultiPush(RegList regs1, RegList regs2) {
15531556
St_d(ToRegister(i), MemOperand(sp, stack_offset));
15541557
}
15551558
}
1556-
addi_d(sp, sp, stack_offset);
15571559
}
15581560

15591561
void MacroAssembler::MultiPush(RegList regs1, RegList regs2, RegList regs3) {
15601562
DCHECK((regs1 & regs2).is_empty());
15611563
DCHECK((regs1 & regs3).is_empty());
15621564
DCHECK((regs2 & regs3).is_empty());
1563-
int16_t stack_offset = 0;
1565+
int16_t num_to_push = regs1.Count() + regs2.Count() + regs3.Count();
1566+
int16_t stack_offset = num_to_push * kSystemPointerSize;
15641567

1568+
Sub_d(sp, sp, Operand(stack_offset));
15651569
for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
15661570
if ((regs1.bits() & (1 << i)) != 0) {
15671571
stack_offset -= kSystemPointerSize;
@@ -1580,7 +1584,6 @@ void MacroAssembler::MultiPush(RegList regs1, RegList regs2, RegList regs3) {
15801584
St_d(ToRegister(i), MemOperand(sp, stack_offset));
15811585
}
15821586
}
1583-
addi_d(sp, sp, stack_offset);
15841587
}
15851588

15861589
void MacroAssembler::MultiPop(RegList regs) {
@@ -3898,9 +3901,8 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) {
38983901

38993902
void MacroAssembler::LeaveFrame(StackFrame::Type type) {
39003903
ASM_CODE_COMMENT(this);
3901-
addi_d(sp, fp, 2 * kSystemPointerSize);
3902-
Ld_d(ra, MemOperand(fp, 1 * kSystemPointerSize));
3903-
Ld_d(fp, MemOperand(fp, 0 * kSystemPointerSize));
3904+
Move(sp, fp);
3905+
Pop(ra, fp);
39043906
}
39053907

39063908
void MacroAssembler::EnterExitFrame(int stack_space,

0 commit comments

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