| Index: src/mips/code-stubs-mips.cc
|
| diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
|
| index ae08eb6d732b4b7191efa35a43efb65f30e4a766..541e73e2fa407e4e9614090b4d5b0fce1ded9e9f 100644
|
| --- a/src/mips/code-stubs-mips.cc
|
| +++ b/src/mips/code-stubs-mips.cc
|
| @@ -1605,7 +1605,6 @@ void LoadIndexedInterceptorStub::Generate(MacroAssembler* masm) {
|
| masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC));
|
| }
|
|
|
| -
|
| void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| // Just jump directly to runtime if native RegExp is not selected at compile
|
| // time or if regexp entry in generated code is turned off runtime switch or
|
| @@ -1638,8 +1637,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
|
|
| // Ensure that a RegExp stack is allocated.
|
| ExternalReference address_of_regexp_stack_memory_address =
|
| - ExternalReference::address_of_regexp_stack_memory_address(
|
| - isolate());
|
| + ExternalReference::address_of_regexp_stack_memory_address(isolate());
|
| ExternalReference address_of_regexp_stack_memory_size =
|
| ExternalReference::address_of_regexp_stack_memory_size(isolate());
|
| __ li(a0, Operand(address_of_regexp_stack_memory_size));
|
| @@ -1691,34 +1689,33 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ lw(subject, MemOperand(sp, kSubjectOffset));
|
| __ JumpIfSmi(subject, &runtime);
|
| __ mov(a3, subject); // Make a copy of the original subject string.
|
| - __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
|
| - __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
|
| // subject: subject string
|
| // a3: subject string
|
| - // a0: subject string instance type
|
| // regexp_data: RegExp data (FixedArray)
|
| // Handle subject string according to its encoding and representation:
|
| - // (1) Sequential string? If yes, go to (5).
|
| - // (2) Anything but sequential or cons? If yes, go to (6).
|
| - // (3) Cons string. If the string is flat, replace subject with first string.
|
| - // Otherwise bailout.
|
| - // (4) Is subject external? If yes, go to (7).
|
| - // (5) Sequential string. Load regexp code according to encoding.
|
| + // (1) Sequential string? If yes, go to (4).
|
| + // (2) Sequential or cons? If not, go to (5).
|
| + // (3) Cons string. If the string is flat, replace subject with first string
|
| + // and go to (1). Otherwise bail out to runtime.
|
| + // (4) Sequential string. Load regexp code according to encoding.
|
| // (E) Carry on.
|
| /// [...]
|
|
|
| // Deferred code at the end of the stub:
|
| - // (6) Not a long external string? If yes, go to (8).
|
| - // (7) External string. Make it, offset-wise, look like a sequential string.
|
| - // Go to (5).
|
| - // (8) Short external string or not a string? If yes, bail out to runtime.
|
| - // (9) Sliced string. Replace subject with parent. Go to (4).
|
| + // (5) Long external string? If not, go to (7).
|
| + // (6) External string. Make it, offset-wise, look like a sequential string.
|
| + // Go to (4).
|
| + // (7) Short external string or not a string? If yes, bail out to runtime.
|
| + // (8) Sliced string. Replace subject with parent. Go to (1).
|
|
|
| - Label seq_string /* 5 */, external_string /* 7 */,
|
| - check_underlying /* 4 */, not_seq_nor_cons /* 6 */,
|
| - not_long_external /* 8 */;
|
| + Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
|
| + not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
|
| +
|
| + __ bind(&check_underlying);
|
| + __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
|
| + __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
|
|
|
| - // (1) Sequential string? If yes, go to (5).
|
| + // (1) Sequential string? If yes, go to (4).
|
| __ And(a1,
|
| a0,
|
| Operand(kIsNotStringMask |
|
| @@ -1727,12 +1724,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
|
| __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5).
|
|
|
| - // (2) Anything but sequential or cons? If yes, go to (6).
|
| + // (2) Sequential or cons? If not, go to (5).
|
| STATIC_ASSERT(kConsStringTag < kExternalStringTag);
|
| STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
|
| STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
|
| STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
|
| - // Go to (6).
|
| + // Go to (5).
|
| __ Branch(¬_seq_nor_cons, ge, a1, Operand(kExternalStringTag));
|
|
|
| // (3) Cons string. Check that it's flat.
|
| @@ -1741,19 +1738,9 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ LoadRoot(a1, Heap::kempty_stringRootIndex);
|
| __ Branch(&runtime, ne, a0, Operand(a1));
|
| __ lw(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
|
| + __ jmp(&check_underlying);
|
|
|
| - // (4) Is subject external? If yes, go to (7).
|
| - __ bind(&check_underlying);
|
| - __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
|
| - __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
|
| - STATIC_ASSERT(kSeqStringTag == 0);
|
| - __ And(at, a0, Operand(kStringRepresentationMask));
|
| - // The underlying external string is never a short external string.
|
| - STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
| - STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
| - __ Branch(&external_string, ne, at, Operand(zero_reg)); // Go to (7).
|
| -
|
| - // (5) Sequential string. Load regexp code according to encoding.
|
| + // (4) Sequential string. Load regexp code according to encoding.
|
| __ bind(&seq_string);
|
| // subject: sequential subject string (or look-alike, external string)
|
| // a3: original subject string
|
| @@ -1995,12 +1982,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ TailCallRuntime(Runtime::kRegExpExec);
|
|
|
| // Deferred code for string handling.
|
| - // (6) Not a long external string? If yes, go to (8).
|
| + // (5) Long external string? If not, go to (7).
|
| __ bind(¬_seq_nor_cons);
|
| - // Go to (8).
|
| + // Go to (7).
|
| __ Branch(¬_long_external, gt, a1, Operand(kExternalStringTag));
|
|
|
| - // (7) External string. Make it, offset-wise, look like a sequential string.
|
| + // (6) External string. Make it, offset-wise, look like a sequential string.
|
| __ bind(&external_string);
|
| __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
|
| __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
|
| @@ -2022,13 +2009,13 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| SeqTwoByteString::kHeaderSize - kHeapObjectTag);
|
| __ jmp(&seq_string); // Go to (5).
|
|
|
| - // (8) Short external string or not a string? If yes, bail out to runtime.
|
| + // (7) Short external string or not a string? If yes, bail out to runtime.
|
| __ bind(¬_long_external);
|
| STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
|
| __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
|
| __ Branch(&runtime, ne, at, Operand(zero_reg));
|
|
|
| - // (9) Sliced string. Replace subject with parent. Go to (4).
|
| + // (8) Sliced string. Replace subject with parent. Go to (4).
|
| // Load offset into t0 and replace subject string with parent.
|
| __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
|
| __ sra(t0, t0, kSmiTagSize);
|
|
|