From 547c5153572ee21a4219f68fe6dc171b1989ed87 Mon Sep 17 00:00:00 2001 From: Farazmand Date: Fri, 1 Feb 2019 12:27:26 -0500 Subject: [PATCH] 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 Reviewed-by: Junliang Yan Cr-Commit-Position: refs/heads/master@{#59049} Refs: https://github.com/v8/v8/commit/3cc69194b5ee967d0386fdd47de7a84141fef8cc --- deps/v8/include/v8-version.h | 2 +- .../src/regexp/ppc/regexp-macro-assembler-ppc.cc | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 85a14e37f2e4f3..db93e49041c665 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 2 #define V8_BUILD_NUMBER 414 -#define V8_PATCH_LEVEL 76 +#define V8_PATCH_LEVEL 77 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc index a1425b4372ec39..260e98bcc2577f 100644 --- a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc +++ b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc @@ -142,8 +142,13 @@ int RegExpMacroAssemblerPPC::stack_limit_slack() { void RegExpMacroAssemblerPPC::AdvanceCurrentPosition(int by) { if (by != 0) { - __ addi(current_input_offset(), current_input_offset(), - Operand(by * char_size())); + if (is_int16(by * char_size())) { + __ addi(current_input_offset(), current_input_offset(), + Operand(by * char_size())); + } else { + __ mov(r0, Operand(by * char_size())); + __ add(current_input_offset(), r0, current_input_offset()); + } } } @@ -1270,7 +1275,12 @@ void RegExpMacroAssemblerPPC::LoadCurrentCharacterUnchecked(int cp_offset, Register offset = current_input_offset(); if (cp_offset != 0) { // r25 is not being used to store the capture start index at this point. - __ addi(r25, current_input_offset(), Operand(cp_offset * char_size())); + if (is_int16(cp_offset * char_size())) { + __ addi(r25, current_input_offset(), Operand(cp_offset * char_size())); + } else { + __ mov(r25, Operand(cp_offset * char_size())); + __ add(r25, r25, current_input_offset()); + } offset = r25; } // The lwz, stw, lhz, sth instructions can do unaligned accesses, if the CPU