MIPS64: Fix string stubs.
An innocent-looking change in 'c63e50ed Reland Update V8 DEPS.' exposed latent bugs in SubStringStub and StringCharFromCodeGenerator. TEST=mjsunit/string-replace, msjunit/string-split, others.... BUG= Review URL: https://codereview.chromium.org/1233903003 Cr-Commit-Position: refs/heads/master@{#29731}
This commit is contained in:
parent
8bde6b1920
commit
88214f1bf8
@ -3200,25 +3200,17 @@ void StringCharCodeAtGenerator::GenerateSlow(
|
|||||||
|
|
||||||
void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
|
void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
|
||||||
// Fast case of Heap::LookupSingleCharacterStringFromCode.
|
// Fast case of Heap::LookupSingleCharacterStringFromCode.
|
||||||
|
__ JumpIfNotSmi(code_, &slow_case_);
|
||||||
DCHECK(!a4.is(result_));
|
__ Branch(&slow_case_, hi, code_,
|
||||||
DCHECK(!a4.is(code_));
|
Operand(Smi::FromInt(String::kMaxOneByteCharCode)));
|
||||||
|
|
||||||
STATIC_ASSERT(kSmiTag == 0);
|
|
||||||
DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU + 1));
|
|
||||||
__ And(a4, code_, Operand(kSmiTagMask |
|
|
||||||
((~String::kMaxOneByteCharCodeU) << kSmiTagSize)));
|
|
||||||
__ Branch(&slow_case_, ne, a4, Operand(zero_reg));
|
|
||||||
|
|
||||||
|
|
||||||
__ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex);
|
__ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex);
|
||||||
// At this point code register contains smi tagged one_byte char code.
|
// At this point code register contains smi tagged one_byte char code.
|
||||||
STATIC_ASSERT(kSmiTag == 0);
|
__ SmiScale(at, code_, kPointerSizeLog2);
|
||||||
__ SmiScale(a4, code_, kPointerSizeLog2);
|
__ Daddu(result_, result_, at);
|
||||||
__ Daddu(result_, result_, a4);
|
|
||||||
__ ld(result_, FieldMemOperand(result_, FixedArray::kHeaderSize));
|
__ ld(result_, FieldMemOperand(result_, FixedArray::kHeaderSize));
|
||||||
__ LoadRoot(a4, Heap::kUndefinedValueRootIndex);
|
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
||||||
__ Branch(&slow_case_, eq, result_, Operand(a4));
|
__ Branch(&slow_case_, eq, result_, Operand(at));
|
||||||
__ bind(&exit_);
|
__ bind(&exit_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3306,11 +3298,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
|||||||
|
|
||||||
__ ld(a2, MemOperand(sp, kToOffset));
|
__ ld(a2, MemOperand(sp, kToOffset));
|
||||||
__ ld(a3, MemOperand(sp, kFromOffset));
|
__ ld(a3, MemOperand(sp, kFromOffset));
|
||||||
// Does not needed?
|
|
||||||
// STATIC_ASSERT(kFromOffset == kToOffset + 4);
|
|
||||||
STATIC_ASSERT(kSmiTag == 0);
|
STATIC_ASSERT(kSmiTag == 0);
|
||||||
// Does not needed?
|
|
||||||
// STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1);
|
|
||||||
|
|
||||||
// Utilize delay slots. SmiUntag doesn't emit a jump, everything else is
|
// Utilize delay slots. SmiUntag doesn't emit a jump, everything else is
|
||||||
// safe in this case.
|
// safe in this case.
|
||||||
@ -3503,6 +3492,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
|||||||
// a1: instance type
|
// a1: instance type
|
||||||
// a2: length
|
// a2: length
|
||||||
// a3: from index (untagged)
|
// a3: from index (untagged)
|
||||||
|
__ SmiTag(a3);
|
||||||
StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime,
|
StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime,
|
||||||
STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
|
STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
|
||||||
generator.GenerateFast(masm);
|
generator.GenerateFast(masm);
|
||||||
|
Loading…
Reference in New Issue
Block a user