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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // Compute byte_offset2 (current position = rsi+rdi). | 416 // Compute byte_offset2 (current position = rsi+rdi). |
417 __ lea(rax, Operand(rsi, rdi, times_1, 0)); | 417 __ lea(rax, Operand(rsi, rdi, times_1, 0)); |
418 // Compute and set byte_offset1 (start of capture). | 418 // Compute and set byte_offset1 (start of capture). |
419 __ lea(rdi, Operand(rsi, rdx, times_1, 0)); | 419 __ lea(rdi, Operand(rsi, rdx, times_1, 0)); |
420 // Set byte_offset2. | 420 // Set byte_offset2. |
421 __ movq(rsi, rax); | 421 __ movq(rsi, rax); |
422 // Set byte_length. | 422 // Set byte_length. |
423 __ movq(rdx, rbx); | 423 __ movq(rdx, rbx); |
424 #endif | 424 #endif |
425 ExternalReference compare = | 425 ExternalReference compare = |
426 ExternalReference::re_case_insensitive_compare_uc16(); | 426 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); |
427 __ CallCFunction(compare, num_arguments); | 427 __ CallCFunction(compare, num_arguments); |
428 | 428 |
429 // Restore original values before reacting on result value. | 429 // Restore original values before reacting on result value. |
430 __ Move(code_object_pointer(), masm_->CodeObject()); | 430 __ Move(code_object_pointer(), masm_->CodeObject()); |
431 __ pop(backtrack_stackpointer()); | 431 __ pop(backtrack_stackpointer()); |
432 #ifndef _WIN64 | 432 #ifndef _WIN64 |
433 __ pop(rdi); | 433 __ pop(rdi); |
434 __ pop(rsi); | 434 __ pop(rsi); |
435 #endif | 435 #endif |
436 | 436 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 __ push(rbx); // Callee-save | 734 __ push(rbx); // Callee-save |
735 #endif | 735 #endif |
736 | 736 |
737 __ push(Immediate(0)); // Make room for "at start" constant. | 737 __ push(Immediate(0)); // Make room for "at start" constant. |
738 | 738 |
739 // Check if we have space on the stack for registers. | 739 // Check if we have space on the stack for registers. |
740 Label stack_limit_hit; | 740 Label stack_limit_hit; |
741 Label stack_ok; | 741 Label stack_ok; |
742 | 742 |
743 ExternalReference stack_limit = | 743 ExternalReference stack_limit = |
744 ExternalReference::address_of_stack_limit(); | 744 ExternalReference::address_of_stack_limit(masm_->isolate()); |
745 __ movq(rcx, rsp); | 745 __ movq(rcx, rsp); |
746 __ movq(kScratchRegister, stack_limit); | 746 __ movq(kScratchRegister, stack_limit); |
747 __ subq(rcx, Operand(kScratchRegister, 0)); | 747 __ subq(rcx, Operand(kScratchRegister, 0)); |
748 // Handle it if the stack pointer is already below the stack limit. | 748 // Handle it if the stack pointer is already below the stack limit. |
749 __ j(below_equal, &stack_limit_hit); | 749 __ j(below_equal, &stack_limit_hit); |
750 // Check if there is room for the variable number of registers above | 750 // Check if there is room for the variable number of registers above |
751 // the stack limit. | 751 // the stack limit. |
752 __ cmpq(rcx, Immediate(num_registers_ * kPointerSize)); | 752 __ cmpq(rcx, Immediate(num_registers_ * kPointerSize)); |
753 __ j(above_equal, &stack_ok); | 753 __ j(above_equal, &stack_ok); |
754 // Exit with OutOfMemory exception. There is not enough space on the stack | 754 // Exit with OutOfMemory exception. There is not enough space on the stack |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 __ PrepareCallCFunction(num_arguments); | 919 __ PrepareCallCFunction(num_arguments); |
920 #ifdef _WIN64 | 920 #ifdef _WIN64 |
921 // Microsoft passes parameters in rcx, rdx. | 921 // Microsoft passes parameters in rcx, rdx. |
922 // First argument, backtrack stackpointer, is already in rcx. | 922 // First argument, backtrack stackpointer, is already in rcx. |
923 __ lea(rdx, Operand(rbp, kStackHighEnd)); // Second argument | 923 __ lea(rdx, Operand(rbp, kStackHighEnd)); // Second argument |
924 #else | 924 #else |
925 // AMD64 ABI passes parameters in rdi, rsi. | 925 // AMD64 ABI passes parameters in rdi, rsi. |
926 __ movq(rdi, backtrack_stackpointer()); // First argument. | 926 __ movq(rdi, backtrack_stackpointer()); // First argument. |
927 __ lea(rsi, Operand(rbp, kStackHighEnd)); // Second argument. | 927 __ lea(rsi, Operand(rbp, kStackHighEnd)); // Second argument. |
928 #endif | 928 #endif |
929 ExternalReference grow_stack = ExternalReference::re_grow_stack(); | 929 ExternalReference grow_stack = |
| 930 ExternalReference::re_grow_stack(masm_->isolate()); |
930 __ CallCFunction(grow_stack, num_arguments); | 931 __ CallCFunction(grow_stack, num_arguments); |
931 // If return NULL, we have failed to grow the stack, and | 932 // If return NULL, we have failed to grow the stack, and |
932 // must exit with a stack-overflow exception. | 933 // must exit with a stack-overflow exception. |
933 __ testq(rax, rax); | 934 __ testq(rax, rax); |
934 __ j(equal, &exit_with_exception); | 935 __ j(equal, &exit_with_exception); |
935 // Otherwise use return value as new stack pointer. | 936 // Otherwise use return value as new stack pointer. |
936 __ movq(backtrack_stackpointer(), rax); | 937 __ movq(backtrack_stackpointer(), rax); |
937 // Restore saved registers and continue. | 938 // Restore saved registers and continue. |
938 __ Move(code_object_pointer(), masm_->CodeObject()); | 939 __ Move(code_object_pointer(), masm_->CodeObject()); |
939 #ifndef _WIN64 | 940 #ifndef _WIN64 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 #else | 1122 #else |
1122 // Third argument: RegExp code frame pointer. | 1123 // Third argument: RegExp code frame pointer. |
1123 __ movq(rdx, rbp); | 1124 __ movq(rdx, rbp); |
1124 // Second argument: Code* of self. | 1125 // Second argument: Code* of self. |
1125 __ movq(rsi, code_object_pointer()); | 1126 __ movq(rsi, code_object_pointer()); |
1126 // First argument: Next address on the stack (will be address of | 1127 // First argument: Next address on the stack (will be address of |
1127 // return address). | 1128 // return address). |
1128 __ lea(rdi, Operand(rsp, -kPointerSize)); | 1129 __ lea(rdi, Operand(rsp, -kPointerSize)); |
1129 #endif | 1130 #endif |
1130 ExternalReference stack_check = | 1131 ExternalReference stack_check = |
1131 ExternalReference::re_check_stack_guard_state(); | 1132 ExternalReference::re_check_stack_guard_state(masm_->isolate()); |
1132 __ CallCFunction(stack_check, num_arguments); | 1133 __ CallCFunction(stack_check, num_arguments); |
1133 } | 1134 } |
1134 | 1135 |
1135 | 1136 |
1136 // Helper function for reading a value out of a stack frame. | 1137 // Helper function for reading a value out of a stack frame. |
1137 template <typename T> | 1138 template <typename T> |
1138 static T& frame_entry(Address re_frame, int frame_offset) { | 1139 static T& frame_entry(Address re_frame, int frame_offset) { |
1139 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1140 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); |
1140 } | 1141 } |
1141 | 1142 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 | 1322 |
1322 void RegExpMacroAssemblerX64::Drop() { | 1323 void RegExpMacroAssemblerX64::Drop() { |
1323 __ addq(backtrack_stackpointer(), Immediate(kIntSize)); | 1324 __ addq(backtrack_stackpointer(), Immediate(kIntSize)); |
1324 } | 1325 } |
1325 | 1326 |
1326 | 1327 |
1327 void RegExpMacroAssemblerX64::CheckPreemption() { | 1328 void RegExpMacroAssemblerX64::CheckPreemption() { |
1328 // Check for preemption. | 1329 // Check for preemption. |
1329 Label no_preempt; | 1330 Label no_preempt; |
1330 ExternalReference stack_limit = | 1331 ExternalReference stack_limit = |
1331 ExternalReference::address_of_stack_limit(); | 1332 ExternalReference::address_of_stack_limit(masm_->isolate()); |
1332 __ load_rax(stack_limit); | 1333 __ load_rax(stack_limit); |
1333 __ cmpq(rsp, rax); | 1334 __ cmpq(rsp, rax); |
1334 __ j(above, &no_preempt); | 1335 __ j(above, &no_preempt); |
1335 | 1336 |
1336 SafeCall(&check_preempt_label_); | 1337 SafeCall(&check_preempt_label_); |
1337 | 1338 |
1338 __ bind(&no_preempt); | 1339 __ bind(&no_preempt); |
1339 } | 1340 } |
1340 | 1341 |
1341 | 1342 |
1342 void RegExpMacroAssemblerX64::CheckStackLimit() { | 1343 void RegExpMacroAssemblerX64::CheckStackLimit() { |
1343 Label no_stack_overflow; | 1344 Label no_stack_overflow; |
1344 ExternalReference stack_limit = | 1345 ExternalReference stack_limit = |
1345 ExternalReference::address_of_regexp_stack_limit(); | 1346 ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); |
1346 __ load_rax(stack_limit); | 1347 __ load_rax(stack_limit); |
1347 __ cmpq(backtrack_stackpointer(), rax); | 1348 __ cmpq(backtrack_stackpointer(), rax); |
1348 __ j(above, &no_stack_overflow); | 1349 __ j(above, &no_stack_overflow); |
1349 | 1350 |
1350 SafeCall(&stack_overflow_label_); | 1351 SafeCall(&stack_overflow_label_); |
1351 | 1352 |
1352 __ bind(&no_stack_overflow); | 1353 __ bind(&no_stack_overflow); |
1353 } | 1354 } |
1354 | 1355 |
1355 | 1356 |
(...skipping 21 matching lines...) Expand all Loading... |
1377 } | 1378 } |
1378 } | 1379 } |
1379 | 1380 |
1380 #undef __ | 1381 #undef __ |
1381 | 1382 |
1382 #endif // V8_INTERPRETED_REGEXP | 1383 #endif // V8_INTERPRETED_REGEXP |
1383 | 1384 |
1384 }} // namespace v8::internal | 1385 }} // namespace v8::internal |
1385 | 1386 |
1386 #endif // V8_TARGET_ARCH_X64 | 1387 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |