Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Side by Side Diff: test/cctest/test-macro-assembler-x64.cc

Issue 25990002: Load/Store cannot handle double representation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 using v8::internal::Condition; 40 using v8::internal::Condition;
41 using v8::internal::FUNCTION_CAST; 41 using v8::internal::FUNCTION_CAST;
42 using v8::internal::HandleScope; 42 using v8::internal::HandleScope;
43 using v8::internal::Immediate; 43 using v8::internal::Immediate;
44 using v8::internal::Isolate; 44 using v8::internal::Isolate;
45 using v8::internal::Label; 45 using v8::internal::Label;
46 using v8::internal::MacroAssembler; 46 using v8::internal::MacroAssembler;
47 using v8::internal::OS; 47 using v8::internal::OS;
48 using v8::internal::Operand; 48 using v8::internal::Operand;
49 using v8::internal::RelocInfo; 49 using v8::internal::RelocInfo;
50 using v8::internal::Representation;
50 using v8::internal::Smi; 51 using v8::internal::Smi;
51 using v8::internal::SmiIndex; 52 using v8::internal::SmiIndex;
52 using v8::internal::byte; 53 using v8::internal::byte;
53 using v8::internal::carry; 54 using v8::internal::carry;
54 using v8::internal::greater; 55 using v8::internal::greater;
55 using v8::internal::greater_equal; 56 using v8::internal::greater_equal;
56 using v8::internal::kIntSize; 57 using v8::internal::kIntSize;
57 using v8::internal::kPointerSize; 58 using v8::internal::kPointerSize;
58 using v8::internal::kSmiTagMask; 59 using v8::internal::kSmiTagMask;
59 using v8::internal::kSmiValueSize; 60 using v8::internal::kSmiValueSize;
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 2628
2628 2629
2629 CodeDesc desc; 2630 CodeDesc desc;
2630 masm->GetCode(&desc); 2631 masm->GetCode(&desc);
2631 // Call the function from C++. 2632 // Call the function from C++.
2632 int result = FUNCTION_CAST<F0>(buffer)(); 2633 int result = FUNCTION_CAST<F0>(buffer)();
2633 CHECK_EQ(0, result); 2634 CHECK_EQ(0, result);
2634 } 2635 }
2635 2636
2636 2637
2638 TEST(LoadAndStoreWithRepresentation) {
2639 v8::internal::V8::Initialize(NULL);
2640
2641 // Allocate an executable page of memory.
2642 size_t actual_size;
2643 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
2644 &actual_size,
2645 true));
2646 CHECK(buffer);
2647 Isolate* isolate = CcTest::i_isolate();
2648 HandleScope handles(isolate);
2649 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2650 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
2651 masm->set_allow_stub_calls(false);
2652 __ push(rbp);
2653 __ movq(rbp, rsp);
2654 __ subq(rsp, Immediate(1 * kPointerSize));
2655 EntryCode(masm);
2656 Label exit;
2657
2658 // Test 1.
2659 __ movq(rax, Immediate(1)); // Test number.
2660 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2661 __ movq(rcx, Immediate(-1));
2662 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Byte());
2663 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2664 __ movl(rdx, Immediate(255));
2665 __ cmpq(rcx, rdx);
2666 __ j(not_equal, &exit);
2667 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Byte());
2668 __ cmpq(rcx, rdx);
2669 __ j(not_equal, &exit);
2670
2671 // Test 2.
2672 __ movq(rax, Immediate(2)); // Test number.
2673 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2674 __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678));
2675 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi());
2676 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2677 __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678));
2678 __ cmpq(rcx, rdx);
2679 __ j(not_equal, &exit);
2680 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Smi());
2681 __ cmpq(rcx, rdx);
2682 __ j(not_equal, &exit);
2683
2684 // Test 3.
2685 __ movq(rax, Immediate(3)); // Test number.
2686 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2687 __ movq(rcx, Immediate(-1));
2688 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer32());
2689 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2690 __ movl(rdx, Immediate(-1));
2691 __ cmpq(rcx, rdx);
2692 __ j(not_equal, &exit);
2693 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer32());
2694 __ cmpq(rcx, rdx);
2695 __ j(not_equal, &exit);
2696
2697 // Test 4.
2698 __ movq(rax, Immediate(4)); // Test number.
2699 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2700 __ movl(rcx, Immediate(0x44332211));
2701 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::HeapObject());
2702 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2703 __ movl(rdx, Immediate(0x44332211));
2704 __ cmpq(rcx, rdx);
2705 __ j(not_equal, &exit);
2706 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::HeapObject());
2707 __ cmpq(rcx, rdx);
2708 __ j(not_equal, &exit);
2709
2710 // Test 5.
2711 __ movq(rax, Immediate(5)); // Test number.
2712 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2713 __ Set(rcx, V8_2PART_UINT64_C(0x12345678, deadbeaf));
2714 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Tagged());
2715 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2716 __ Set(rdx, V8_2PART_UINT64_C(0x12345678, deadbeaf));
2717 __ cmpq(rcx, rdx);
2718 __ j(not_equal, &exit);
2719 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Tagged());
2720 __ cmpq(rcx, rdx);
2721 __ j(not_equal, &exit);
2722
2723 // Test 6.
2724 __ movq(rax, Immediate(6)); // Test number.
2725 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2726 __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788));
2727 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External());
2728 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
2729 __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788));
2730 __ cmpq(rcx, rdx);
2731 __ j(not_equal, &exit);
2732 __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External());
2733 __ cmpq(rcx, rdx);
2734 __ j(not_equal, &exit);
2735
2736 __ xor_(rax, rax); // Success.
2737 __ bind(&exit);
2738 ExitCode(masm);
2739 __ movq(rsp, rbp);
2740 __ pop(rbp);
2741 __ ret(0);
2742
2743 CodeDesc desc;
2744 masm->GetCode(&desc);
2745 // Call the function from C++.A
2746 int result = FUNCTION_CAST<F0>(buffer)();
2747 CHECK_EQ(0, result);
2748 }
2749
2637 2750
2638 #undef __ 2751 #undef __
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698