| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } else { | 395 } else { |
| 396 ASSERT(mode_ == UC16); | 396 ASSERT(mode_ == UC16); |
| 397 // Save important/volatile registers before calling C function. | 397 // Save important/volatile registers before calling C function. |
| 398 #ifndef _WIN64 | 398 #ifndef _WIN64 |
| 399 // Caller save on Linux and callee save in Windows. | 399 // Caller save on Linux and callee save in Windows. |
| 400 __ push(rsi); | 400 __ push(rsi); |
| 401 __ push(rdi); | 401 __ push(rdi); |
| 402 #endif | 402 #endif |
| 403 __ push(backtrack_stackpointer()); | 403 __ push(backtrack_stackpointer()); |
| 404 | 404 |
| 405 static const int num_arguments = 3; | 405 static const int num_arguments = 4; |
| 406 __ PrepareCallCFunction(num_arguments); | 406 __ PrepareCallCFunction(num_arguments); |
| 407 | 407 |
| 408 // Put arguments into parameter registers. Parameters are | 408 // Put arguments into parameter registers. Parameters are |
| 409 // Address byte_offset1 - Address captured substring's start. | 409 // Address byte_offset1 - Address captured substring's start. |
| 410 // Address byte_offset2 - Address of current character position. | 410 // Address byte_offset2 - Address of current character position. |
| 411 // size_t byte_length - length of capture in bytes(!) | 411 // size_t byte_length - length of capture in bytes(!) |
| 412 // Isolate* isolate |
| 412 #ifdef _WIN64 | 413 #ifdef _WIN64 |
| 413 // Compute and set byte_offset1 (start of capture). | 414 // Compute and set byte_offset1 (start of capture). |
| 414 __ lea(rcx, Operand(rsi, rdx, times_1, 0)); | 415 __ lea(rcx, Operand(rsi, rdx, times_1, 0)); |
| 415 // Set byte_offset2. | 416 // Set byte_offset2. |
| 416 __ lea(rdx, Operand(rsi, rdi, times_1, 0)); | 417 __ lea(rdx, Operand(rsi, rdi, times_1, 0)); |
| 417 // Set byte_length. | 418 // Set byte_length. |
| 418 __ movq(r8, rbx); | 419 __ movq(r8, rbx); |
| 420 // Isolate. |
| 421 __ LoadAddress(r9, ExternalReference::isolate_address()); |
| 419 #else // AMD64 calling convention | 422 #else // AMD64 calling convention |
| 420 // Compute byte_offset2 (current position = rsi+rdi). | 423 // Compute byte_offset2 (current position = rsi+rdi). |
| 421 __ lea(rax, Operand(rsi, rdi, times_1, 0)); | 424 __ lea(rax, Operand(rsi, rdi, times_1, 0)); |
| 422 // Compute and set byte_offset1 (start of capture). | 425 // Compute and set byte_offset1 (start of capture). |
| 423 __ lea(rdi, Operand(rsi, rdx, times_1, 0)); | 426 __ lea(rdi, Operand(rsi, rdx, times_1, 0)); |
| 424 // Set byte_offset2. | 427 // Set byte_offset2. |
| 425 __ movq(rsi, rax); | 428 __ movq(rsi, rax); |
| 426 // Set byte_length. | 429 // Set byte_length. |
| 427 __ movq(rdx, rbx); | 430 __ movq(rdx, rbx); |
| 431 // Isolate. |
| 432 __ LoadAddress(rcx, ExternalReference::isolate_address()); |
| 428 #endif | 433 #endif |
| 429 ExternalReference compare = | 434 ExternalReference compare = |
| 430 ExternalReference::re_case_insensitive_compare_uc16(masm_.isolate()); | 435 ExternalReference::re_case_insensitive_compare_uc16(masm_.isolate()); |
| 431 __ CallCFunction(compare, num_arguments); | 436 __ CallCFunction(compare, num_arguments); |
| 432 | 437 |
| 433 // Restore original values before reacting on result value. | 438 // Restore original values before reacting on result value. |
| 434 __ Move(code_object_pointer(), masm_.CodeObject()); | 439 __ Move(code_object_pointer(), masm_.CodeObject()); |
| 435 __ pop(backtrack_stackpointer()); | 440 __ pop(backtrack_stackpointer()); |
| 436 #ifndef _WIN64 | 441 #ifndef _WIN64 |
| 437 __ pop(rdi); | 442 __ pop(rdi); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 917 |
| 913 Label grow_failed; | 918 Label grow_failed; |
| 914 // Save registers before calling C function | 919 // Save registers before calling C function |
| 915 #ifndef _WIN64 | 920 #ifndef _WIN64 |
| 916 // Callee-save in Microsoft 64-bit ABI, but not in AMD64 ABI. | 921 // Callee-save in Microsoft 64-bit ABI, but not in AMD64 ABI. |
| 917 __ push(rsi); | 922 __ push(rsi); |
| 918 __ push(rdi); | 923 __ push(rdi); |
| 919 #endif | 924 #endif |
| 920 | 925 |
| 921 // Call GrowStack(backtrack_stackpointer()) | 926 // Call GrowStack(backtrack_stackpointer()) |
| 922 static const int num_arguments = 2; | 927 static const int num_arguments = 3; |
| 923 __ PrepareCallCFunction(num_arguments); | 928 __ PrepareCallCFunction(num_arguments); |
| 924 #ifdef _WIN64 | 929 #ifdef _WIN64 |
| 925 // Microsoft passes parameters in rcx, rdx. | 930 // Microsoft passes parameters in rcx, rdx, r8. |
| 926 // First argument, backtrack stackpointer, is already in rcx. | 931 // First argument, backtrack stackpointer, is already in rcx. |
| 927 __ lea(rdx, Operand(rbp, kStackHighEnd)); // Second argument | 932 __ lea(rdx, Operand(rbp, kStackHighEnd)); // Second argument |
| 933 __ LoadAddress(r8, ExternalReference::isolate_address()); |
| 928 #else | 934 #else |
| 929 // AMD64 ABI passes parameters in rdi, rsi. | 935 // AMD64 ABI passes parameters in rdi, rsi, rdx. |
| 930 __ movq(rdi, backtrack_stackpointer()); // First argument. | 936 __ movq(rdi, backtrack_stackpointer()); // First argument. |
| 931 __ lea(rsi, Operand(rbp, kStackHighEnd)); // Second argument. | 937 __ lea(rsi, Operand(rbp, kStackHighEnd)); // Second argument. |
| 938 __ LoadAddress(rdx, ExternalReference::isolate_address()); |
| 932 #endif | 939 #endif |
| 933 ExternalReference grow_stack = | 940 ExternalReference grow_stack = |
| 934 ExternalReference::re_grow_stack(masm_.isolate()); | 941 ExternalReference::re_grow_stack(masm_.isolate()); |
| 935 __ CallCFunction(grow_stack, num_arguments); | 942 __ CallCFunction(grow_stack, num_arguments); |
| 936 // If return NULL, we have failed to grow the stack, and | 943 // If return NULL, we have failed to grow the stack, and |
| 937 // must exit with a stack-overflow exception. | 944 // must exit with a stack-overflow exception. |
| 938 __ testq(rax, rax); | 945 __ testq(rax, rax); |
| 939 __ j(equal, &exit_with_exception); | 946 __ j(equal, &exit_with_exception); |
| 940 // Otherwise use return value as new stack pointer. | 947 // Otherwise use return value as new stack pointer. |
| 941 __ movq(backtrack_stackpointer(), rax); | 948 __ movq(backtrack_stackpointer(), rax); |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 } | 1389 } |
| 1383 } | 1390 } |
| 1384 | 1391 |
| 1385 #undef __ | 1392 #undef __ |
| 1386 | 1393 |
| 1387 #endif // V8_INTERPRETED_REGEXP | 1394 #endif // V8_INTERPRETED_REGEXP |
| 1388 | 1395 |
| 1389 }} // namespace v8::internal | 1396 }} // namespace v8::internal |
| 1390 | 1397 |
| 1391 #endif // V8_TARGET_ARCH_X64 | 1398 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |