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

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

Issue 14885: Irregexp-ia32: Don't inline conditional backtracks. (Closed)
Patch Set: Created 12 years 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/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 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 Mode mode, 86 Mode mode,
87 int registers_to_save) 87 int registers_to_save)
88 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)), 88 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
89 constants_(kRegExpConstantsSize), 89 constants_(kRegExpConstantsSize),
90 mode_(mode), 90 mode_(mode),
91 num_registers_(registers_to_save), 91 num_registers_(registers_to_save),
92 num_saved_registers_(registers_to_save), 92 num_saved_registers_(registers_to_save),
93 entry_label_(), 93 entry_label_(),
94 start_label_(), 94 start_label_(),
95 success_label_(), 95 success_label_(),
96 backtrack_label_(),
96 exit_label_(), 97 exit_label_(),
97 self_(Heap::undefined_value()) { 98 self_(Heap::undefined_value()) {
98 __ jmp(&entry_label_); // We'll write the entry code later. 99 __ jmp(&entry_label_); // We'll write the entry code later.
99 __ bind(&start_label_); // And then continue from here. 100 __ bind(&start_label_); // And then continue from here.
100 } 101 }
101 102
102 103
103 RegExpMacroAssemblerIA32::~RegExpMacroAssemblerIA32() { 104 RegExpMacroAssemblerIA32::~RegExpMacroAssemblerIA32() {
104 delete masm_; 105 delete masm_;
105 // Unuse labels in case we throw away the assembler without calling GetCode. 106 // Unuse labels in case we throw away the assembler without calling GetCode.
106 entry_label_.Unuse(); 107 entry_label_.Unuse();
107 start_label_.Unuse(); 108 start_label_.Unuse();
108 success_label_.Unuse(); 109 success_label_.Unuse();
110 backtrack_label_.Unuse();
109 exit_label_.Unuse(); 111 exit_label_.Unuse();
110 check_preempt_label_.Unuse(); 112 check_preempt_label_.Unuse();
111 } 113 }
112 114
113 115
114 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { 116 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) {
115 if (by != 0) { 117 if (by != 0) {
116 Label inside_string; 118 Label inside_string;
117 __ add(Operand(edi), Immediate(by * char_size())); 119 __ add(Operand(edi), Immediate(by * char_size()));
118 } 120 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 __ mov(eax, Immediate(1)); 546 __ mov(eax, Immediate(1));
545 } 547 }
546 // Exit and return eax 548 // Exit and return eax
547 __ bind(&exit_label_); 549 __ bind(&exit_label_);
548 __ leave(); 550 __ leave();
549 __ pop(ebx); 551 __ pop(ebx);
550 __ pop(edi); 552 __ pop(edi);
551 __ pop(esi); 553 __ pop(esi);
552 __ ret(0); 554 __ ret(0);
553 555
556 // Backtrack code (branch target for conditional backtracks).
557 if (backtrack_label_.is_linked()) {
558 __ bind(&backtrack_label_);
559 Backtrack();
560 }
561
554 // Preempt-code 562 // Preempt-code
555 if (check_preempt_label_.is_linked()) { 563 if (check_preempt_label_.is_linked()) {
556 __ bind(&check_preempt_label_); 564 __ bind(&check_preempt_label_);
557 // TODO(lrn): call C function to check the stack guard and return current 565 // TODO(lrn): call C function to check the stack guard and return current
558 // stack state (0 = ok, positive = out of stack, negative = preempt). 566 // stack state (0 = ok, positive = out of stack, negative = preempt).
559 // Then dispatch to an action depending on state, and loop. 567 // Then dispatch to an action depending on state, and loop.
560 __ push(edi); 568 __ push(edi);
561 569
562 Label retry; 570 Label retry;
563 Label stack_overflow; 571 Label stack_overflow;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 Label* to) { 802 Label* to) {
795 if (condition < 0) { // No condition 803 if (condition < 0) { // No condition
796 if (to == NULL) { 804 if (to == NULL) {
797 Backtrack(); 805 Backtrack();
798 return; 806 return;
799 } 807 }
800 __ jmp(to); 808 __ jmp(to);
801 return; 809 return;
802 } 810 }
803 if (to == NULL) { 811 if (to == NULL) {
804 Label skip; 812 __ j(condition, &backtrack_label_);
805 __ j(NegateCondition(condition), &skip);
806 Backtrack();
807 __ bind(&skip);
808 return; 813 return;
809 } 814 }
810 __ j(condition, to); 815 __ j(condition, to);
811 } 816 }
812 817
813 818
814 void RegExpMacroAssemblerIA32::SafeCall(Label* to) { 819 void RegExpMacroAssemblerIA32::SafeCall(Label* to) {
815 Label return_to; 820 Label return_to;
816 __ push(Immediate::CodeRelativeOffset(&return_to)); 821 __ push(Immediate::CodeRelativeOffset(&return_to));
817 __ jmp(to); 822 __ jmp(to);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 888
884 889
885 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 890 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
886 ArraySlice* buffer) { 891 ArraySlice* buffer) {
887 __ mov(reg, buffer->array()); 892 __ mov(reg, buffer->array());
888 __ add(Operand(reg), Immediate(buffer->base_offset())); 893 __ add(Operand(reg), Immediate(buffer->base_offset()));
889 } 894 }
890 895
891 #undef __ 896 #undef __
892 }} // namespace v8::internal 897 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp-macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698