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

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

Issue 66193004: Reland 17588: Add signed/unsigned 8-bit and 16-bit Representations to Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Latest version Created 7 years, 1 month 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 | « test/cctest/cctest.gyp ('k') | test/cctest/test-macro-assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-macro-assembler-arm.cc
diff --git a/test/cctest/test-macro-assembler-arm.cc b/test/cctest/test-macro-assembler-arm.cc
index 77f7abbd44356c7684e90c99cd12d77247a60cba..377450acc0b2ade7d633eabe11aaa28ebce5483a 100644
--- a/test/cctest/test-macro-assembler-arm.cc
+++ b/test/cctest/test-macro-assembler-arm.cc
@@ -132,5 +132,102 @@ TEST(CopyBytes) {
}
+typedef int (*F5)(void*, void*, void*, void*, void*);
+
+
+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);
+ __ sub(sp, sp, Operand(1 * kPointerSize));
+ Label exit;
+
+ // Test 1.
+ __ mov(r0, Operand(1)); // Test number.
+ __ mov(r1, Operand(0));
+ __ str(r1, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(-1));
+ __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
+ __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(255));
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+ __ mov(r2, Operand(255));
+ __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+
+ // Test 2.
+ __ mov(r0, Operand(2)); // Test number.
+ __ mov(r1, Operand(0));
+ __ str(r1, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(-1));
+ __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
+ __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(255));
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+ __ mov(r2, Operand(-1));
+ __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+
+ // Test 3.
+ __ mov(r0, Operand(3)); // Test number.
+ __ mov(r1, Operand(0));
+ __ str(r1, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(-1));
+ __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
+ __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(65535));
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+ __ mov(r2, Operand(65535));
+ __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+
+ // Test 4.
+ __ mov(r0, Operand(4)); // Test number.
+ __ mov(r1, Operand(0));
+ __ str(r1, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(-1));
+ __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
+ __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
+ __ mov(r2, Operand(65535));
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+ __ mov(r2, Operand(-1));
+ __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
+ __ cmp(r3, r2);
+ __ b(ne, &exit);
+
+ __ mov(r0, Operand(0)); // Success.
+ __ bind(&exit);
+ __ add(sp, sp, Operand(1 * kPointerSize));
+ __ bx(lr);
+
+ CodeDesc desc;
+ masm->GetCode(&desc);
+ Object* code = isolate->heap()->CreateCode(
+ desc,
+ Code::ComputeFlags(Code::STUB),
+ Handle<Code>())->ToObjectChecked();
+ CHECK(code->IsCode());
+
+ // Call the function from C++.
+ F5 f = FUNCTION_CAST<F5>(Code::cast(code)->entry());
+ CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0));
+}
#undef __
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/test-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698