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

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

Issue 164053: Irregexp-ia32 internal call strategy changed. (Closed)
Patch Set: Created 11 years, 4 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
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.h ('k') | 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 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // Backtrack code (branch target for conditional backtracks). 745 // Backtrack code (branch target for conditional backtracks).
746 if (backtrack_label_.is_linked()) { 746 if (backtrack_label_.is_linked()) {
747 __ bind(&backtrack_label_); 747 __ bind(&backtrack_label_);
748 Backtrack(); 748 Backtrack();
749 } 749 }
750 750
751 Label exit_with_exception; 751 Label exit_with_exception;
752 752
753 // Preempt-code 753 // Preempt-code
754 if (check_preempt_label_.is_linked()) { 754 if (check_preempt_label_.is_linked()) {
755 __ bind(&check_preempt_label_); 755 SafeCallTarget(&check_preempt_label_);
756 756
757 __ push(backtrack_stackpointer()); 757 __ push(backtrack_stackpointer());
758 __ push(edi); 758 __ push(edi);
759 759
760 CallCheckStackGuardState(ebx); 760 CallCheckStackGuardState(ebx);
761 __ or_(eax, Operand(eax)); 761 __ or_(eax, Operand(eax));
762 // If returning non-zero, we should end execution with the given 762 // If returning non-zero, we should end execution with the given
763 // result as return value. 763 // result as return value.
764 __ j(not_zero, &exit_label_); 764 __ j(not_zero, &exit_label_);
765 765
766 __ pop(edi); 766 __ pop(edi);
767 __ pop(backtrack_stackpointer()); 767 __ pop(backtrack_stackpointer());
768 // String might have moved: Reload esi from frame. 768 // String might have moved: Reload esi from frame.
769 __ mov(esi, Operand(ebp, kInputEnd)); 769 __ mov(esi, Operand(ebp, kInputEnd));
770 SafeReturn(); 770 SafeReturn();
771 } 771 }
772 772
773 // Backtrack stack overflow code. 773 // Backtrack stack overflow code.
774 if (stack_overflow_label_.is_linked()) { 774 if (stack_overflow_label_.is_linked()) {
775 __ bind(&stack_overflow_label_); 775 SafeCallTarget(&stack_overflow_label_);
776 // Reached if the backtrack-stack limit has been hit. 776 // Reached if the backtrack-stack limit has been hit.
777 777
778 Label grow_failed; 778 Label grow_failed;
779 // Save registers before calling C function 779 // Save registers before calling C function
780 __ push(esi); 780 __ push(esi);
781 __ push(edi); 781 __ push(edi);
782 782
783 // Call GrowStack(backtrack_stackpointer()) 783 // Call GrowStack(backtrack_stackpointer())
784 int num_arguments = 2; 784 int num_arguments = 2;
785 FrameAlign(num_arguments, ebx); 785 FrameAlign(num_arguments, ebx);
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } 1242 }
1243 if (to == NULL) { 1243 if (to == NULL) {
1244 __ j(condition, &backtrack_label_, hint); 1244 __ j(condition, &backtrack_label_, hint);
1245 return; 1245 return;
1246 } 1246 }
1247 __ j(condition, to, hint); 1247 __ j(condition, to, hint);
1248 } 1248 }
1249 1249
1250 1250
1251 void RegExpMacroAssemblerIA32::SafeCall(Label* to) { 1251 void RegExpMacroAssemblerIA32::SafeCall(Label* to) {
1252 Label return_to; 1252 __ call(to);
1253 __ push(Immediate::CodeRelativeOffset(&return_to));
1254 __ jmp(to);
1255 __ bind(&return_to);
1256 } 1253 }
1257 1254
1258 1255
1259 void RegExpMacroAssemblerIA32::SafeReturn() { 1256 void RegExpMacroAssemblerIA32::SafeReturn() {
1260 __ pop(ebx); 1257 __ add(Operand(esp,0), Immediate(masm_->CodeObject()));
1261 __ add(Operand(ebx), Immediate(masm_->CodeObject())); 1258 __ ret(0);
1262 __ jmp(Operand(ebx));
1263 } 1259 }
1264 1260
1265 1261
1262 void RegExpMacroAssemblerIA32::SafeCallTarget(Label* name) {
1263 __ bind(name);
1264 __ sub(Operand(esp, 0), Immediate(masm_->CodeObject()));
1265 }
1266
1267
1266 void RegExpMacroAssemblerIA32::Push(Register source) { 1268 void RegExpMacroAssemblerIA32::Push(Register source) {
1267 ASSERT(!source.is(backtrack_stackpointer())); 1269 ASSERT(!source.is(backtrack_stackpointer()));
1268 // Notice: This updates flags, unlike normal Push. 1270 // Notice: This updates flags, unlike normal Push.
1269 __ sub(Operand(backtrack_stackpointer()), Immediate(kPointerSize)); 1271 __ sub(Operand(backtrack_stackpointer()), Immediate(kPointerSize));
1270 __ mov(Operand(backtrack_stackpointer(), 0), source); 1272 __ mov(Operand(backtrack_stackpointer(), 0), source);
1271 } 1273 }
1272 1274
1273 1275
1274 void RegExpMacroAssemblerIA32::Push(Immediate value) { 1276 void RegExpMacroAssemblerIA32::Push(Immediate value) {
1275 // Notice: This updates flags, unlike normal Push. 1277 // Notice: This updates flags, unlike normal Push.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1374
1373 1375
1374 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 1376 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
1375 ArraySlice* buffer) { 1377 ArraySlice* buffer) {
1376 __ mov(reg, buffer->array()); 1378 __ mov(reg, buffer->array());
1377 __ add(Operand(reg), Immediate(buffer->base_offset())); 1379 __ add(Operand(reg), Immediate(buffer->base_offset()));
1378 } 1380 }
1379 1381
1380 #undef __ 1382 #undef __
1381 }} // namespace v8::internal 1383 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698