Commit 71dd5c43 authored by Ilija.Pavlovic's avatar Ilija.Pavlovic Committed by Commit bot

MIPS64: [regexp] do not assume short external strings have a minimum size.

Fix for execution tests on simulator.
Port 3518e492

Original commit message:
    Short external strings do not cache the resource data, and may be used
    for compressible strings. The assumptions about their lengths is
    invalid and may lead to oob reads.

BUG=

Review URL: https://codereview.chromium.org/1904033003

Cr-Commit-Position: refs/heads/master@{#35703}
parent 5e11acc9
...@@ -1683,11 +1683,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { ...@@ -1683,11 +1683,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
__ ld(subject, MemOperand(sp, kSubjectOffset)); __ ld(subject, MemOperand(sp, kSubjectOffset));
__ JumpIfSmi(subject, &runtime); __ JumpIfSmi(subject, &runtime);
__ mov(a3, subject); // Make a copy of the original subject string. __ mov(a3, subject); // Make a copy of the original subject string.
__ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
__ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
// subject: subject string // subject: subject string
// a0: subject string instance type
// a3: subject string // a3: subject string
// regexp_data: RegExp data (FixedArray) // regexp_data: RegExp data (FixedArray)
// Handle subject string according to its encoding and representation: // Handle subject string according to its encoding and representation:
...@@ -1714,8 +1711,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { ...@@ -1714,8 +1711,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
__ bind(&check_underlying); __ bind(&check_underlying);
__ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset)); __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset));
__ Daddu(a0, a2, Map::kInstanceTypeOffset); __ lbu(a0, FieldMemOperand(a2, Map::kInstanceTypeOffset));
__ lbu(a0, MemOperand(a0));
// (1) Sequential string? If yes, go to (4). // (1) Sequential string? If yes, go to (4).
__ And(a1, __ And(a1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment