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

Unified Diff: test/cctest/test-macro-assembler-x64.cc

Issue 26653004: Revert "Load/Store cannot handle double representation." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-macro-assembler-x64.cc
diff --git a/test/cctest/test-macro-assembler-x64.cc b/test/cctest/test-macro-assembler-x64.cc
index d9b6e3f081a05ddcc078e05ab16bdff11514d544..61914b58c333beb53e4c7a02afe0922845a40eeb 100644
--- a/test/cctest/test-macro-assembler-x64.cc
+++ b/test/cctest/test-macro-assembler-x64.cc
@@ -47,6 +47,7 @@ using v8::internal::MacroAssembler;
using v8::internal::OS;
using v8::internal::Operand;
using v8::internal::RelocInfo;
+using v8::internal::Representation;
using v8::internal::Smi;
using v8::internal::SmiIndex;
using v8::internal::byte;
@@ -2634,5 +2635,114 @@ TEST(OperandOffset) {
}
+TEST(LoadAndStoreWithRepresentation) {
+ v8::internal::V8::Initialize(NULL);
+
+ // Allocate an executable page of memory.
+ size_t actual_size;
+ byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
+ &actual_size,
+ true));
+ CHECK(buffer);
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope handles(isolate);
+ MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
+ MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
+ masm->set_allow_stub_calls(false);
+ EntryCode(masm);
+ __ subq(rsp, Immediate(1 * kPointerSize));
+ Label exit;
+
+ // Test 1.
+ __ movq(rax, Immediate(1)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ movq(rcx, Immediate(-1));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Byte());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ movl(rdx, Immediate(255));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Byte());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ // Test 2.
+ __ movq(rax, Immediate(2)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Smi());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ // Test 3.
+ __ movq(rax, Immediate(3)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ movq(rcx, Immediate(-1));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Integer32());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ movl(rdx, Immediate(-1));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Integer32());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ // Test 4.
+ __ movq(rax, Immediate(4)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ movl(rcx, Immediate(0x44332211));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::HeapObject());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ movl(rdx, Immediate(0x44332211));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::HeapObject());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ // Test 5.
+ __ movq(rax, Immediate(5)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ Set(rcx, V8_2PART_UINT64_C(0x12345678, deadbeaf));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Tagged());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ Set(rdx, V8_2PART_UINT64_C(0x12345678, deadbeaf));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Tagged());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ // Test 6.
+ __ movq(rax, Immediate(6)); // Test number.
+ __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
+ __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788));
+ __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::External());
+ __ movq(rcx, Operand(rsp, 0 * kPointerSize));
+ __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788));
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+ __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::External());
+ __ cmpq(rcx, rdx);
+ __ j(not_equal, &exit);
+
+ __ xor_(rax, rax); // Success.
+ __ bind(&exit);
+ __ addq(rsp, Immediate(1 * kPointerSize));
+ ExitCode(masm);
+ __ ret(0);
+
+ CodeDesc desc;
+ masm->GetCode(&desc);
+ // Call the function from C++.
+ int result = FUNCTION_CAST<F0>(buffer)();
+ CHECK_EQ(0, result);
+}
+
#undef __
« 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