Skip to content

Commit 943c829

Browse files
committed
deps: patch V8 to 9.7.106.8
Refs: v8/v8@9.7.106.7...9.7.106.8
1 parent 1cb6d12 commit 943c829

File tree

4 files changed

+194
-9
lines changed

4 files changed

+194
-9
lines changed

Diff for: 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 9
1212
#define V8_MINOR_VERSION 7
1313
#define V8_BUILD_NUMBER 106
14-
#define V8_PATCH_LEVEL 7
14+
#define V8_PATCH_LEVEL 8
1515

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

Diff for: deps/v8/src/codegen/ppc/macro-assembler-ppc.cc

+116-6
Original file line numberDiff line numberDiff line change
@@ -2818,19 +2818,55 @@ void TurboAssembler::DivU32(Register dst, Register src, Register value, OEBit s,
28182818
}
28192819

28202820
void TurboAssembler::ModS64(Register dst, Register src, Register value) {
2821-
modsd(dst, src, value);
2821+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
2822+
modsd(dst, src, value);
2823+
} else {
2824+
Register scratch = GetRegisterThatIsNotOneOf(dst, src, value);
2825+
Push(scratch);
2826+
divd(scratch, src, value);
2827+
mulld(scratch, scratch, value);
2828+
sub(dst, src, scratch);
2829+
Pop(scratch);
2830+
}
28222831
}
28232832

28242833
void TurboAssembler::ModU64(Register dst, Register src, Register value) {
2825-
modud(dst, src, value);
2834+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
2835+
modud(dst, src, value);
2836+
} else {
2837+
Register scratch = GetRegisterThatIsNotOneOf(dst, src, value);
2838+
Push(scratch);
2839+
divdu(scratch, src, value);
2840+
mulld(scratch, scratch, value);
2841+
sub(dst, src, scratch);
2842+
Pop(scratch);
2843+
}
28262844
}
28272845

28282846
void TurboAssembler::ModS32(Register dst, Register src, Register value) {
2829-
modsw(dst, src, value);
2847+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
2848+
modsw(dst, src, value);
2849+
} else {
2850+
Register scratch = GetRegisterThatIsNotOneOf(dst, src, value);
2851+
Push(scratch);
2852+
divw(scratch, src, value);
2853+
mullw(scratch, scratch, value);
2854+
sub(dst, src, scratch);
2855+
Pop(scratch);
2856+
}
28302857
extsw(dst, dst);
28312858
}
28322859
void TurboAssembler::ModU32(Register dst, Register src, Register value) {
2833-
moduw(dst, src, value);
2860+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
2861+
moduw(dst, src, value);
2862+
} else {
2863+
Register scratch = GetRegisterThatIsNotOneOf(dst, src, value);
2864+
Push(scratch);
2865+
divwu(scratch, src, value);
2866+
mullw(scratch, scratch, value);
2867+
sub(dst, src, scratch);
2868+
Pop(scratch);
2869+
}
28342870
ZeroExtWord32(dst, dst);
28352871
}
28362872

@@ -3732,14 +3768,88 @@ void TurboAssembler::CountLeadingZerosU64(Register dst, Register src, RCBit r) {
37323768
cntlzd(dst, src, r);
37333769
}
37343770

3771+
#define COUNT_TRAILING_ZEROES_SLOW(max_count, scratch1, scratch2) \
3772+
Label loop, done; \
3773+
li(scratch1, Operand(max_count)); \
3774+
mtctr(scratch1); \
3775+
mr(scratch1, src); \
3776+
li(dst, Operand::Zero()); \
3777+
bind(&loop); /* while ((src & 1) == 0) */ \
3778+
andi(scratch2, scratch1, Operand(1)); \
3779+
bne(&done, cr0); \
3780+
srdi(scratch1, scratch1, Operand(1)); /* src >>= 1;*/ \
3781+
addi(dst, dst, Operand(1)); /* dst++ */ \
3782+
bdnz(&loop); \
3783+
bind(&done);
37353784
void TurboAssembler::CountTrailingZerosU32(Register dst, Register src,
3785+
Register scratch1, Register scratch2,
37363786
RCBit r) {
3737-
cnttzw(dst, src, r);
3787+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
3788+
cnttzw(dst, src, r);
3789+
} else {
3790+
COUNT_TRAILING_ZEROES_SLOW(32, scratch1, scratch2);
3791+
}
37383792
}
37393793

37403794
void TurboAssembler::CountTrailingZerosU64(Register dst, Register src,
3795+
Register scratch1, Register scratch2,
37413796
RCBit r) {
3742-
cnttzd(dst, src, r);
3797+
if (CpuFeatures::IsSupported(PPC_9_PLUS)) {
3798+
cnttzd(dst, src, r);
3799+
} else {
3800+
COUNT_TRAILING_ZEROES_SLOW(64, scratch1, scratch2);
3801+
}
3802+
}
3803+
#undef COUNT_TRAILING_ZEROES_SLOW
3804+
3805+
void TurboAssembler::ClearByteU64(Register dst, int byte_idx) {
3806+
CHECK(0 <= byte_idx && byte_idx <= 7);
3807+
int shift = byte_idx*8;
3808+
rldicl(dst, dst, shift, 8);
3809+
rldicl(dst, dst, 64-shift, 0);
3810+
}
3811+
3812+
void TurboAssembler::ReverseBitsU64(Register dst, Register src,
3813+
Register scratch1, Register scratch2) {
3814+
ByteReverseU64(dst, src);
3815+
for (int i = 0; i < 8; i++) {
3816+
ReverseBitsInSingleByteU64(dst, dst, scratch1, scratch2, i);
3817+
}
3818+
}
3819+
3820+
void TurboAssembler::ReverseBitsU32(Register dst, Register src,
3821+
Register scratch1, Register scratch2) {
3822+
ByteReverseU32(dst, src);
3823+
for (int i = 4; i < 8; i++) {
3824+
ReverseBitsInSingleByteU64(dst, dst, scratch1, scratch2, i);
3825+
}
3826+
}
3827+
3828+
// byte_idx=7 refers to least significant byte
3829+
void TurboAssembler::ReverseBitsInSingleByteU64(Register dst, Register src,
3830+
Register scratch1,
3831+
Register scratch2,
3832+
int byte_idx) {
3833+
CHECK(0 <= byte_idx && byte_idx <= 7);
3834+
int j = byte_idx;
3835+
// zero all bits of scratch1
3836+
li(scratch2, Operand(0));
3837+
for (int i = 0; i <= 7; i++) {
3838+
// zero all bits of scratch1
3839+
li(scratch1, Operand(0));
3840+
// move bit (j+1)*8-i-1 of src to bit j*8+i of scratch1, erase bits
3841+
// (j*8+i+1):end of scratch1
3842+
int shift = 7 - (2*i);
3843+
if (shift < 0) shift += 64;
3844+
rldicr(scratch1, src, shift, j*8+i);
3845+
// erase bits start:(j*8-1+i) of scratch1 (inclusive)
3846+
rldicl(scratch1, scratch1, 0, j*8+i);
3847+
// scratch2 = scratch2|scratch1
3848+
orx(scratch2, scratch2, scratch1);
3849+
}
3850+
// clear jth byte of dst and insert jth byte of scratch2
3851+
ClearByteU64(dst, j);
3852+
orx(dst, dst, scratch2);
37433853
}
37443854

37453855
} // namespace internal

Diff for: deps/v8/src/codegen/ppc/macro-assembler-ppc.h

+13-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,19 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
263263

264264
void CountLeadingZerosU32(Register dst, Register src, RCBit r = LeaveRC);
265265
void CountLeadingZerosU64(Register dst, Register src, RCBit r = LeaveRC);
266-
void CountTrailingZerosU32(Register dst, Register src, RCBit r = LeaveRC);
267-
void CountTrailingZerosU64(Register dst, Register src, RCBit r = LeaveRC);
266+
void CountTrailingZerosU32(Register dst, Register src, Register scratch1 = ip,
267+
Register scratch2 = r0, RCBit r = LeaveRC);
268+
void CountTrailingZerosU64(Register dst, Register src, Register scratch1 = ip,
269+
Register scratch2 = r0, RCBit r = LeaveRC);
270+
271+
void ClearByteU64(Register dst, int byte_idx);
272+
void ReverseBitsU64(Register dst, Register src, Register scratch1,
273+
Register scratch2);
274+
void ReverseBitsU32(Register dst, Register src, Register scratch1,
275+
Register scratch2);
276+
void ReverseBitsInSingleByteU64(Register dst, Register src,
277+
Register scratch1, Register scratch2,
278+
int byte_idx);
268279

269280
void AddF64(DoubleRegister dst, DoubleRegister lhs, DoubleRegister rhs,
270281
RCBit r = LeaveRC);

Diff for: deps/v8/test/unittests/assembler/turbo-assembler-ppc-unittest.cc

+64
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,70 @@ TEST_F(TurboAssemblerTest, TestCheck) {
6262
ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
6363
}
6464

65+
TEST_F(TurboAssemblerTest, ReverseBitsU64) {
66+
struct {
67+
uint64_t expected; uint64_t input;
68+
} values[] = {
69+
{0x0000000000000000, 0x0000000000000000},
70+
{0xffffffffffffffff, 0xffffffffffffffff},
71+
{0x8000000000000000, 0x0000000000000001},
72+
{0x0000000000000001, 0x8000000000000000},
73+
{0x800066aa22cc4488, 0x1122334455660001},
74+
{0x1122334455660001, 0x800066aa22cc4488},
75+
{0xffffffff00000000, 0x00000000ffffffff},
76+
{0x00000000ffffffff, 0xffffffff00000000},
77+
{0xff01020304050607, 0xe060a020c04080ff},
78+
{0xe060a020c04080ff, 0xff01020304050607},
79+
};
80+
auto buffer = AllocateAssemblerBuffer();
81+
TurboAssembler tasm(isolate(), AssemblerOptions{}, CodeObjectRequired::kNo,
82+
buffer->CreateView());
83+
__ set_root_array_available(false);
84+
__ set_abort_hard(true);
85+
__ Push(r4, r5);
86+
__ ReverseBitsU64(r3, r3, r4, r5);
87+
__ Pop(r4, r5);
88+
__ Ret();
89+
CodeDesc desc;
90+
tasm.GetCode(isolate(), &desc);
91+
buffer->MakeExecutable();
92+
auto f = GeneratedCode<uint64_t, uint64_t>::FromBuffer(isolate(),
93+
buffer->start());
94+
for (unsigned int i=0; i < (sizeof(values) / sizeof(values[0])); i++) {
95+
CHECK_EQ(values[i].expected, f.Call(values[i].input));
96+
}
97+
}
98+
99+
TEST_F(TurboAssemblerTest, ReverseBitsU32) {
100+
struct {
101+
uint64_t expected; uint64_t input;
102+
} values[] = {
103+
{0x00000000, 0x00000000},
104+
{0xffffffff, 0xffffffff},
105+
{0x00000001, 0x80000000},
106+
{0x80000000, 0x00000001},
107+
{0x22334455, 0xaa22cc44},
108+
{0xaa22cc44, 0x22334455},
109+
};
110+
auto buffer = AllocateAssemblerBuffer();
111+
TurboAssembler tasm(isolate(), AssemblerOptions{}, CodeObjectRequired::kNo,
112+
buffer->CreateView());
113+
__ set_root_array_available(false);
114+
__ set_abort_hard(true);
115+
__ Push(r4, r5);
116+
__ ReverseBitsU32(r3, r3, r4, r5);
117+
__ Pop(r4, r5);
118+
__ Ret();
119+
CodeDesc desc;
120+
tasm.GetCode(isolate(), &desc);
121+
buffer->MakeExecutable();
122+
auto f = GeneratedCode<uint64_t, uint64_t>::FromBuffer(isolate(),
123+
buffer->start());
124+
for (unsigned int i=0; i < (sizeof(values) / sizeof(values[0])); i++) {
125+
CHECK_EQ(values[i].expected, f.Call(values[i].input));
126+
}
127+
}
128+
65129
#undef __
66130

67131
} // namespace internal

0 commit comments

Comments
 (0)