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

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

Issue 13244: Fixes to IA32 code generator to cope with new (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 __ sub(Operand(eax), Immediate(start)); 143 __ sub(Operand(eax), Immediate(start));
144 __ cmp(eax, 64); // FIXME: 64 = length_of_bitmap_in_bits. 144 __ cmp(eax, 64); // FIXME: 64 = length_of_bitmap_in_bits.
145 BranchOrBacktrack(greater_equal, on_zero); 145 BranchOrBacktrack(greater_equal, on_zero);
146 __ mov(ebx, eax); 146 __ mov(ebx, eax);
147 __ shr(ebx, 3); 147 __ shr(ebx, 3);
148 // TODO(lrn): Where is the bitmap stored? Pass the bitmap as argument instead. 148 // TODO(lrn): Where is the bitmap stored? Pass the bitmap as argument instead.
149 // __ mov(ecx, position_of_bitmap); 149 // __ mov(ecx, position_of_bitmap);
150 __ movzx_b(ebx, Operand(ecx, ebx, times_1, 0)); 150 __ movzx_b(ebx, Operand(ecx, ebx, times_1, 0));
151 __ and_(eax, (1<<3)-1); 151 __ and_(eax, (1<<3)-1);
152 __ bt(Operand(ebx), eax); 152 __ bt(Operand(ebx), eax);
153 __ j(carry, on_zero); 153 BranchOrBacktrack(carry, on_zero);
154 } 154 }
155 155
156 156
157 void RegExpMacroAssemblerIA32::CheckCharacter(uc16 c, Label* on_equal) { 157 void RegExpMacroAssemblerIA32::CheckCharacter(uc16 c, Label* on_equal) {
158 __ cmp(current_character(), c); 158 __ cmp(current_character(), c);
159 BranchOrBacktrack(equal, on_equal); 159 BranchOrBacktrack(equal, on_equal);
160 } 160 }
161 161
162 162
163 void RegExpMacroAssemblerIA32::CheckCharacterGT(uc16 limit, Label* on_greater) { 163 void RegExpMacroAssemblerIA32::CheckCharacterGT(uc16 limit, Label* on_greater) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (str.length() <= kMaxInlineStringTests) { 196 if (str.length() <= kMaxInlineStringTests) {
197 for (int i = 0; i < str.length(); i++) { 197 for (int i = 0; i < str.length(); i++) {
198 if (mode_ == ASCII) { 198 if (mode_ == ASCII) {
199 __ cmpb(Operand(esi, edi, times_1, byte_offset + i), 199 __ cmpb(Operand(esi, edi, times_1, byte_offset + i),
200 static_cast<int8_t>(str[i])); 200 static_cast<int8_t>(str[i]));
201 } else { 201 } else {
202 ASSERT(mode_ == UC16); 202 ASSERT(mode_ == UC16);
203 __ cmpw(Operand(esi, edi, times_1, byte_offset + i * sizeof(uc16)), 203 __ cmpw(Operand(esi, edi, times_1, byte_offset + i * sizeof(uc16)),
204 Immediate(str[i])); 204 Immediate(str[i]));
205 } 205 }
206 __ j(not_equal, on_failure); 206 BranchOrBacktrack(not_equal, on_failure);
207 } 207 }
208 return; 208 return;
209 } 209 }
210 210
211 ArraySlice constant_buffer = constants_.GetBuffer(str.length(), char_size()); 211 ArraySlice constant_buffer = constants_.GetBuffer(str.length(), char_size());
212 if (mode_ == ASCII) { 212 if (mode_ == ASCII) {
213 for (int i = 0; i < str.length(); i++) { 213 for (int i = 0; i < str.length(); i++) {
214 constant_buffer.at<char>(i) = static_cast<char>(str[i]); 214 constant_buffer.at<char>(i) = static_cast<char>(str[i]);
215 } 215 }
216 } else { 216 } else {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 Handle<Code> code = Factory::NewCode(code_desc, 567 Handle<Code> code = Factory::NewCode(code_desc,
568 NULL, 568 NULL,
569 Code::ComputeFlags(Code::REGEXP), 569 Code::ComputeFlags(Code::REGEXP),
570 self_); 570 self_);
571 LOG(CodeCreateEvent("RegExp", *code, *(source->ToCString()))); 571 LOG(CodeCreateEvent("RegExp", *code, *(source->ToCString())));
572 return Handle<Object>::cast(code); 572 return Handle<Object>::cast(code);
573 } 573 }
574 574
575 575
576 void RegExpMacroAssemblerIA32::GoTo(Label* to) { 576 void RegExpMacroAssemblerIA32::GoTo(Label* to) {
577 __ jmp(to); 577 BranchOrBacktrack(no_condition, to);
578 } 578 }
579 579
580 580
581 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg, 581 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg,
582 int comparand, 582 int comparand,
583 Label* if_ge) { 583 Label* if_ge) {
584 __ cmp(register_location(reg), Immediate(comparand)); 584 __ cmp(register_location(reg), Immediate(comparand));
585 BranchOrBacktrack(greater_equal, if_ge); 585 BranchOrBacktrack(greater_equal, if_ge);
586 } 586 }
587 587
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 void RegExpMacroAssemblerIA32::Succeed() { 655 void RegExpMacroAssemblerIA32::Succeed() {
656 __ jmp(&success_label_); 656 __ jmp(&success_label_);
657 } 657 }
658 658
659 659
660 void RegExpMacroAssemblerIA32::WriteCurrentPositionToRegister(int reg, 660 void RegExpMacroAssemblerIA32::WriteCurrentPositionToRegister(int reg,
661 int cp_offset) { 661 int cp_offset) {
662 if (cp_offset == 0) { 662 if (cp_offset == 0) {
663 __ mov(register_location(reg), edi); 663 __ mov(register_location(reg), edi);
664 } else { 664 } else {
665 __ lea(eax, Operand(edi, cp_offset)); 665 if (mode_ == ASCII) {
666 __ lea(eax, Operand(edi, cp_offset));
Lasse Reichstein 2008/12/08 10:25:44 You can use char_size() to generalize code that on
667 } else {
668 ASSERT(mode_ == UC16);
669 __ lea(eax, Operand(edi, 2 * cp_offset));
670 }
666 __ mov(register_location(reg), eax); 671 __ mov(register_location(reg), eax);
667 } 672 }
668 } 673 }
669 674
670 675
671 void RegExpMacroAssemblerIA32::WriteStackPointerToRegister(int reg) { 676 void RegExpMacroAssemblerIA32::WriteStackPointerToRegister(int reg) {
672 __ mov(register_location(reg), esp); 677 __ mov(register_location(reg), esp);
673 } 678 }
674 679
675 680
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 800
796 801
797 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 802 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
798 ArraySlice* buffer) { 803 ArraySlice* buffer) {
799 __ mov(reg, buffer->array()); 804 __ mov(reg, buffer->array());
800 __ add(Operand(reg), Immediate(buffer->base_offset())); 805 __ add(Operand(reg), Immediate(buffer->base_offset()));
801 } 806 }
802 807
803 #undef __ 808 #undef __
804 }} // namespace v8::internal 809 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698