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

Side by Side Diff: src/ia32/code-stubs-ia32.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 3804 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 3815
3816 // eax: subject string 3816 // eax: subject string
3817 // ebx: previous index 3817 // ebx: previous index
3818 // edx: code 3818 // edx: code
3819 // ecx: encoding of subject string (1 if ASCII 0 if two_byte); 3819 // ecx: encoding of subject string (1 if ASCII 0 if two_byte);
3820 // All checks done. Now push arguments for native regexp code. 3820 // All checks done. Now push arguments for native regexp code.
3821 Counters* counters = masm->isolate()->counters(); 3821 Counters* counters = masm->isolate()->counters();
3822 __ IncrementCounter(counters->regexp_entry_native(), 1); 3822 __ IncrementCounter(counters->regexp_entry_native(), 1);
3823 3823
3824 // Isolates: note we add an additional parameter here (isolate pointer). 3824 // Isolates: note we add an additional parameter here (isolate pointer).
3825 static const int kRegExpExecuteArguments = 8; 3825 static const int kRegExpExecuteArguments = 9;
3826 __ EnterApiExitFrame(kRegExpExecuteArguments); 3826 __ EnterApiExitFrame(kRegExpExecuteArguments);
3827 3827
3828 // Argument 8: Pass current isolate address. 3828 // Argument 9: Pass current isolate address.
3829 __ mov(Operand(esp, 7 * kPointerSize), 3829 __ mov(Operand(esp, 8 * kPointerSize),
3830 Immediate(ExternalReference::isolate_address())); 3830 Immediate(ExternalReference::isolate_address()));
3831 3831
3832 // Argument 7: Indicate that this is a direct call from JavaScript. 3832 // Argument 8: Indicate that this is a direct call from JavaScript.
3833 __ mov(Operand(esp, 6 * kPointerSize), Immediate(1)); 3833 __ mov(Operand(esp, 7 * kPointerSize), Immediate(1));
3834 3834
3835 // Argument 6: Start (high end) of backtracking stack memory area. 3835 // Argument 7: Start (high end) of backtracking stack memory area.
3836 __ mov(esi, Operand::StaticVariable(address_of_regexp_stack_memory_address)); 3836 __ mov(esi, Operand::StaticVariable(address_of_regexp_stack_memory_address));
3837 __ add(esi, Operand::StaticVariable(address_of_regexp_stack_memory_size)); 3837 __ add(esi, Operand::StaticVariable(address_of_regexp_stack_memory_size));
3838 __ mov(Operand(esp, 5 * kPointerSize), esi); 3838 __ mov(Operand(esp, 6 * kPointerSize), esi);
3839
3840 // Argument 6: Clear the number of capture registers for non-global capture.
3841 __ mov(Operand(esp, 5 * kPointerSize), Immediate(0));
3839 3842
3840 // Argument 5: static offsets vector buffer. 3843 // Argument 5: static offsets vector buffer.
3841 __ mov(Operand(esp, 4 * kPointerSize), 3844 __ mov(Operand(esp, 4 * kPointerSize),
3842 Immediate(ExternalReference::address_of_static_offsets_vector( 3845 Immediate(ExternalReference::address_of_static_offsets_vector(
3843 masm->isolate()))); 3846 masm->isolate())));
3844 3847
3845 // Argument 2: Previous index. 3848 // Argument 2: Previous index.
3846 __ mov(Operand(esp, 1 * kPointerSize), ebx); 3849 __ mov(Operand(esp, 1 * kPointerSize), ebx);
3847 3850
3848 // Argument 1: Original subject string. 3851 // Argument 1: Original subject string.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3892 // Locate the code entry and call it. 3895 // Locate the code entry and call it.
3893 __ add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 3896 __ add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag));
3894 __ call(edx); 3897 __ call(edx);
3895 3898
3896 // Drop arguments and come back to JS mode. 3899 // Drop arguments and come back to JS mode.
3897 __ LeaveApiExitFrame(); 3900 __ LeaveApiExitFrame();
3898 3901
3899 // Check the result. 3902 // Check the result.
3900 Label success; 3903 Label success;
3901 __ cmp(eax, NativeRegExpMacroAssembler::SUCCESS); 3904 __ cmp(eax, NativeRegExpMacroAssembler::SUCCESS);
3905 // We do not expect multiple results.
3902 __ j(equal, &success); 3906 __ j(equal, &success);
3903 Label failure; 3907 Label failure;
3904 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); 3908 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE);
3905 __ j(equal, &failure); 3909 __ j(equal, &failure);
3906 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); 3910 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION);
3907 // If not exception it can only be retry. Handle that in the runtime system. 3911 // If not exception it can only be retry. Handle that in the runtime system.
3908 __ j(not_equal, &runtime); 3912 __ j(not_equal, &runtime);
3909 // Result must now be exception. If there is no pending exception already a 3913 // Result must now be exception. If there is no pending exception already a
3910 // stack overflow (on the backtrack stack) was detected in RegExp code but 3914 // stack overflow (on the backtrack stack) was detected in RegExp code but
3911 // haven't created the exception yet. Handle that in the runtime system. 3915 // haven't created the exception yet. Handle that in the runtime system.
(...skipping 3477 matching lines...) Expand 10 before | Expand all | Expand 10 after
7389 false); 7393 false);
7390 __ pop(edx); 7394 __ pop(edx);
7391 __ ret(0); 7395 __ ret(0);
7392 } 7396 }
7393 7397
7394 #undef __ 7398 #undef __
7395 7399
7396 } } // namespace v8::internal 7400 } } // namespace v8::internal
7397 7401
7398 #endif // V8_TARGET_ARCH_IA32 7402 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698