OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 // Mismatch, try case-insensitive match (converting letters to lower-case). | 387 // Mismatch, try case-insensitive match (converting letters to lower-case). |
388 // I.e., if or-ing with 0x20 makes values equal and in range 'a'-'z', it's | 388 // I.e., if or-ing with 0x20 makes values equal and in range 'a'-'z', it's |
389 // a match. | 389 // a match. |
390 __ or_(rax, Immediate(0x20)); // Convert match character to lower-case. | 390 __ or_(rax, Immediate(0x20)); // Convert match character to lower-case. |
391 __ or_(rdx, Immediate(0x20)); // Convert capture character to lower-case. | 391 __ or_(rdx, Immediate(0x20)); // Convert capture character to lower-case. |
392 __ cmpb(rax, rdx); | 392 __ cmpb(rax, rdx); |
393 __ j(not_equal, on_no_match); // Definitely not equal. | 393 __ j(not_equal, on_no_match); // Definitely not equal. |
394 __ subb(rax, Immediate('a')); | 394 __ subb(rax, Immediate('a')); |
395 __ cmpb(rax, Immediate('z' - 'a')); | 395 __ cmpb(rax, Immediate('z' - 'a')); |
396 #ifndef ENABLE_LATIN_1 | |
397 __ j(above, on_no_match); // Weren't letters anyway. | |
398 #else | |
399 __ j(below_equal, &loop_increment); // In range 'a'-'z'. | 396 __ j(below_equal, &loop_increment); // In range 'a'-'z'. |
400 // Latin-1: Check for values in range [224,254] but not 247. | 397 // Latin-1: Check for values in range [224,254] but not 247. |
401 __ subb(rax, Immediate(224 - 'a')); | 398 __ subb(rax, Immediate(224 - 'a')); |
402 __ cmpb(rax, Immediate(254 - 224)); | 399 __ cmpb(rax, Immediate(254 - 224)); |
403 __ j(above, on_no_match); // Weren't Latin-1 letters. | 400 __ j(above, on_no_match); // Weren't Latin-1 letters. |
404 __ cmpb(rax, Immediate(247 - 224)); // Check for 247. | 401 __ cmpb(rax, Immediate(247 - 224)); // Check for 247. |
405 __ j(equal, on_no_match); | 402 __ j(equal, on_no_match); |
406 #endif | |
407 __ bind(&loop_increment); | 403 __ bind(&loop_increment); |
408 // Increment pointers into match and capture strings. | 404 // Increment pointers into match and capture strings. |
409 __ addq(r11, Immediate(1)); | 405 __ addq(r11, Immediate(1)); |
410 __ addq(r9, Immediate(1)); | 406 __ addq(r9, Immediate(1)); |
411 // Compare to end of capture, and loop if not done. | 407 // Compare to end of capture, and loop if not done. |
412 __ cmpq(r9, rbx); | 408 __ cmpq(r9, rbx); |
413 __ j(below, &loop); | 409 __ j(below, &loop); |
414 | 410 |
415 // Compute new value of character position after the matched part. | 411 // Compute new value of character position after the matched part. |
416 __ movq(rdi, r11); | 412 __ movq(rdi, r11); |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1534 } |
1539 } | 1535 } |
1540 | 1536 |
1541 #undef __ | 1537 #undef __ |
1542 | 1538 |
1543 #endif // V8_INTERPRETED_REGEXP | 1539 #endif // V8_INTERPRETED_REGEXP |
1544 | 1540 |
1545 }} // namespace v8::internal | 1541 }} // namespace v8::internal |
1546 | 1542 |
1547 #endif // V8_TARGET_ARCH_X64 | 1543 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |