| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 __ push(ebp); | 627 __ push(ebp); |
| 628 __ mov(ebp, esp); | 628 __ mov(ebp, esp); |
| 629 // Save callee-save registers. Order here should correspond to order of | 629 // Save callee-save registers. Order here should correspond to order of |
| 630 // kBackup_ebx etc. | 630 // kBackup_ebx etc. |
| 631 __ push(esi); | 631 __ push(esi); |
| 632 __ push(edi); | 632 __ push(edi); |
| 633 __ push(ebx); // Callee-save on MacOS. | 633 __ push(ebx); // Callee-save on MacOS. |
| 634 __ push(Immediate(0)); // Make room for "input start - 1" constant. | 634 __ push(Immediate(0)); // Make room for "input start - 1" constant. |
| 635 | 635 |
| 636 // Check if we have space on the stack for registers. | 636 // Check if we have space on the stack for registers. |
| 637 Label retry_stack_check; | |
| 638 Label stack_limit_hit; | 637 Label stack_limit_hit; |
| 639 Label stack_ok; | 638 Label stack_ok; |
| 640 | 639 |
| 641 __ bind(&retry_stack_check); | |
| 642 ExternalReference stack_guard_limit = | 640 ExternalReference stack_guard_limit = |
| 643 ExternalReference::address_of_stack_guard_limit(); | 641 ExternalReference::address_of_stack_guard_limit(); |
| 644 __ mov(ecx, esp); | 642 __ mov(ecx, esp); |
| 645 __ sub(ecx, Operand::StaticVariable(stack_guard_limit)); | 643 __ sub(ecx, Operand::StaticVariable(stack_guard_limit)); |
| 646 // Handle it if the stack pointer is already below the stack limit. | 644 // Handle it if the stack pointer is already below the stack limit. |
| 647 __ j(below_equal, &stack_limit_hit, not_taken); | 645 __ j(below_equal, &stack_limit_hit, not_taken); |
| 648 // Check if there is room for the variable number of registers above | 646 // Check if there is room for the variable number of registers above |
| 649 // the stack limit. | 647 // the stack limit. |
| 650 __ cmp(ecx, num_registers_ * kPointerSize); | 648 __ cmp(ecx, num_registers_ * kPointerSize); |
| 651 __ j(above_equal, &stack_ok, taken); | 649 __ j(above_equal, &stack_ok, taken); |
| 652 // Exit with OutOfMemory exception. There is not enough space on the stack | 650 // Exit with OutOfMemory exception. There is not enough space on the stack |
| 653 // for our working registers. | 651 // for our working registers. |
| 654 __ mov(eax, EXCEPTION); | 652 __ mov(eax, EXCEPTION); |
| 655 __ jmp(&exit_label_); | 653 __ jmp(&exit_label_); |
| 656 | 654 |
| 657 __ bind(&stack_limit_hit); | 655 __ bind(&stack_limit_hit); |
| 658 CallCheckStackGuardState(ebx); | 656 CallCheckStackGuardState(ebx); |
| 659 __ or_(eax, Operand(eax)); | 657 __ or_(eax, Operand(eax)); |
| 660 // If returned value is non-zero, we exit with the returned value as result. | 658 // If returned value is non-zero, we exit with the returned value as result. |
| 661 // Otherwise it was a preemption and we just check the limit again. | 659 __ j(not_zero, &exit_label_); |
| 662 __ j(equal, &retry_stack_check); | |
| 663 // Return value was non-zero. Exit with exception or retry. | |
| 664 __ jmp(&exit_label_); | |
| 665 | 660 |
| 666 __ bind(&stack_ok); | 661 __ bind(&stack_ok); |
| 667 | 662 |
| 668 // Allocate space on stack for registers. | 663 // Allocate space on stack for registers. |
| 669 __ sub(Operand(esp), Immediate(num_registers_ * kPointerSize)); | 664 __ sub(Operand(esp), Immediate(num_registers_ * kPointerSize)); |
| 670 // Load string length. | 665 // Load string length. |
| 671 __ mov(esi, Operand(ebp, kInputEnd)); | 666 __ mov(esi, Operand(ebp, kInputEnd)); |
| 672 // Load input position. | 667 // Load input position. |
| 673 __ mov(edi, Operand(ebp, kInputStart)); | 668 __ mov(edi, Operand(ebp, kInputStart)); |
| 674 // Set up edi to be negative offset from string end. | 669 // Set up edi to be negative offset from string end. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 750 |
| 756 Label exit_with_exception; | 751 Label exit_with_exception; |
| 757 | 752 |
| 758 // Preempt-code | 753 // Preempt-code |
| 759 if (check_preempt_label_.is_linked()) { | 754 if (check_preempt_label_.is_linked()) { |
| 760 __ bind(&check_preempt_label_); | 755 __ bind(&check_preempt_label_); |
| 761 | 756 |
| 762 __ push(backtrack_stackpointer()); | 757 __ push(backtrack_stackpointer()); |
| 763 __ push(edi); | 758 __ push(edi); |
| 764 | 759 |
| 765 Label retry; | |
| 766 | |
| 767 __ bind(&retry); | |
| 768 CallCheckStackGuardState(ebx); | 760 CallCheckStackGuardState(ebx); |
| 769 __ or_(eax, Operand(eax)); | 761 __ or_(eax, Operand(eax)); |
| 770 // If returning non-zero, we should end execution with the given | 762 // If returning non-zero, we should end execution with the given |
| 771 // result as return value. | 763 // result as return value. |
| 772 __ j(not_zero, &exit_label_); | 764 __ j(not_zero, &exit_label_); |
| 773 // Check if we are still preempted. | |
| 774 ExternalReference stack_guard_limit = | |
| 775 ExternalReference::address_of_stack_guard_limit(); | |
| 776 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); | |
| 777 __ j(below_equal, &retry); | |
| 778 | 765 |
| 779 __ pop(edi); | 766 __ pop(edi); |
| 780 __ pop(backtrack_stackpointer()); | 767 __ pop(backtrack_stackpointer()); |
| 781 // String might have moved: Reload esi from frame. | 768 // String might have moved: Reload esi from frame. |
| 782 __ mov(esi, Operand(ebp, kInputEnd)); | 769 __ mov(esi, Operand(ebp, kInputEnd)); |
| 783 SafeReturn(); | 770 SafeReturn(); |
| 784 } | 771 } |
| 785 | 772 |
| 786 // Backtrack stack overflow code. | 773 // Backtrack stack overflow code. |
| 787 if (stack_overflow_label_.is_linked()) { | 774 if (stack_overflow_label_.is_linked()) { |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 | 1372 |
| 1386 | 1373 |
| 1387 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, | 1374 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, |
| 1388 ArraySlice* buffer) { | 1375 ArraySlice* buffer) { |
| 1389 __ mov(reg, buffer->array()); | 1376 __ mov(reg, buffer->array()); |
| 1390 __ add(Operand(reg), Immediate(buffer->base_offset())); | 1377 __ add(Operand(reg), Immediate(buffer->base_offset())); |
| 1391 } | 1378 } |
| 1392 | 1379 |
| 1393 #undef __ | 1380 #undef __ |
| 1394 }} // namespace v8::internal | 1381 }} // namespace v8::internal |
| OLD | NEW |