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

Side by Side Diff: src/ia32/regexp-macro-assembler-ia32.cc

Issue 6713074: Require an isolate parameter for most external reference creation to (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Further cleanup Created 9 years, 9 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/ia32/macro-assembler-ia32.cc ('k') | src/ia32/stub-cache-ia32.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 2008-2009 the V8 project authors. All rights reserved. 1 // Copyright 2008-2009 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // Found by adding negative string-end offset of current position (edi) 386 // Found by adding negative string-end offset of current position (edi)
387 // to end of string. 387 // to end of string.
388 __ add(edi, Operand(esi)); 388 __ add(edi, Operand(esi));
389 __ mov(Operand(esp, 1 * kPointerSize), edi); 389 __ mov(Operand(esp, 1 * kPointerSize), edi);
390 // Set byte_offset1. 390 // Set byte_offset1.
391 // Start of capture, where edx already holds string-end negative offset. 391 // Start of capture, where edx already holds string-end negative offset.
392 __ add(edx, Operand(esi)); 392 __ add(edx, Operand(esi));
393 __ mov(Operand(esp, 0 * kPointerSize), edx); 393 __ mov(Operand(esp, 0 * kPointerSize), edx);
394 394
395 ExternalReference compare = 395 ExternalReference compare =
396 ExternalReference::re_case_insensitive_compare_uc16(); 396 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate());
397 __ CallCFunction(compare, argument_count); 397 __ CallCFunction(compare, argument_count);
398 // Pop original values before reacting on result value. 398 // Pop original values before reacting on result value.
399 __ pop(ebx); 399 __ pop(ebx);
400 __ pop(backtrack_stackpointer()); 400 __ pop(backtrack_stackpointer());
401 __ pop(edi); 401 __ pop(edi);
402 __ pop(esi); 402 __ pop(esi);
403 403
404 // Check if function returned non-zero for success or zero for failure. 404 // Check if function returned non-zero for success or zero for failure.
405 __ or_(eax, Operand(eax)); 405 __ or_(eax, Operand(eax));
406 BranchOrBacktrack(zero, on_no_match); 406 BranchOrBacktrack(zero, on_no_match);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 __ push(esi); 672 __ push(esi);
673 __ push(edi); 673 __ push(edi);
674 __ push(ebx); // Callee-save on MacOS. 674 __ push(ebx); // Callee-save on MacOS.
675 __ push(Immediate(0)); // Make room for "input start - 1" constant. 675 __ push(Immediate(0)); // Make room for "input start - 1" constant.
676 676
677 // Check if we have space on the stack for registers. 677 // Check if we have space on the stack for registers.
678 Label stack_limit_hit; 678 Label stack_limit_hit;
679 Label stack_ok; 679 Label stack_ok;
680 680
681 ExternalReference stack_limit = 681 ExternalReference stack_limit =
682 ExternalReference::address_of_stack_limit(); 682 ExternalReference::address_of_stack_limit(masm_->isolate());
683 __ mov(ecx, esp); 683 __ mov(ecx, esp);
684 __ sub(ecx, Operand::StaticVariable(stack_limit)); 684 __ sub(ecx, Operand::StaticVariable(stack_limit));
685 // Handle it if the stack pointer is already below the stack limit. 685 // Handle it if the stack pointer is already below the stack limit.
686 __ j(below_equal, &stack_limit_hit, not_taken); 686 __ j(below_equal, &stack_limit_hit, not_taken);
687 // Check if there is room for the variable number of registers above 687 // Check if there is room for the variable number of registers above
688 // the stack limit. 688 // the stack limit.
689 __ cmp(ecx, num_registers_ * kPointerSize); 689 __ cmp(ecx, num_registers_ * kPointerSize);
690 __ j(above_equal, &stack_ok, taken); 690 __ j(above_equal, &stack_ok, taken);
691 // Exit with OutOfMemory exception. There is not enough space on the stack 691 // Exit with OutOfMemory exception. There is not enough space on the stack
692 // for our working registers. 692 // for our working registers.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // Save registers before calling C function 836 // Save registers before calling C function
837 __ push(esi); 837 __ push(esi);
838 __ push(edi); 838 __ push(edi);
839 839
840 // Call GrowStack(backtrack_stackpointer()) 840 // Call GrowStack(backtrack_stackpointer())
841 static const int num_arguments = 2; 841 static const int num_arguments = 2;
842 __ PrepareCallCFunction(num_arguments, ebx); 842 __ PrepareCallCFunction(num_arguments, ebx);
843 __ lea(eax, Operand(ebp, kStackHighEnd)); 843 __ lea(eax, Operand(ebp, kStackHighEnd));
844 __ mov(Operand(esp, 1 * kPointerSize), eax); 844 __ mov(Operand(esp, 1 * kPointerSize), eax);
845 __ mov(Operand(esp, 0 * kPointerSize), backtrack_stackpointer()); 845 __ mov(Operand(esp, 0 * kPointerSize), backtrack_stackpointer());
846 ExternalReference grow_stack = ExternalReference::re_grow_stack(); 846 ExternalReference grow_stack =
847 ExternalReference::re_grow_stack(masm_->isolate());
847 __ CallCFunction(grow_stack, num_arguments); 848 __ CallCFunction(grow_stack, num_arguments);
848 // If return NULL, we have failed to grow the stack, and 849 // If return NULL, we have failed to grow the stack, and
849 // must exit with a stack-overflow exception. 850 // must exit with a stack-overflow exception.
850 __ or_(eax, Operand(eax)); 851 __ or_(eax, Operand(eax));
851 __ j(equal, &exit_with_exception); 852 __ j(equal, &exit_with_exception);
852 // Otherwise use return value as new stack pointer. 853 // Otherwise use return value as new stack pointer.
853 __ mov(backtrack_stackpointer(), eax); 854 __ mov(backtrack_stackpointer(), eax);
854 // Restore saved registers and continue. 855 // Restore saved registers and continue.
855 __ pop(edi); 856 __ pop(edi);
856 __ pop(esi); 857 __ pop(esi);
857 SafeReturn(); 858 SafeReturn();
858 } 859 }
859 860
860 if (exit_with_exception.is_linked()) { 861 if (exit_with_exception.is_linked()) {
861 // If any of the code above needed to exit with an exception. 862 // If any of the code above needed to exit with an exception.
862 __ bind(&exit_with_exception); 863 __ bind(&exit_with_exception);
863 // Exit with Result EXCEPTION(-1) to signal thrown exception. 864 // Exit with Result EXCEPTION(-1) to signal thrown exception.
864 __ mov(eax, EXCEPTION); 865 __ mov(eax, EXCEPTION);
865 __ jmp(&exit_label_); 866 __ jmp(&exit_label_);
866 } 867 }
867 868
868 CodeDesc code_desc; 869 CodeDesc code_desc;
869 masm_->GetCode(&code_desc); 870 masm_->GetCode(&code_desc);
870 Isolate* isolate = ISOLATE;
871 Handle<Code> code = 871 Handle<Code> code =
872 isolate->factory()->NewCode(code_desc, 872 masm_->isolate()->factory()->NewCode(code_desc,
873 Code::ComputeFlags(Code::REGEXP), 873 Code::ComputeFlags(Code::REGEXP),
874 masm_->CodeObject()); 874 masm_->CodeObject());
875 PROFILE(isolate, RegExpCodeCreateEvent(*code, *source)); 875 PROFILE(masm_->isolate(), RegExpCodeCreateEvent(*code, *source));
876 return Handle<Object>::cast(code); 876 return Handle<Object>::cast(code);
877 } 877 }
878 878
879 879
880 void RegExpMacroAssemblerIA32::GoTo(Label* to) { 880 void RegExpMacroAssemblerIA32::GoTo(Label* to) {
881 BranchOrBacktrack(no_condition, to); 881 BranchOrBacktrack(no_condition, to);
882 } 882 }
883 883
884 884
885 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg, 885 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 static const int num_arguments = 3; 1020 static const int num_arguments = 3;
1021 __ PrepareCallCFunction(num_arguments, scratch); 1021 __ PrepareCallCFunction(num_arguments, scratch);
1022 // RegExp code frame pointer. 1022 // RegExp code frame pointer.
1023 __ mov(Operand(esp, 2 * kPointerSize), ebp); 1023 __ mov(Operand(esp, 2 * kPointerSize), ebp);
1024 // Code* of self. 1024 // Code* of self.
1025 __ mov(Operand(esp, 1 * kPointerSize), Immediate(masm_->CodeObject())); 1025 __ mov(Operand(esp, 1 * kPointerSize), Immediate(masm_->CodeObject()));
1026 // Next address on the stack (will be address of return address). 1026 // Next address on the stack (will be address of return address).
1027 __ lea(eax, Operand(esp, -kPointerSize)); 1027 __ lea(eax, Operand(esp, -kPointerSize));
1028 __ mov(Operand(esp, 0 * kPointerSize), eax); 1028 __ mov(Operand(esp, 0 * kPointerSize), eax);
1029 ExternalReference check_stack_guard = 1029 ExternalReference check_stack_guard =
1030 ExternalReference::re_check_stack_guard_state(); 1030 ExternalReference::re_check_stack_guard_state(masm_->isolate());
1031 __ CallCFunction(check_stack_guard, num_arguments); 1031 __ CallCFunction(check_stack_guard, num_arguments);
1032 } 1032 }
1033 1033
1034 1034
1035 // Helper function for reading a value out of a stack frame. 1035 // Helper function for reading a value out of a stack frame.
1036 template <typename T> 1036 template <typename T>
1037 static T& frame_entry(Address re_frame, int frame_offset) { 1037 static T& frame_entry(Address re_frame, int frame_offset) {
1038 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); 1038 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
1039 } 1039 }
1040 1040
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 __ mov(target, Operand(backtrack_stackpointer(), 0)); 1194 __ mov(target, Operand(backtrack_stackpointer(), 0));
1195 // Notice: This updates flags, unlike normal Pop. 1195 // Notice: This updates flags, unlike normal Pop.
1196 __ add(Operand(backtrack_stackpointer()), Immediate(kPointerSize)); 1196 __ add(Operand(backtrack_stackpointer()), Immediate(kPointerSize));
1197 } 1197 }
1198 1198
1199 1199
1200 void RegExpMacroAssemblerIA32::CheckPreemption() { 1200 void RegExpMacroAssemblerIA32::CheckPreemption() {
1201 // Check for preemption. 1201 // Check for preemption.
1202 Label no_preempt; 1202 Label no_preempt;
1203 ExternalReference stack_limit = 1203 ExternalReference stack_limit =
1204 ExternalReference::address_of_stack_limit(); 1204 ExternalReference::address_of_stack_limit(masm_->isolate());
1205 __ cmp(esp, Operand::StaticVariable(stack_limit)); 1205 __ cmp(esp, Operand::StaticVariable(stack_limit));
1206 __ j(above, &no_preempt, taken); 1206 __ j(above, &no_preempt, taken);
1207 1207
1208 SafeCall(&check_preempt_label_); 1208 SafeCall(&check_preempt_label_);
1209 1209
1210 __ bind(&no_preempt); 1210 __ bind(&no_preempt);
1211 } 1211 }
1212 1212
1213 1213
1214 void RegExpMacroAssemblerIA32::CheckStackLimit() { 1214 void RegExpMacroAssemblerIA32::CheckStackLimit() {
1215 Label no_stack_overflow; 1215 Label no_stack_overflow;
1216 ExternalReference stack_limit = 1216 ExternalReference stack_limit =
1217 ExternalReference::address_of_regexp_stack_limit(); 1217 ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
1218 __ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit)); 1218 __ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit));
1219 __ j(above, &no_stack_overflow); 1219 __ j(above, &no_stack_overflow);
1220 1220
1221 SafeCall(&stack_overflow_label_); 1221 SafeCall(&stack_overflow_label_);
1222 1222
1223 __ bind(&no_stack_overflow); 1223 __ bind(&no_stack_overflow);
1224 } 1224 }
1225 1225
1226 1226
1227 void RegExpMacroAssemblerIA32::LoadCurrentCharacterUnchecked(int cp_offset, 1227 void RegExpMacroAssemblerIA32::LoadCurrentCharacterUnchecked(int cp_offset,
(...skipping 21 matching lines...) Expand all
1249 } 1249 }
1250 1250
1251 1251
1252 #undef __ 1252 #undef __
1253 1253
1254 #endif // V8_INTERPRETED_REGEXP 1254 #endif // V8_INTERPRETED_REGEXP
1255 1255
1256 }} // namespace v8::internal 1256 }} // namespace v8::internal
1257 1257
1258 #endif // V8_TARGET_ARCH_IA32 1258 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698