| 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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 2650 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
| 2651 masm->set_allow_stub_calls(false); | 2651 masm->set_allow_stub_calls(false); |
| 2652 EntryCode(masm); | 2652 EntryCode(masm); |
| 2653 __ subq(rsp, Immediate(1 * kPointerSize)); | 2653 __ subq(rsp, Immediate(1 * kPointerSize)); |
| 2654 Label exit; | 2654 Label exit; |
| 2655 | 2655 |
| 2656 // Test 1. | 2656 // Test 1. |
| 2657 __ movq(rax, Immediate(1)); // Test number. | 2657 __ movq(rax, Immediate(1)); // Test number. |
| 2658 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | 2658 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2659 __ movq(rcx, Immediate(-1)); | 2659 __ movq(rcx, Immediate(-1)); |
| 2660 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Byte()); | 2660 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger8()); |
| 2661 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2661 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2662 __ movl(rdx, Immediate(255)); | 2662 __ movl(rdx, Immediate(255)); |
| 2663 __ cmpq(rcx, rdx); | 2663 __ cmpq(rcx, rdx); |
| 2664 __ j(not_equal, &exit); | 2664 __ j(not_equal, &exit); |
| 2665 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Byte()); | 2665 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::UInteger8()); |
| 2666 __ cmpq(rcx, rdx); | 2666 __ cmpq(rcx, rdx); |
| 2667 __ j(not_equal, &exit); | 2667 __ j(not_equal, &exit); |
| 2668 | 2668 |
| 2669 // Test 2. | 2669 // Test 2. |
| 2670 __ movq(rax, Immediate(2)); // Test number. | 2670 __ movq(rax, Immediate(2)); // Test number. |
| 2671 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); | 2671 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2672 __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); | 2672 __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); |
| 2673 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi()); | 2673 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi()); |
| 2674 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2674 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2675 __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); | 2675 __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788)); | 2724 __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788)); |
| 2725 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External()); | 2725 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External()); |
| 2726 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); | 2726 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2727 __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788)); | 2727 __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788)); |
| 2728 __ cmpq(rcx, rdx); | 2728 __ cmpq(rcx, rdx); |
| 2729 __ j(not_equal, &exit); | 2729 __ j(not_equal, &exit); |
| 2730 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External()); | 2730 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External()); |
| 2731 __ cmpq(rcx, rdx); | 2731 __ cmpq(rcx, rdx); |
| 2732 __ j(not_equal, &exit); | 2732 __ j(not_equal, &exit); |
| 2733 | 2733 |
| 2734 // Test 7. |
| 2735 __ movq(rax, Immediate(7)); // Test number. |
| 2736 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2737 __ movq(rcx, Immediate(-1)); |
| 2738 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer8()); |
| 2739 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2740 __ movl(rdx, Immediate(255)); |
| 2741 __ cmpq(rcx, rdx); |
| 2742 __ j(not_equal, &exit); |
| 2743 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer8()); |
| 2744 __ movq(rcx, Immediate(-1)); |
| 2745 __ cmpq(rcx, rdx); |
| 2746 __ j(not_equal, &exit); |
| 2747 |
| 2748 // Test 8. |
| 2749 __ movq(rax, Immediate(8)); // Test number. |
| 2750 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2751 __ movq(rcx, Immediate(-1)); |
| 2752 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer16()); |
| 2753 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2754 __ movl(rdx, Immediate(65535)); |
| 2755 __ cmpq(rcx, rdx); |
| 2756 __ j(not_equal, &exit); |
| 2757 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer16()); |
| 2758 __ movq(rcx, Immediate(-1)); |
| 2759 __ cmpq(rcx, rdx); |
| 2760 __ j(not_equal, &exit); |
| 2761 |
| 2762 // Test 9. |
| 2763 __ movq(rax, Immediate(9)); // Test number. |
| 2764 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); |
| 2765 __ movq(rcx, Immediate(-1)); |
| 2766 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger16()); |
| 2767 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); |
| 2768 __ movl(rdx, Immediate(65535)); |
| 2769 __ cmpq(rcx, rdx); |
| 2770 __ j(not_equal, &exit); |
| 2771 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::UInteger16()); |
| 2772 __ cmpq(rcx, rdx); |
| 2773 __ j(not_equal, &exit); |
| 2774 |
| 2734 __ xor_(rax, rax); // Success. | 2775 __ xor_(rax, rax); // Success. |
| 2735 __ bind(&exit); | 2776 __ bind(&exit); |
| 2736 __ addq(rsp, Immediate(1 * kPointerSize)); | 2777 __ addq(rsp, Immediate(1 * kPointerSize)); |
| 2737 ExitCode(masm); | 2778 ExitCode(masm); |
| 2738 __ ret(0); | 2779 __ ret(0); |
| 2739 | 2780 |
| 2740 CodeDesc desc; | 2781 CodeDesc desc; |
| 2741 masm->GetCode(&desc); | 2782 masm->GetCode(&desc); |
| 2742 // Call the function from C++. | 2783 // Call the function from C++. |
| 2743 int result = FUNCTION_CAST<F0>(buffer)(); | 2784 int result = FUNCTION_CAST<F0>(buffer)(); |
| 2744 CHECK_EQ(0, result); | 2785 CHECK_EQ(0, result); |
| 2745 } | 2786 } |
| 2746 | 2787 |
| 2747 | 2788 |
| 2748 #undef __ | 2789 #undef __ |
| OLD | NEW |