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

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

Issue 10386090: Implement loop for global regexps in regexp assembler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix bugs, add tests, port to x64 and arm. Created 8 years, 7 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4806 matching lines...) Expand 10 before | Expand all | Expand 10 after
4817 4817
4818 // r1: previous index 4818 // r1: previous index
4819 // r3: encoding of subject string (1 if ASCII, 0 if two_byte); 4819 // r3: encoding of subject string (1 if ASCII, 0 if two_byte);
4820 // r7: code 4820 // r7: code
4821 // subject: Subject string 4821 // subject: Subject string
4822 // regexp_data: RegExp data (FixedArray) 4822 // regexp_data: RegExp data (FixedArray)
4823 // All checks done. Now push arguments for native regexp code. 4823 // All checks done. Now push arguments for native regexp code.
4824 __ IncrementCounter(isolate->counters()->regexp_entry_native(), 1, r0, r2); 4824 __ IncrementCounter(isolate->counters()->regexp_entry_native(), 1, r0, r2);
4825 4825
4826 // Isolates: note we add an additional parameter here (isolate pointer). 4826 // Isolates: note we add an additional parameter here (isolate pointer).
4827 const int kRegExpExecuteArguments = 8; 4827 const int kRegExpExecuteArguments = 9;
4828 const int kParameterRegisters = 4; 4828 const int kParameterRegisters = 4;
4829 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); 4829 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters);
4830 4830
4831 // Stack pointer now points to cell where return address is to be written. 4831 // Stack pointer now points to cell where return address is to be written.
4832 // Arguments are before that on the stack or in registers. 4832 // Arguments are before that on the stack or in registers.
4833 4833
4834 // Argument 8 (sp[16]): Pass current isolate address. 4834 // Argument 9 (sp[20]): Pass current isolate address.
4835 __ mov(r0, Operand(ExternalReference::isolate_address())); 4835 __ mov(r0, Operand(ExternalReference::isolate_address()));
4836 __ str(r0, MemOperand(sp, 5 * kPointerSize));
4837
4838 // Argument 8 (sp[16]): Indicate that this is a direct call from JavaScript.
4839 __ mov(r0, Operand(1));
4836 __ str(r0, MemOperand(sp, 4 * kPointerSize)); 4840 __ str(r0, MemOperand(sp, 4 * kPointerSize));
4837 4841
4838 // Argument 7 (sp[12]): Indicate that this is a direct call from JavaScript. 4842 // Argument 7 (sp[12]): Start (high end) of backtracking stack memory area.
4839 __ mov(r0, Operand(1));
4840 __ str(r0, MemOperand(sp, 3 * kPointerSize));
4841
4842 // Argument 6 (sp[8]): Start (high end) of backtracking stack memory area.
4843 __ mov(r0, Operand(address_of_regexp_stack_memory_address)); 4843 __ mov(r0, Operand(address_of_regexp_stack_memory_address));
4844 __ ldr(r0, MemOperand(r0, 0)); 4844 __ ldr(r0, MemOperand(r0, 0));
4845 __ mov(r2, Operand(address_of_regexp_stack_memory_size)); 4845 __ mov(r2, Operand(address_of_regexp_stack_memory_size));
4846 __ ldr(r2, MemOperand(r2, 0)); 4846 __ ldr(r2, MemOperand(r2, 0));
4847 __ add(r0, r0, Operand(r2)); 4847 __ add(r0, r0, Operand(r2));
4848 __ str(r0, MemOperand(sp, 3 * kPointerSize));
4849
4850 // Argument 6: Clear the number of capture registers for non-global capture.
Erik Corry 2012/05/22 08:32:46 I don't understand this comment. Is argument 6 a
Yang 2012/05/22 14:48:03 Done.
4851 __ mov(r0, Operand(0));
4848 __ str(r0, MemOperand(sp, 2 * kPointerSize)); 4852 __ str(r0, MemOperand(sp, 2 * kPointerSize));
4849 4853
4850 // Argument 5 (sp[4]): static offsets vector buffer. 4854 // Argument 5 (sp[4]): static offsets vector buffer.
4851 __ mov(r0, 4855 __ mov(r0,
4852 Operand(ExternalReference::address_of_static_offsets_vector(isolate))); 4856 Operand(ExternalReference::address_of_static_offsets_vector(isolate)));
4853 __ str(r0, MemOperand(sp, 1 * kPointerSize)); 4857 __ str(r0, MemOperand(sp, 1 * kPointerSize));
4854 4858
4855 // For arguments 4 and 3 get string length, calculate start of string data and 4859 // For arguments 4 and 3 get string length, calculate start of string data and
4856 // calculate the shift of the index (0 for ASCII and 1 for two byte). 4860 // calculate the shift of the index (0 for ASCII and 1 for two byte).
4857 __ add(r8, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag)); 4861 __ add(r8, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag));
(...skipping 29 matching lines...) Expand all
4887 4891
4888 // r0: result 4892 // r0: result
4889 // subject: subject string (callee saved) 4893 // subject: subject string (callee saved)
4890 // regexp_data: RegExp data (callee saved) 4894 // regexp_data: RegExp data (callee saved)
4891 // last_match_info_elements: Last match info elements (callee saved) 4895 // last_match_info_elements: Last match info elements (callee saved)
4892 4896
4893 // Check the result. 4897 // Check the result.
4894 Label success; 4898 Label success;
4895 4899
4896 __ cmp(r0, Operand(NativeRegExpMacroAssembler::SUCCESS)); 4900 __ cmp(r0, Operand(NativeRegExpMacroAssembler::SUCCESS));
4901 // We do not expect multiple results.
Erik Corry 2012/05/22 08:32:46 This comment does not clarify much. Why do we not
Yang 2012/05/22 14:48:03 Done.
4897 __ b(eq, &success); 4902 __ b(eq, &success);
4898 Label failure; 4903 Label failure;
4899 __ cmp(r0, Operand(NativeRegExpMacroAssembler::FAILURE)); 4904 __ cmp(r0, Operand(NativeRegExpMacroAssembler::FAILURE));
4900 __ b(eq, &failure); 4905 __ b(eq, &failure);
4901 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); 4906 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION));
4902 // If not exception it can only be retry. Handle that in the runtime system. 4907 // If not exception it can only be retry. Handle that in the runtime system.
4903 __ b(ne, &runtime); 4908 __ b(ne, &runtime);
4904 // Result must now be exception. If there is no pending exception already a 4909 // Result must now be exception. If there is no pending exception already a
4905 // stack overflow (on the backtrack stack) was detected in RegExp code but 4910 // stack overflow (on the backtrack stack) was detected in RegExp code but
4906 // haven't created the exception yet. Handle that in the runtime system. 4911 // haven't created the exception yet. Handle that in the runtime system.
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
7398 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, 7403 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2,
7399 &slow_elements); 7404 &slow_elements);
7400 __ Ret(); 7405 __ Ret();
7401 } 7406 }
7402 7407
7403 #undef __ 7408 #undef __
7404 7409
7405 } } // namespace v8::internal 7410 } } // namespace v8::internal
7406 7411
7407 #endif // V8_TARGET_ARCH_ARM 7412 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/regexp-macro-assembler-arm.h » ('j') | src/arm/regexp-macro-assembler-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698