Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/regexp/jsregexp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 // Process the result from the native regexp code. 1569 // Process the result from the native regexp code.
1570 __ bind(&success); 1570 __ bind(&success);
1571 __ LoadP(r4, 1571 __ LoadP(r4,
1572 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); 1572 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset));
1573 // Calculate number of capture registers (number_of_captures + 1) * 2. 1573 // Calculate number of capture registers (number_of_captures + 1) * 2.
1574 // SmiToShortArrayOffset accomplishes the multiplication by 2 and 1574 // SmiToShortArrayOffset accomplishes the multiplication by 2 and
1575 // SmiUntag (which is a nop for 32-bit). 1575 // SmiUntag (which is a nop for 32-bit).
1576 __ SmiToShortArrayOffset(r4, r4); 1576 __ SmiToShortArrayOffset(r4, r4);
1577 __ addi(r4, r4, Operand(2)); 1577 __ addi(r4, r4, Operand(2));
1578 1578
1579 __ LoadP(r3, MemOperand(sp, kLastMatchInfoOffset)); 1579 // Check that the last match info is a FixedArray.
1580 __ JumpIfSmi(r3, &runtime); 1580 __ LoadP(last_match_info_elements, MemOperand(sp, kLastMatchInfoOffset));
1581 __ CompareObjectType(r3, r5, r5, JS_OBJECT_TYPE); 1581 __ JumpIfSmi(last_match_info_elements, &runtime);
1582 __ bne(&runtime);
1583 // Check that the object has fast elements. 1582 // Check that the object has fast elements.
1584 __ LoadP(last_match_info_elements,
1585 FieldMemOperand(r3, JSArray::kElementsOffset));
1586 __ LoadP(r3, 1583 __ LoadP(r3,
1587 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); 1584 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset));
1588 __ CompareRoot(r3, Heap::kFixedArrayMapRootIndex); 1585 __ CompareRoot(r3, Heap::kFixedArrayMapRootIndex);
1589 __ bne(&runtime); 1586 __ bne(&runtime);
1590 // Check that the last match info has space for the capture registers and the 1587 // Check that the last match info has space for the capture registers and the
1591 // additional information. 1588 // additional information.
1592 __ LoadP( 1589 __ LoadP(
1593 r3, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); 1590 r3, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset));
1594 __ addi(r5, r4, Operand(RegExpImpl::kLastMatchOverhead)); 1591 __ addi(r5, r4, Operand(RegExpMatchInfo::kLastMatchOverhead));
1595 __ SmiUntag(r0, r3); 1592 __ SmiUntag(r0, r3);
1596 __ cmp(r5, r0); 1593 __ cmp(r5, r0);
1597 __ bgt(&runtime); 1594 __ bgt(&runtime);
1598 1595
1599 // r4: number of capture registers 1596 // r4: number of capture registers
1600 // subject: subject string 1597 // subject: subject string
1601 // Store the capture count. 1598 // Store the capture count.
1602 __ SmiTag(r5, r4); 1599 __ SmiTag(r5, r4);
1603 __ StoreP(r5, FieldMemOperand(last_match_info_elements, 1600 __ StoreP(r5, FieldMemOperand(last_match_info_elements,
1604 RegExpImpl::kLastCaptureCountOffset), 1601 RegExpMatchInfo::kNumberOfCapturesOffset),
1605 r0); 1602 r0);
1606 // Store last subject and last input. 1603 // Store last subject and last input.
1607 __ StoreP(subject, FieldMemOperand(last_match_info_elements, 1604 __ StoreP(subject, FieldMemOperand(last_match_info_elements,
1608 RegExpImpl::kLastSubjectOffset), 1605 RegExpMatchInfo::kLastSubjectOffset),
1609 r0); 1606 r0);
1610 __ mr(r5, subject); 1607 __ mr(r5, subject);
1611 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastSubjectOffset, 1608 __ RecordWriteField(last_match_info_elements,
1612 subject, r10, kLRHasNotBeenSaved, kDontSaveFPRegs); 1609 RegExpMatchInfo::kLastSubjectOffset, subject, r10,
1610 kLRHasNotBeenSaved, kDontSaveFPRegs);
1613 __ mr(subject, r5); 1611 __ mr(subject, r5);
1614 __ StoreP(subject, FieldMemOperand(last_match_info_elements, 1612 __ StoreP(subject, FieldMemOperand(last_match_info_elements,
1615 RegExpImpl::kLastInputOffset), 1613 RegExpMatchInfo::kLastInputOffset),
1616 r0); 1614 r0);
1617 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastInputOffset, 1615 __ RecordWriteField(last_match_info_elements,
1618 subject, r10, kLRHasNotBeenSaved, kDontSaveFPRegs); 1616 RegExpMatchInfo::kLastInputOffset, subject, r10,
1617 kLRHasNotBeenSaved, kDontSaveFPRegs);
1619 1618
1620 // Get the static offsets vector filled by the native regexp code. 1619 // Get the static offsets vector filled by the native regexp code.
1621 ExternalReference address_of_static_offsets_vector = 1620 ExternalReference address_of_static_offsets_vector =
1622 ExternalReference::address_of_static_offsets_vector(isolate()); 1621 ExternalReference::address_of_static_offsets_vector(isolate());
1623 __ mov(r5, Operand(address_of_static_offsets_vector)); 1622 __ mov(r5, Operand(address_of_static_offsets_vector));
1624 1623
1625 // r4: number of capture registers 1624 // r4: number of capture registers
1626 // r5: offsets vector 1625 // r5: offsets vector
1627 Label next_capture; 1626 Label next_capture;
1628 // Capture register counter starts from number of capture registers and 1627 // Capture register counter starts from number of capture registers and
1629 // counts down until wraping after zero. 1628 // counts down until wrapping after zero.
1630 __ addi( 1629 __ addi(r3, last_match_info_elements,
1631 r3, last_match_info_elements, 1630 Operand(RegExpMatchInfo::kFirstCaptureOffset - kHeapObjectTag -
1632 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag - kPointerSize)); 1631 kPointerSize));
1633 __ addi(r5, r5, Operand(-kIntSize)); // bias down for lwzu 1632 __ addi(r5, r5, Operand(-kIntSize)); // bias down for lwzu
1634 __ mtctr(r4); 1633 __ mtctr(r4);
1635 __ bind(&next_capture); 1634 __ bind(&next_capture);
1636 // Read the value from the static offsets vector buffer. 1635 // Read the value from the static offsets vector buffer.
1637 __ lwzu(r6, MemOperand(r5, kIntSize)); 1636 __ lwzu(r6, MemOperand(r5, kIntSize));
1638 // Store the smi value in the last match info. 1637 // Store the smi value in the last match info.
1639 __ SmiTag(r6); 1638 __ SmiTag(r6);
1640 __ StorePU(r6, MemOperand(r3, kPointerSize)); 1639 __ StorePU(r6, MemOperand(r3, kPointerSize));
1641 __ bdnz(&next_capture); 1640 __ bdnz(&next_capture);
1642 1641
1643 // Return last match info. 1642 // Return last match info.
1644 __ LoadP(r3, MemOperand(sp, kLastMatchInfoOffset)); 1643 __ mr(r3, last_match_info_elements);
1645 __ addi(sp, sp, Operand(4 * kPointerSize)); 1644 __ addi(sp, sp, Operand(4 * kPointerSize));
1646 __ Ret(); 1645 __ Ret();
1647 1646
1648 // Do the runtime call to execute the regexp. 1647 // Do the runtime call to execute the regexp.
1649 __ bind(&runtime); 1648 __ bind(&runtime);
1650 __ TailCallRuntime(Runtime::kRegExpExec); 1649 __ TailCallRuntime(Runtime::kRegExpExec);
1651 1650
1652 // Deferred code for string handling. 1651 // Deferred code for string handling.
1653 // (5) Long external string? If not, go to (7). 1652 // (5) Long external string? If not, go to (7).
1654 __ bind(&not_seq_nor_cons); 1653 __ bind(&not_seq_nor_cons);
(...skipping 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after
4905 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 4904 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
4906 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4905 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4907 kStackUnwindSpace, NULL, return_value_operand, NULL); 4906 kStackUnwindSpace, NULL, return_value_operand, NULL);
4908 } 4907 }
4909 4908
4910 #undef __ 4909 #undef __
4911 } // namespace internal 4910 } // namespace internal
4912 } // namespace v8 4911 } // namespace v8
4913 4912
4914 #endif // V8_TARGET_ARCH_PPC 4913 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/regexp/jsregexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698