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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 1575035: Port direct call to native RegExp from JavaScript to ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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 | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/x64/codegen-x64.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 10790 matching lines...) Expand 10 before | Expand all | Expand 10 after
10801 __ test(eax, Immediate(kSmiTagMask)); 10801 __ test(eax, Immediate(kSmiTagMask));
10802 __ j(zero, &runtime); 10802 __ j(zero, &runtime);
10803 Condition is_string = masm->IsObjectStringType(eax, ebx, ebx); 10803 Condition is_string = masm->IsObjectStringType(eax, ebx, ebx);
10804 __ j(NegateCondition(is_string), &runtime); 10804 __ j(NegateCondition(is_string), &runtime);
10805 // Get the length of the string to ebx. 10805 // Get the length of the string to ebx.
10806 __ mov(ebx, FieldOperand(eax, String::kLengthOffset)); 10806 __ mov(ebx, FieldOperand(eax, String::kLengthOffset));
10807 10807
10808 // ebx: Length of subject string 10808 // ebx: Length of subject string
10809 // ecx: RegExp data (FixedArray) 10809 // ecx: RegExp data (FixedArray)
10810 // edx: Number of capture registers 10810 // edx: Number of capture registers
10811 // Check that the third argument is a positive smi.
10812 // Check that the third argument is a positive smi less than the subject 10811 // Check that the third argument is a positive smi less than the subject
10813 // string length. A negative value will be greater (usigned comparison). 10812 // string length. A negative value will be greater (unsigned comparison).
10814 __ mov(eax, Operand(esp, kPreviousIndexOffset)); 10813 __ mov(eax, Operand(esp, kPreviousIndexOffset));
10815 __ SmiUntag(eax); 10814 __ SmiUntag(eax);
10816 __ cmp(eax, Operand(ebx)); 10815 __ cmp(eax, Operand(ebx));
10817 __ j(above, &runtime); 10816 __ j(above, &runtime);
10818 10817
10819 // ecx: RegExp data (FixedArray) 10818 // ecx: RegExp data (FixedArray)
10820 // edx: Number of capture registers 10819 // edx: Number of capture registers
10821 // Check that the fourth object is a JSArray object. 10820 // Check that the fourth object is a JSArray object.
10822 __ mov(eax, Operand(esp, kLastMatchInfoOffset)); 10821 __ mov(eax, Operand(esp, kLastMatchInfoOffset));
10823 __ test(eax, Immediate(kSmiTagMask)); 10822 __ test(eax, Immediate(kSmiTagMask));
(...skipping 26 matching lines...) Expand all
10850 ASSERT_EQ(0, kSeqStringTag); 10849 ASSERT_EQ(0, kSeqStringTag);
10851 __ test(Operand(ebx), 10850 __ test(Operand(ebx),
10852 Immediate(kIsNotStringMask | kStringRepresentationMask)); 10851 Immediate(kIsNotStringMask | kStringRepresentationMask));
10853 __ j(zero, &seq_string); 10852 __ j(zero, &seq_string);
10854 10853
10855 // Check for flat cons string. 10854 // Check for flat cons string.
10856 // A flat cons string is a cons string where the second part is the empty 10855 // A flat cons string is a cons string where the second part is the empty
10857 // string. In that case the subject string is just the first part of the cons 10856 // string. In that case the subject string is just the first part of the cons
10858 // string. Also in this case the first part of the cons string is known to be 10857 // string. Also in this case the first part of the cons string is known to be
10859 // a sequential string or an external string. 10858 // a sequential string or an external string.
10860 __ mov(edx, ebx); 10859 __ and_(ebx, kStringRepresentationMask);
10861 __ and_(edx, kStringRepresentationMask); 10860 __ cmp(ebx, kConsStringTag);
10862 __ cmp(edx, kConsStringTag);
10863 __ j(not_equal, &runtime); 10861 __ j(not_equal, &runtime);
10864 __ mov(edx, FieldOperand(eax, ConsString::kSecondOffset)); 10862 __ mov(edx, FieldOperand(eax, ConsString::kSecondOffset));
10865 __ cmp(Operand(edx), Factory::empty_string()); 10863 __ cmp(Operand(edx), Factory::empty_string());
10866 __ j(not_equal, &runtime); 10864 __ j(not_equal, &runtime);
10867 __ mov(eax, FieldOperand(eax, ConsString::kFirstOffset)); 10865 __ mov(eax, FieldOperand(eax, ConsString::kFirstOffset));
10868 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 10866 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
10869 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 10867 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
10870 ASSERT_EQ(0, kSeqStringTag); 10868 ASSERT_EQ(0, kSeqStringTag);
10871 __ test(ebx, Immediate(kStringRepresentationMask)); 10869 __ test(ebx, Immediate(kStringRepresentationMask));
10872 __ j(not_zero, &runtime); 10870 __ j(not_zero, &runtime);
10873 __ and_(ebx, kStringRepresentationEncodingMask); 10871 __ and_(ebx, kStringRepresentationEncodingMask);
10874 10872
10875 __ bind(&seq_string); 10873 __ bind(&seq_string);
10876 // eax: subject string (sequential either ascii to two byte) 10874 // eax: subject string (sequential either ascii to two byte)
10877 // ebx: suject string type & kStringRepresentationEncodingMask 10875 // ebx: suject string type & kStringRepresentationEncodingMask
10878 // ecx: RegExp data (FixedArray) 10876 // ecx: RegExp data (FixedArray)
10879 // Check that the irregexp code has been generated for an ascii string. If 10877 // Check that the irregexp code has been generated for an ascii string. If
10880 // it has, the field contains a code object otherwise it contains the hole. 10878 // it has, the field contains a code object otherwise it contains the hole.
10881 __ cmp(ebx, kStringTag | kSeqStringTag | kTwoByteStringTag); 10879 const int kSeqTwoByteString = kStringTag | kSeqStringTag | kTwoByteStringTag;
10880 __ cmp(ebx, kSeqTwoByteString);
10882 __ j(equal, &seq_two_byte_string); 10881 __ j(equal, &seq_two_byte_string);
10883 if (FLAG_debug_code) { 10882 if (FLAG_debug_code) {
10884 __ cmp(ebx, kStringTag | kSeqStringTag | kAsciiStringTag); 10883 __ cmp(ebx, kStringTag | kSeqStringTag | kAsciiStringTag);
10885 __ Check(equal, "Expected sequential ascii string"); 10884 __ Check(equal, "Expected sequential ascii string");
10886 } 10885 }
10887 __ mov(edx, FieldOperand(ecx, JSRegExp::kDataAsciiCodeOffset)); 10886 __ mov(edx, FieldOperand(ecx, JSRegExp::kDataAsciiCodeOffset));
10888 __ Set(edi, Immediate(1)); // Type is ascii. 10887 __ Set(edi, Immediate(1)); // Type is ascii.
10889 __ jmp(&check_code); 10888 __ jmp(&check_code);
10890 10889
10891 __ bind(&seq_two_byte_string); 10890 __ bind(&seq_two_byte_string);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
10967 __ j(equal, &success, taken); 10966 __ j(equal, &success, taken);
10968 Label failure; 10967 Label failure;
10969 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); 10968 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE);
10970 __ j(equal, &failure, taken); 10969 __ j(equal, &failure, taken);
10971 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); 10970 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION);
10972 // If not exception it can only be retry. Handle that in the runtime system. 10971 // If not exception it can only be retry. Handle that in the runtime system.
10973 __ j(not_equal, &runtime); 10972 __ j(not_equal, &runtime);
10974 // Result must now be exception. If there is no pending exception already a 10973 // Result must now be exception. If there is no pending exception already a
10975 // stack overflow (on the backtrack stack) was detected in RegExp code but 10974 // stack overflow (on the backtrack stack) was detected in RegExp code but
10976 // haven't created the exception yet. Handle that in the runtime system. 10975 // haven't created the exception yet. Handle that in the runtime system.
10977 // TODO(592) Rerunning the RegExp to get the stack overflow exception. 10976 // TODO(592): Rerunning the RegExp to get the stack overflow exception.
10978 ExternalReference pending_exception(Top::k_pending_exception_address); 10977 ExternalReference pending_exception(Top::k_pending_exception_address);
10979 __ mov(eax, 10978 __ mov(eax,
10980 Operand::StaticVariable(ExternalReference::the_hole_value_location())); 10979 Operand::StaticVariable(ExternalReference::the_hole_value_location()));
10981 __ cmp(eax, Operand::StaticVariable(pending_exception)); 10980 __ cmp(eax, Operand::StaticVariable(pending_exception));
10982 __ j(equal, &runtime); 10981 __ j(equal, &runtime);
10983 __ bind(&failure); 10982 __ bind(&failure);
10984 // For failure and exception return null. 10983 // For failure and exception return null.
10985 __ mov(Operand(eax), Factory::null_value()); 10984 __ mov(Operand(eax), Factory::null_value());
10986 __ ret(4 * kPointerSize); 10985 __ ret(4 * kPointerSize);
10987 10986
(...skipping 30 matching lines...) Expand all
11018 11017
11019 // Get the static offsets vector filled by the native regexp code. 11018 // Get the static offsets vector filled by the native regexp code.
11020 ExternalReference address_of_static_offsets_vector = 11019 ExternalReference address_of_static_offsets_vector =
11021 ExternalReference::address_of_static_offsets_vector(); 11020 ExternalReference::address_of_static_offsets_vector();
11022 __ mov(ecx, Immediate(address_of_static_offsets_vector)); 11021 __ mov(ecx, Immediate(address_of_static_offsets_vector));
11023 11022
11024 // ebx: last_match_info backing store (FixedArray) 11023 // ebx: last_match_info backing store (FixedArray)
11025 // ecx: offsets vector 11024 // ecx: offsets vector
11026 // edx: number of capture registers 11025 // edx: number of capture registers
11027 Label next_capture, done; 11026 Label next_capture, done;
11028 __ mov(eax, Operand(esp, kPreviousIndexOffset));
11029 // Capture register counter starts from number of capture registers and 11027 // Capture register counter starts from number of capture registers and
11030 // counts down until wraping after zero. 11028 // counts down until wraping after zero.
11031 __ bind(&next_capture); 11029 __ bind(&next_capture);
11032 __ sub(Operand(edx), Immediate(1)); 11030 __ sub(Operand(edx), Immediate(1));
11033 __ j(negative, &done); 11031 __ j(negative, &done);
11034 // Read the value from the static offsets vector buffer. 11032 // Read the value from the static offsets vector buffer.
11035 __ mov(edi, Operand(ecx, edx, times_int_size, 0)); 11033 __ mov(edi, Operand(ecx, edx, times_int_size, 0));
11036 __ SmiTag(edi); 11034 __ SmiTag(edi);
11037 // Store the smi value in the last match info. 11035 // Store the smi value in the last match info.
11038 __ mov(FieldOperand(ebx, 11036 __ mov(FieldOperand(ebx,
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
12800 12798
12801 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 12799 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
12802 // tagged as a small integer. 12800 // tagged as a small integer.
12803 __ bind(&runtime); 12801 __ bind(&runtime);
12804 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 12802 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
12805 } 12803 }
12806 12804
12807 #undef __ 12805 #undef __
12808 12806
12809 } } // namespace v8::internal 12807 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698