| 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 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 2697 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
| 2698 masm->set_allow_stub_calls(false); | 2698 masm->set_allow_stub_calls(false); |
| 2699 EntryCode(masm); | 2699 EntryCode(masm); |
| 2700 __ subq(rsp, Immediate(1 * kPointerSize)); | 2700 __ subq(rsp, Immediate(1 * kPointerSize)); |
| 2701 Label exit; | 2701 Label exit; |
| 2702 | 2702 |
| 2703 // Test 1. | 2703 // Test 1. |
| 2704 __ movq(rax, Immediate(1)); // Test number. | 2704 __ movq(rax, Immediate(1)); // Test number. |
| 2705 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | 2705 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2706 __ movq(rcx, Immediate(-1)); | 2706 __ movq(rcx, Immediate(-1)); |
| 2707 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger8()); | 2707 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Byte()); |
| 2708 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2708 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2709 __ movl(rdx, Immediate(255)); | 2709 __ movl(rdx, Immediate(255)); |
| 2710 __ cmpq(rcx, rdx); | 2710 __ cmpq(rcx, rdx); |
| 2711 __ j(not_equal, &exit); | 2711 __ j(not_equal, &exit); |
| 2712 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::UInteger8()); | 2712 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Byte()); |
| 2713 __ cmpq(rcx, rdx); | 2713 __ cmpq(rcx, rdx); |
| 2714 __ j(not_equal, &exit); | 2714 __ j(not_equal, &exit); |
| 2715 | 2715 |
| 2716 // Test 2. | 2716 // Test 2. |
| 2717 __ movq(rax, Immediate(2)); // Test number. | 2717 __ movq(rax, Immediate(2)); // Test number. |
| 2718 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | 2718 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2719 __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); | 2719 __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); |
| 2720 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi()); | 2720 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi()); |
| 2721 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2721 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2722 __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); | 2722 __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2771 __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788)); | 2771 __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788)); |
| 2772 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External()); | 2772 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External()); |
| 2773 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2773 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2774 __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788)); | 2774 __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788)); |
| 2775 __ cmpq(rcx, rdx); | 2775 __ cmpq(rcx, rdx); |
| 2776 __ j(not_equal, &exit); | 2776 __ j(not_equal, &exit); |
| 2777 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External()); | 2777 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External()); |
| 2778 __ cmpq(rcx, rdx); | 2778 __ cmpq(rcx, rdx); |
| 2779 __ j(not_equal, &exit); | 2779 __ j(not_equal, &exit); |
| 2780 | 2780 |
| 2781 // Test 7. | |
| 2782 __ movq(rax, Immediate(7)); // Test number. | |
| 2783 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | |
| 2784 __ movq(rcx, Immediate(-1)); | |
| 2785 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer8()); | |
| 2786 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | |
| 2787 __ movl(rdx, Immediate(255)); | |
| 2788 __ cmpq(rcx, rdx); | |
| 2789 __ j(not_equal, &exit); | |
| 2790 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer8()); | |
| 2791 __ movq(rcx, Immediate(-1)); | |
| 2792 __ cmpq(rcx, rdx); | |
| 2793 __ j(not_equal, &exit); | |
| 2794 | |
| 2795 // Test 8. | |
| 2796 __ movq(rax, Immediate(8)); // Test number. | |
| 2797 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | |
| 2798 __ movq(rcx, Immediate(-1)); | |
| 2799 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer16()); | |
| 2800 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | |
| 2801 __ movl(rdx, Immediate(65535)); | |
| 2802 __ cmpq(rcx, rdx); | |
| 2803 __ j(not_equal, &exit); | |
| 2804 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer16()); | |
| 2805 __ movq(rcx, Immediate(-1)); | |
| 2806 __ cmpq(rcx, rdx); | |
| 2807 __ j(not_equal, &exit); | |
| 2808 | |
| 2809 // Test 9. | |
| 2810 __ movq(rax, Immediate(9)); // Test number. | |
| 2811 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | |
| 2812 __ movq(rcx, Immediate(-1)); | |
| 2813 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger16()); | |
| 2814 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | |
| 2815 __ movl(rdx, Immediate(65535)); | |
| 2816 __ cmpq(rcx, rdx); | |
| 2817 __ j(not_equal, &exit); | |
| 2818 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::UInteger16()); | |
| 2819 __ cmpq(rcx, rdx); | |
| 2820 __ j(not_equal, &exit); | |
| 2821 | |
| 2822 __ xor_(rax, rax); // Success. | 2781 __ xor_(rax, rax); // Success. |
| 2823 __ bind(&exit); | 2782 __ bind(&exit); |
| 2824 __ addq(rsp, Immediate(1 * kPointerSize)); | 2783 __ addq(rsp, Immediate(1 * kPointerSize)); |
| 2825 ExitCode(masm); | 2784 ExitCode(masm); |
| 2826 __ ret(0); | 2785 __ ret(0); |
| 2827 | 2786 |
| 2828 CodeDesc desc; | 2787 CodeDesc desc; |
| 2829 masm->GetCode(&desc); | 2788 masm->GetCode(&desc); |
| 2830 // Call the function from C++. | 2789 // Call the function from C++. |
| 2831 int result = FUNCTION_CAST<F0>(buffer)(); | 2790 int result = FUNCTION_CAST<F0>(buffer)(); |
| 2832 CHECK_EQ(0, result); | 2791 CHECK_EQ(0, result); |
| 2833 } | 2792 } |
| 2834 | 2793 |
| 2835 | 2794 |
| 2836 #undef __ | 2795 #undef __ |
| OLD | NEW |