Skip to content

Commit 3b9fd08

Browse files
miladBethGriggs
milad
authored andcommitted
deps: V8: cherry-pick 3cc6919
Original commit message: PPC: fix Regex addi overflow using add insetad of addi when Operand is more than 16 bits long Change-Id: I7f9452381ed8b321ec71e68d0d90485508b69885 Reviewed-on: https://chromium-review.googlesource.com/c/1430619 Commit-Queue: Junliang Yan <[email protected]> Reviewed-by: Junliang Yan <[email protected]> Cr-Commit-Position: refs/heads/master@{#59049} Refs: v8/v8@3cc6919 PR-URL: #25872 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: George Adams <[email protected]> Reviewed-By: Beth Griggs <[email protected]>
1 parent 70322ea commit 3b9fd08

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Reset this number to 0 on major V8 upgrades.
3535
# Increment by one for each non-official patch applied to deps/v8.
36-
'v8_embedder_string': '-node.50',
36+
'v8_embedder_string': '-node.51',
3737

3838
# Enable disassembler for `--print-code` v8 options
3939
'v8_enable_disassembler': 1,

deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc

+13-3
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,13 @@ int RegExpMacroAssemblerPPC::stack_limit_slack() {
142142

143143
void RegExpMacroAssemblerPPC::AdvanceCurrentPosition(int by) {
144144
if (by != 0) {
145-
__ addi(current_input_offset(), current_input_offset(),
146-
Operand(by * char_size()));
145+
if (is_int16(by * char_size())) {
146+
__ addi(current_input_offset(), current_input_offset(),
147+
Operand(by * char_size()));
148+
} else {
149+
__ mov(r0, Operand(by * char_size()));
150+
__ add(current_input_offset(), r0, current_input_offset());
151+
}
147152
}
148153
}
149154

@@ -1272,7 +1277,12 @@ void RegExpMacroAssemblerPPC::LoadCurrentCharacterUnchecked(int cp_offset,
12721277
Register offset = current_input_offset();
12731278
if (cp_offset != 0) {
12741279
// r25 is not being used to store the capture start index at this point.
1275-
__ addi(r25, current_input_offset(), Operand(cp_offset * char_size()));
1280+
if (is_int16(cp_offset * char_size())) {
1281+
__ addi(r25, current_input_offset(), Operand(cp_offset * char_size()));
1282+
} else {
1283+
__ mov(r25, Operand(cp_offset * char_size()));
1284+
__ add(r25, r25, current_input_offset());
1285+
}
12761286
offset = r25;
12771287
}
12781288
// The lwz, stw, lhz, sth instructions can do unaligned accesses, if the CPU

0 commit comments

Comments
 (0)