| OLD | NEW |
| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 | 206 |
| 207 void RegExpMacroAssemblerIA32::CheckCharacters(Vector<const uc16> str, | 207 void RegExpMacroAssemblerIA32::CheckCharacters(Vector<const uc16> str, |
| 208 int cp_offset, | 208 int cp_offset, |
| 209 Label* on_failure, | 209 Label* on_failure, |
| 210 bool check_end_of_string) { | 210 bool check_end_of_string) { |
| 211 #ifdef DEBUG | 211 #ifdef DEBUG |
| 212 // If input is ASCII, don't even bother calling here if the string to | 212 // If input is ASCII, don't even bother calling here if the string to |
| 213 // match contains a non-ascii character. | 213 // match contains a non-ascii character. |
| 214 if (mode_ == ASCII) { | 214 if (mode_ == ASCII) { |
| 215 for (int i = 0; i < str.length(); i++) { | 215 ASSERT(String::IsAscii(str.start(), str.length())); |
| 216 ASSERT(str[i] <= String::kMaxAsciiCharCodeU); | |
| 217 } | |
| 218 } | 216 } |
| 219 #endif | 217 #endif |
| 220 int byte_length = str.length() * char_size(); | 218 int byte_length = str.length() * char_size(); |
| 221 int byte_offset = cp_offset * char_size(); | 219 int byte_offset = cp_offset * char_size(); |
| 222 if (check_end_of_string) { | 220 if (check_end_of_string) { |
| 223 // Check that there are at least str.length() characters left in the input. | 221 // Check that there are at least str.length() characters left in the input. |
| 224 __ cmp(Operand(edi), Immediate(-(byte_offset + byte_length))); | 222 __ cmp(Operand(edi), Immediate(-(byte_offset + byte_length))); |
| 225 BranchOrBacktrack(greater, on_failure); | 223 BranchOrBacktrack(greater, on_failure); |
| 226 } | 224 } |
| 227 | 225 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } | 646 } |
| 649 // No custom implementation (yet): s(UC16), S(UC16). | 647 // No custom implementation (yet): s(UC16), S(UC16). |
| 650 default: | 648 default: |
| 651 return false; | 649 return false; |
| 652 } | 650 } |
| 653 } | 651 } |
| 654 | 652 |
| 655 | 653 |
| 656 void RegExpMacroAssemblerIA32::Fail() { | 654 void RegExpMacroAssemblerIA32::Fail() { |
| 657 ASSERT(FAILURE == 0); // Return value for failure is zero. | 655 ASSERT(FAILURE == 0); // Return value for failure is zero. |
| 658 __ xor_(eax, Operand(eax)); // zero eax. | 656 __ Set(eax, Immediate(0)); |
| 659 __ jmp(&exit_label_); | 657 __ jmp(&exit_label_); |
| 660 } | 658 } |
| 661 | 659 |
| 662 | 660 |
| 663 Handle<Object> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { | 661 Handle<Object> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { |
| 664 // Finalize code - write the entry point code now we know how many | 662 // Finalize code - write the entry point code now we know how many |
| 665 // registers we need. | 663 // registers we need. |
| 666 | 664 |
| 667 // Entry code: | 665 // Entry code: |
| 668 __ bind(&entry_label_); | 666 __ bind(&entry_label_); |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 } | 1247 } |
| 1250 | 1248 |
| 1251 | 1249 |
| 1252 #undef __ | 1250 #undef __ |
| 1253 | 1251 |
| 1254 #endif // V8_INTERPRETED_REGEXP | 1252 #endif // V8_INTERPRETED_REGEXP |
| 1255 | 1253 |
| 1256 }} // namespace v8::internal | 1254 }} // namespace v8::internal |
| 1257 | 1255 |
| 1258 #endif // V8_TARGET_ARCH_IA32 | 1256 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |