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

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

Issue 7779030: MIPS: ported r9119 fixing performance regression in regexp. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4651 matching lines...) Expand 10 before | Expand all | Expand 10 after
4662 4662
4663 // For arguments 4 and 3 get string length, calculate start of string data 4663 // For arguments 4 and 3 get string length, calculate start of string data
4664 // and calculate the shift of the index (0 for ASCII and 1 for two byte). 4664 // and calculate the shift of the index (0 for ASCII and 1 for two byte).
4665 STATIC_ASSERT(SeqAsciiString::kHeaderSize == SeqTwoByteString::kHeaderSize); 4665 STATIC_ASSERT(SeqAsciiString::kHeaderSize == SeqTwoByteString::kHeaderSize);
4666 __ Addu(t2, subject, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 4666 __ Addu(t2, subject, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
4667 __ Xor(a3, a3, Operand(1)); // 1 for 2-byte str, 0 for 1-byte. 4667 __ Xor(a3, a3, Operand(1)); // 1 for 2-byte str, 0 for 1-byte.
4668 // Load the length from the original subject string from the previous stack 4668 // Load the length from the original subject string from the previous stack
4669 // frame. Therefore we have to use fp, which points exactly to two pointer 4669 // frame. Therefore we have to use fp, which points exactly to two pointer
4670 // sizes below the previous sp. (Because creating a new stack frame pushes 4670 // sizes below the previous sp. (Because creating a new stack frame pushes
4671 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.) 4671 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.)
4672 __ lw(a0, MemOperand(fp, kSubjectOffset + 2 * kPointerSize)); 4672 __ lw(subject, MemOperand(fp, kSubjectOffset + 2 * kPointerSize));
4673 // If slice offset is not 0, load the length from the original sliced string. 4673 // If slice offset is not 0, load the length from the original sliced string.
4674 // Argument 4, a3: End of string data 4674 // Argument 4, a3: End of string data
4675 // Argument 3, a2: Start of string data 4675 // Argument 3, a2: Start of string data
4676 // Prepare start and end index of the input. 4676 // Prepare start and end index of the input.
4677 __ sllv(t1, t0, a3); 4677 __ sllv(t1, t0, a3);
4678 __ addu(t0, t2, t1); 4678 __ addu(t0, t2, t1);
4679 __ sllv(t1, a1, a3); 4679 __ sllv(t1, a1, a3);
4680 __ addu(a2, t0, t1); 4680 __ addu(a2, t0, t1);
4681 4681
4682 __ lw(t2, FieldMemOperand(a0, String::kLengthOffset)); 4682 __ lw(t2, FieldMemOperand(subject, String::kLengthOffset));
4683 __ sra(t2, t2, kSmiTagSize); 4683 __ sra(t2, t2, kSmiTagSize);
4684 __ sllv(t1, t2, a3); 4684 __ sllv(t1, t2, a3);
4685 __ addu(a3, t0, t1); 4685 __ addu(a3, t0, t1);
4686 // Argument 2 (a1): Previous index. 4686 // Argument 2 (a1): Previous index.
4687 // Already there 4687 // Already there
4688 4688
4689 // Argument 1 (a0): Subject string. 4689 // Argument 1 (a0): Subject string.
4690 // Already there 4690 __ mov(a0, subject);
4691 4691
4692 // Locate the code entry and call it. 4692 // Locate the code entry and call it.
4693 __ Addu(t9, t9, Operand(Code::kHeaderSize - kHeapObjectTag)); 4693 __ Addu(t9, t9, Operand(Code::kHeaderSize - kHeapObjectTag));
4694 DirectCEntryStub stub; 4694 DirectCEntryStub stub;
4695 stub.GenerateCall(masm, t9); 4695 stub.GenerateCall(masm, t9);
4696 4696
4697 __ LeaveExitFrame(false, no_reg); 4697 __ LeaveExitFrame(false, no_reg);
4698 4698
4699 // v0: result 4699 // v0: result
4700 // subject: subject string (callee saved) 4700 // subject: subject string (callee saved)
4701 // regexp_data: RegExp data (callee saved) 4701 // regexp_data: RegExp data (callee saved)
4702 // last_match_info_elements: Last match info elements (callee saved) 4702 // last_match_info_elements: Last match info elements (callee saved)
4703 4703
4704 // Check the result. 4704 // Check the result.
4705 4705
4706 Label success; 4706 Label success;
4707 __ Branch(&success, eq, 4707 __ Branch(&success, eq,
4708 subject, Operand(NativeRegExpMacroAssembler::SUCCESS)); 4708 v0, Operand(NativeRegExpMacroAssembler::SUCCESS));
4709 Label failure; 4709 Label failure;
4710 __ Branch(&failure, eq, 4710 __ Branch(&failure, eq,
4711 subject, Operand(NativeRegExpMacroAssembler::FAILURE)); 4711 v0, Operand(NativeRegExpMacroAssembler::FAILURE));
4712 // If not exception it can only be retry. Handle that in the runtime system. 4712 // If not exception it can only be retry. Handle that in the runtime system.
4713 __ Branch(&runtime, ne, 4713 __ Branch(&runtime, ne,
4714 subject, Operand(NativeRegExpMacroAssembler::EXCEPTION)); 4714 v0, Operand(NativeRegExpMacroAssembler::EXCEPTION));
4715 // Result must now be exception. If there is no pending exception already a 4715 // Result must now be exception. If there is no pending exception already a
4716 // stack overflow (on the backtrack stack) was detected in RegExp code but 4716 // stack overflow (on the backtrack stack) was detected in RegExp code but
4717 // haven't created the exception yet. Handle that in the runtime system. 4717 // haven't created the exception yet. Handle that in the runtime system.
4718 // TODO(592): Rerunning the RegExp to get the stack overflow exception. 4718 // TODO(592): Rerunning the RegExp to get the stack overflow exception.
4719 __ li(a1, Operand( 4719 __ li(a1, Operand(
4720 ExternalReference::the_hole_value_location(masm->isolate()))); 4720 ExternalReference::the_hole_value_location(masm->isolate())));
4721 __ lw(a1, MemOperand(a1, 0)); 4721 __ lw(a1, MemOperand(a1, 0));
4722 __ li(a2, Operand(ExternalReference(Isolate::k_pending_exception_address, 4722 __ li(a2, Operand(ExternalReference(Isolate::k_pending_exception_address,
4723 masm->isolate()))); 4723 masm->isolate())));
4724 __ lw(v0, MemOperand(a2, 0)); 4724 __ lw(v0, MemOperand(a2, 0));
4725 __ Branch(&runtime, eq, subject, Operand(a1)); 4725 __ Branch(&runtime, eq, v0, Operand(a1));
4726 4726
4727 __ sw(a1, MemOperand(a2, 0)); // Clear pending exception. 4727 __ sw(a1, MemOperand(a2, 0)); // Clear pending exception.
4728 4728
4729 // Check if the exception is a termination. If so, throw as uncatchable. 4729 // Check if the exception is a termination. If so, throw as uncatchable.
4730 __ LoadRoot(a0, Heap::kTerminationExceptionRootIndex); 4730 __ LoadRoot(a0, Heap::kTerminationExceptionRootIndex);
4731 Label termination_exception; 4731 Label termination_exception;
4732 __ Branch(&termination_exception, eq, subject, Operand(a0)); 4732 __ Branch(&termination_exception, eq, v0, Operand(a0));
4733 4733
4734 __ Throw(subject); // Expects thrown value in v0. 4734 __ Throw(v0); // Expects thrown value in v0.
4735 4735
4736 __ bind(&termination_exception); 4736 __ bind(&termination_exception);
4737 __ ThrowUncatchable(TERMINATION, v0); // Expects thrown value in v0. 4737 __ ThrowUncatchable(TERMINATION, v0); // Expects thrown value in v0.
4738 4738
4739 __ bind(&failure); 4739 __ bind(&failure);
4740 // For failure and exception return null. 4740 // For failure and exception return null.
4741 __ li(v0, Operand(masm->isolate()->factory()->null_value())); 4741 __ li(v0, Operand(masm->isolate()->factory()->null_value()));
4742 __ Addu(sp, sp, Operand(4 * kPointerSize)); 4742 __ Addu(sp, sp, Operand(4 * kPointerSize));
4743 __ Ret(); 4743 __ Ret();
4744 4744
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
6886 __ mov(result, zero_reg); 6886 __ mov(result, zero_reg);
6887 __ Ret(); 6887 __ Ret();
6888 } 6888 }
6889 6889
6890 6890
6891 #undef __ 6891 #undef __
6892 6892
6893 } } // namespace v8::internal 6893 } } // namespace v8::internal
6894 6894
6895 #endif // V8_TARGET_ARCH_MIPS 6895 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698