| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 | 218 |
| 219 void RegExpMacroAssemblerX64::CheckCharacters(Vector<const uc16> str, | 219 void RegExpMacroAssemblerX64::CheckCharacters(Vector<const uc16> str, |
| 220 int cp_offset, | 220 int cp_offset, |
| 221 Label* on_failure, | 221 Label* on_failure, |
| 222 bool check_end_of_string) { | 222 bool check_end_of_string) { |
| 223 #ifdef DEBUG | 223 #ifdef DEBUG |
| 224 // If input is ASCII, don't even bother calling here if the string to | 224 // If input is ASCII, don't even bother calling here if the string to |
| 225 // match contains a non-ascii character. | 225 // match contains a non-ascii character. |
| 226 if (mode_ == ASCII) { | 226 if (mode_ == ASCII) { |
| 227 for (int i = 0; i < str.length(); i++) { | 227 ASSERT(String::IsAscii(str.start(), str.length())); |
| 228 ASSERT(str[i] <= String::kMaxAsciiCharCodeU); | |
| 229 } | |
| 230 } | 228 } |
| 231 #endif | 229 #endif |
| 232 int byte_length = str.length() * char_size(); | 230 int byte_length = str.length() * char_size(); |
| 233 int byte_offset = cp_offset * char_size(); | 231 int byte_offset = cp_offset * char_size(); |
| 234 if (check_end_of_string) { | 232 if (check_end_of_string) { |
| 235 // Check that there are at least str.length() characters left in the input. | 233 // Check that there are at least str.length() characters left in the input. |
| 236 __ cmpl(rdi, Immediate(-(byte_offset + byte_length))); | 234 __ cmpl(rdi, Immediate(-(byte_offset + byte_length))); |
| 237 BranchOrBacktrack(greater, on_failure); | 235 BranchOrBacktrack(greater, on_failure); |
| 238 } | 236 } |
| 239 | 237 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 return true; | 682 return true; |
| 685 // No custom implementation (yet): s(UC16), S(UC16). | 683 // No custom implementation (yet): s(UC16), S(UC16). |
| 686 default: | 684 default: |
| 687 return false; | 685 return false; |
| 688 } | 686 } |
| 689 } | 687 } |
| 690 | 688 |
| 691 | 689 |
| 692 void RegExpMacroAssemblerX64::Fail() { | 690 void RegExpMacroAssemblerX64::Fail() { |
| 693 ASSERT(FAILURE == 0); // Return value for failure is zero. | 691 ASSERT(FAILURE == 0); // Return value for failure is zero. |
| 694 __ xor_(rax, rax); // zero rax. | 692 __ Set(rax, 0); |
| 695 __ jmp(&exit_label_); | 693 __ jmp(&exit_label_); |
| 696 } | 694 } |
| 697 | 695 |
| 698 | 696 |
| 699 Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { | 697 Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { |
| 700 // Finalize code - write the entry point code now we know how many | 698 // Finalize code - write the entry point code now we know how many |
| 701 // registers we need. | 699 // registers we need. |
| 702 // Entry code: | 700 // Entry code: |
| 703 __ bind(&entry_label_); | 701 __ bind(&entry_label_); |
| 704 // Start new stack frame. | 702 // Start new stack frame. |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 } | 1376 } |
| 1379 } | 1377 } |
| 1380 | 1378 |
| 1381 #undef __ | 1379 #undef __ |
| 1382 | 1380 |
| 1383 #endif // V8_INTERPRETED_REGEXP | 1381 #endif // V8_INTERPRETED_REGEXP |
| 1384 | 1382 |
| 1385 }} // namespace v8::internal | 1383 }} // namespace v8::internal |
| 1386 | 1384 |
| 1387 #endif // V8_TARGET_ARCH_X64 | 1385 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |