Commit 8bacd848 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[arm] [simulator] Do also execute tests on real hardware

In order to avoid writing tests that *only* pass in the simulator, but
not on real hardware, do also execute the simulator tests on real
hardware.

R=ahaas@chromium.org, rodolph.perfetta@arm.com

Bug: v8:6947
Change-Id: Ibdf1719fff20e17620c0aaa343d7ea28e48f3837
Reviewed-on: https://chromium-review.googlesource.com/722961
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarRodolph Perfetta <rodolph.perfetta@arm.com>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48706}
parent b1cd96ec
...@@ -38,15 +38,13 @@ ...@@ -38,15 +38,13 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#if defined(USE_SIMULATOR)
#ifndef V8_TARGET_LITTLE_ENDIAN #ifndef V8_TARGET_LITTLE_ENDIAN
#error Expected ARM to be little-endian #error Expected ARM to be little-endian
#endif #endif
// Define these function prototypes to match JSEntryFunction in execution.cc. // Define these function prototypes to match JSEntryFunction in execution.cc.
typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); typedef Object* (*F_iiiii)(int p0, int p1, int p2, int p3, int p4);
typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); typedef Object* (*F_piiii)(void* p0, int p1, int p2, int p3, int p4);
#define __ assm. #define __ assm.
...@@ -183,7 +181,7 @@ void AssembleStoreExcl(Assembler* assembler, MemoryAccess access, ...@@ -183,7 +181,7 @@ void AssembleStoreExcl(Assembler* assembler, MemoryAccess access,
AssembleMemoryAccess(assembler, access, dest_reg, value_reg, addr_reg); AssembleMemoryAccess(assembler, access, dest_reg, value_reg, addr_reg);
} }
F3 AssembleCode(std::function<void(Assembler&)> assemble) { Address AssembleCode(std::function<void(Assembler&)> assemble) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Assembler assm(isolate, nullptr, 0); Assembler assm(isolate, nullptr, 0);
...@@ -195,8 +193,7 @@ F3 AssembleCode(std::function<void(Assembler&)> assemble) { ...@@ -195,8 +193,7 @@ F3 AssembleCode(std::function<void(Assembler&)> assemble) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry()); return code->entry();
return f;
} }
void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1, void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1,
...@@ -205,11 +202,11 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1, ...@@ -205,11 +202,11 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1,
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([&](Assembler& assm) { F_piiii f = FUNCTION_CAST<F_piiii>(AssembleCode([&](Assembler& assm) {
AssembleLoadExcl(&assm, access1, r1, r1); AssembleLoadExcl(&assm, access1, r1, r1);
AssembleMemoryAccess(&assm, access2, r3, r2, r1); AssembleMemoryAccess(&assm, access2, r3, r2, r1);
AssembleStoreExcl(&assm, access3, r0, r3, r1); AssembleStoreExcl(&assm, access3, r0, r3, r1);
}); }));
TestData t = initial_data; TestData t = initial_data;
...@@ -290,9 +287,9 @@ TEST(simulator_invalidate_exclusive_access) { ...@@ -290,9 +287,9 @@ TEST(simulator_invalidate_exclusive_access) {
static int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, static int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data,
MemoryAccess access) { MemoryAccess access) {
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([&](Assembler& assm) { F_piiii f = FUNCTION_CAST<F_piiii>(AssembleCode([&](Assembler& assm) {
AssembleMemoryAccess(&assm, access, r0, r2, r1); AssembleMemoryAccess(&assm, access, r0, r2, r1);
}); }));
return reinterpret_cast<int>( return reinterpret_cast<int>(
CALL_GENERATED_CODE(isolate, f, test_data, 0, 0, 0, 0)); CALL_GENERATED_CODE(isolate, f, test_data, 0, 0, 0, 0));
...@@ -417,11 +414,11 @@ TEST(simulator_vabs_32) { ...@@ -417,11 +414,11 @@ TEST(simulator_vabs_32) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([](Assembler& assm) { F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) {
__ vmov(s0, r0); __ vmov(s0, r0);
__ vabs(s0, s0); __ vabs(s0, s0);
__ vmov(r0, s0); __ vmov(r0, s0);
}); }));
for (Float32 f32 : Float32Inputs()) { for (Float32 f32 : Float32Inputs()) {
Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>( Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>(
...@@ -435,11 +432,11 @@ TEST(simulator_vabs_64) { ...@@ -435,11 +432,11 @@ TEST(simulator_vabs_64) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([](Assembler& assm) { F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) {
__ vmov(d0, r0, r1); __ vmov(d0, r0, r1);
__ vabs(d0, d0); __ vabs(d0, d0);
__ vmov(r1, r0, d0); __ vmov(r1, r0, d0);
}); }));
for (Float64 f64 : Float64Inputs()) { for (Float64 f64 : Float64Inputs()) {
uint32_t p0 = static_cast<uint32_t>(f64.get_bits()); uint32_t p0 = static_cast<uint32_t>(f64.get_bits());
...@@ -456,11 +453,11 @@ TEST(simulator_vneg_32) { ...@@ -456,11 +453,11 @@ TEST(simulator_vneg_32) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([](Assembler& assm) { F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) {
__ vmov(s0, r0); __ vmov(s0, r0);
__ vneg(s0, s0); __ vneg(s0, s0);
__ vmov(r0, s0); __ vmov(r0, s0);
}); }));
for (Float32 f32 : Float32Inputs()) { for (Float32 f32 : Float32Inputs()) {
Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>( Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>(
...@@ -474,11 +471,11 @@ TEST(simulator_vneg_64) { ...@@ -474,11 +471,11 @@ TEST(simulator_vneg_64) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
F3 f = AssembleCode([](Assembler& assm) { F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) {
__ vmov(d0, r0, r1); __ vmov(d0, r0, r1);
__ vneg(d0, d0); __ vneg(d0, d0);
__ vmov(r1, r0, d0); __ vmov(r1, r0, d0);
}); }));
for (Float64 f64 : Float64Inputs()) { for (Float64 f64 : Float64Inputs()) {
uint32_t p0 = static_cast<uint32_t>(f64.get_bits()); uint32_t p0 = static_cast<uint32_t>(f64.get_bits());
...@@ -493,7 +490,5 @@ TEST(simulator_vneg_64) { ...@@ -493,7 +490,5 @@ TEST(simulator_vneg_64) {
#undef __ #undef __
#endif // USE_SIMULATOR
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment