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

... disasm-pcc-unittest.

Bug: v8:12781
Change-Id: I239c5101a0b978b0b824bac8e31a6e62b3e7e836
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3676639
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#80835}
This commit is contained in:
jameslahm 2022-05-31 08:57:25 +08:00 committed by V8 LUCI CQ
parent 1d2a4903d4
commit 3ebdddeb66
3 changed files with 10 additions and 14 deletions

View File

@ -312,10 +312,7 @@ v8_source_set("cctest_sources") {
sources += [ "test-stack-unwinding-win64.cc" ]
}
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ ### gcmole(arch:ppc) ###
"test-assembler-ppc.cc",
"test-disasm-ppc.cc",
]
sources += [ "test-assembler-ppc.cc" ] ### gcmole(arch:ppc) ###
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [ "test-assembler-s390.cc" ] ### gcmole(arch:s390) ###
} else if (v8_current_cpu == "riscv64") {

View File

@ -541,6 +541,7 @@ v8_source_set("unittests_sources") {
}
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [
"assembler/disasm-ppc-unittest.cc",
"assembler/turbo-assembler-ppc-unittest.cc",
"compiler/ppc/instruction-selector-ppc-unittest.cc",
]

View File

@ -28,18 +28,20 @@
#include <stdlib.h>
#include "src/init/v8.h"
#include "src/codegen/macro-assembler.h"
#include "src/debug/debug.h"
#include "src/diagnostics/disasm.h"
#include "src/diagnostics/disassembler.h"
#include "src/execution/frames-inl.h"
#include "test/cctest/cctest.h"
#include "src/init/v8.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
using DisasmPpcTest = TestWithIsolate;
bool DisassembleAndCompare(byte* pc, const char* compare_string) {
disasm::NameConverter converter;
disasm::Disassembler disasm(converter);
@ -59,14 +61,11 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
return true;
}
// Set up V8 to a state where we can at least run the assembler and
// disassembler. Declare the variables and allocate the data structures used
// in the rest of the macros.
#define SET_UP() \
CcTest::InitializeVM(); \
Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \
#define SET_UP() \
HandleScope scope(isolate()); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, \
ExternalAssemblerBuffer(buffer, 4 * 1024)); \
@ -87,7 +86,6 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
// Force emission of any pending literals into a pool.
#define EMIT_PENDING_LITERALS() assm.CheckConstPool(true, false)
// Verify that all invocations of the COMPARE macro passed successfully.
// Exit with a failure if at least one of the tests failed.
#define VERIFY_RUN() \
@ -95,7 +93,7 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
FATAL("PPC Disassembler tests failed.\n"); \
}
TEST(DisasmPPC) {
TEST_F(DisasmPpcTest, DisasmPPC) {
SET_UP();
COMPARE(addc(r9, r7, r9), "7d274814 addc r9, r7, r9");