Commit 6d6cd4e9 authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[test] Move cctest/test-disasm-arm to unittests/assembler/

... disasm-arm-unittest.

Bug: v8:12781
Change-Id: Ice4bafdf89e2eb9ddbef7b613eef1e6ceb56133b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3676637Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#80832}
parent 4ecbc7cf
...@@ -257,7 +257,6 @@ v8_source_set("cctest_sources") { ...@@ -257,7 +257,6 @@ v8_source_set("cctest_sources") {
"assembler-helper-arm.cc", "assembler-helper-arm.cc",
"assembler-helper-arm.h", "assembler-helper-arm.h",
"test-assembler-arm.cc", "test-assembler-arm.cc",
"test-disasm-arm.cc",
"test-macro-assembler-arm.cc", "test-macro-assembler-arm.cc",
"test-sync-primitives-arm.cc", "test-sync-primitives-arm.cc",
] ]
......
...@@ -497,6 +497,7 @@ v8_source_set("unittests_sources") { ...@@ -497,6 +497,7 @@ v8_source_set("unittests_sources") {
if (v8_current_cpu == "arm") { if (v8_current_cpu == "arm") {
sources += [ sources += [
"assembler/disasm-arm-unittest.cc",
"assembler/turbo-assembler-arm-unittest.cc", "assembler/turbo-assembler-arm-unittest.cc",
"compiler/arm/instruction-selector-arm-unittest.cc", "compiler/arm/instruction-selector-arm-unittest.cc",
] ]
......
...@@ -43,11 +43,14 @@ ...@@ -43,11 +43,14 @@
#include "src/init/v8.h" #include "src/init/v8.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "src/utils/boxed-float.h" #include "src/utils/boxed-float.h"
#include "test/cctest/cctest.h" #include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
using DisasmArmTest = TestWithIsolate;
enum UseRegex { kRawString, kRegexString }; enum UseRegex { kRawString, kRegexString };
template <typename... S> template <typename... S>
...@@ -108,9 +111,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex, ...@@ -108,9 +111,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex,
// disassembler. Declare the variables and allocate the data structures used // disassembler. Declare the variables and allocate the data structures used
// in the rest of the macros. // in the rest of the macros.
#define SET_UP() \ #define SET_UP() \
CcTest::InitializeVM(); \ HandleScope scope(isolate()); \
Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \ byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, \ Assembler assm(AssemblerOptions{}, \
ExternalAssemblerBuffer(buffer, 4 * 1024)); \ ExternalAssemblerBuffer(buffer, 4 * 1024)); \
...@@ -135,9 +136,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex, ...@@ -135,9 +136,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex,
#define COMPARE_REGEX(asm_, ...) BASE_COMPARE(asm_, kRegexString, __VA_ARGS__) #define COMPARE_REGEX(asm_, ...) BASE_COMPARE(asm_, kRegexString, __VA_ARGS__)
// Force emission of any pending literals into a pool. // Force emission of any pending literals into a pool.
#define EMIT_PENDING_LITERALS() \ #define EMIT_PENDING_LITERALS() assm.CheckConstPool(true, false)
assm.CheckConstPool(true, false)
// Verify that all invocations of the COMPARE macro passed successfully. // Verify that all invocations of the COMPARE macro passed successfully.
// Exit with a failure if at least one of the tests failed. // Exit with a failure if at least one of the tests failed.
...@@ -149,7 +148,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex, ...@@ -149,7 +148,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex,
// clang-format off // clang-format off
TEST(Type0) { TEST_F(DisasmArmTest, Type0) {
SET_UP(); SET_UP();
COMPARE(and_(r0, r1, Operand(r2)), COMPARE(and_(r0, r1, Operand(r2)),
...@@ -382,7 +381,7 @@ TEST(Type0) { ...@@ -382,7 +381,7 @@ TEST(Type0) {
} }
TEST(Type1) { TEST_F(DisasmArmTest, Type1) {
SET_UP(); SET_UP();
COMPARE(and_(r0, r1, Operand(0x00000000)), COMPARE(and_(r0, r1, Operand(0x00000000)),
...@@ -411,7 +410,7 @@ TEST(Type1) { ...@@ -411,7 +410,7 @@ TEST(Type1) {
} }
TEST(Type3) { TEST_F(DisasmArmTest, Type3) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv7)) { if (CpuFeatures::IsSupported(ARMv7)) {
...@@ -509,7 +508,7 @@ TEST(Type3) { ...@@ -509,7 +508,7 @@ TEST(Type3) {
} }
TEST(msr_mrs_disasm) { TEST_F(DisasmArmTest, msr_mrs_disasm) {
SET_UP(); SET_UP();
SRegisterFieldMask CPSR_all = CPSR_f | CPSR_s | CPSR_x | CPSR_c; SRegisterFieldMask CPSR_all = CPSR_f | CPSR_s | CPSR_x | CPSR_c;
...@@ -558,7 +557,7 @@ TEST(msr_mrs_disasm) { ...@@ -558,7 +557,7 @@ TEST(msr_mrs_disasm) {
} }
TEST(Vfp) { TEST_F(DisasmArmTest, Vfp) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(VFPv3)) { if (CpuFeatures::IsSupported(VFPv3)) {
...@@ -897,7 +896,7 @@ TEST(Vfp) { ...@@ -897,7 +896,7 @@ TEST(Vfp) {
} }
TEST(ARMv8_vrintX_disasm) { TEST_F(DisasmArmTest, ARMv8_vrintX_disasm) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv8)) { if (CpuFeatures::IsSupported(ARMv8)) {
...@@ -928,7 +927,7 @@ TEST(ARMv8_vrintX_disasm) { ...@@ -928,7 +927,7 @@ TEST(ARMv8_vrintX_disasm) {
} }
TEST(ARMv8_vminmax_disasm) { TEST_F(DisasmArmTest, ARMv8_vminmax_disasm) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv8)) { if (CpuFeatures::IsSupported(ARMv8)) {
...@@ -943,7 +942,7 @@ TEST(ARMv8_vminmax_disasm) { ...@@ -943,7 +942,7 @@ TEST(ARMv8_vminmax_disasm) {
} }
TEST(ARMv8_vselX_disasm) { TEST_F(DisasmArmTest, ARMv8_vselX_disasm) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv8)) { if (CpuFeatures::IsSupported(ARMv8)) {
...@@ -989,7 +988,7 @@ TEST(ARMv8_vselX_disasm) { ...@@ -989,7 +988,7 @@ TEST(ARMv8_vselX_disasm) {
} }
TEST(Neon) { TEST_F(DisasmArmTest, Neon) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(NEON)) { if (CpuFeatures::IsSupported(NEON)) {
...@@ -1376,7 +1375,7 @@ TEST(Neon) { ...@@ -1376,7 +1375,7 @@ TEST(Neon) {
} }
TEST(LoadStore) { TEST_F(DisasmArmTest, LoadStore) {
SET_UP(); SET_UP();
COMPARE(ldrb(r0, MemOperand(r1)), COMPARE(ldrb(r0, MemOperand(r1)),
...@@ -1642,7 +1641,7 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure, ...@@ -1642,7 +1641,7 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
} }
TEST(LoadLiteral) { TEST_F(DisasmArmTest,LoadLiteral) {
SET_UP(); SET_UP();
TestLoadLiteral(buffer, &assm, &failure, 0); TestLoadLiteral(buffer, &assm, &failure, 0);
...@@ -1657,7 +1656,7 @@ TEST(LoadLiteral) { ...@@ -1657,7 +1656,7 @@ TEST(LoadLiteral) {
} }
TEST(Barrier) { TEST_F(DisasmArmTest, Barrier) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv7)) { if (CpuFeatures::IsSupported(ARMv7)) {
...@@ -1725,7 +1724,7 @@ TEST(Barrier) { ...@@ -1725,7 +1724,7 @@ TEST(Barrier) {
} }
TEST(LoadStoreExclusive) { TEST_F(DisasmArmTest, LoadStoreExclusive) {
SET_UP(); SET_UP();
COMPARE(ldrexb(r0, r1), "e1d10f9f ldrexb r0, [r1]"); COMPARE(ldrexb(r0, r1), "e1d10f9f ldrexb r0, [r1]");
...@@ -1741,7 +1740,7 @@ TEST(LoadStoreExclusive) { ...@@ -1741,7 +1740,7 @@ TEST(LoadStoreExclusive) {
VERIFY_RUN(); VERIFY_RUN();
} }
TEST(SplitAddImmediate) { TEST_F(DisasmArmTest, SplitAddImmediate) {
SET_UP(); SET_UP();
if (CpuFeatures::IsSupported(ARMv7)) { if (CpuFeatures::IsSupported(ARMv7)) {
......
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