Commit 3ebdddeb authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[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/+/3676639Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#80835}
parent 1d2a4903
...@@ -312,10 +312,7 @@ v8_source_set("cctest_sources") { ...@@ -312,10 +312,7 @@ v8_source_set("cctest_sources") {
sources += [ "test-stack-unwinding-win64.cc" ] sources += [ "test-stack-unwinding-win64.cc" ]
} }
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") { } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ ### gcmole(arch:ppc) ### sources += [ "test-assembler-ppc.cc" ] ### gcmole(arch:ppc) ###
"test-assembler-ppc.cc",
"test-disasm-ppc.cc",
]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [ "test-assembler-s390.cc" ] ### gcmole(arch:s390) ### sources += [ "test-assembler-s390.cc" ] ### gcmole(arch:s390) ###
} else if (v8_current_cpu == "riscv64") { } else if (v8_current_cpu == "riscv64") {
......
...@@ -541,6 +541,7 @@ v8_source_set("unittests_sources") { ...@@ -541,6 +541,7 @@ v8_source_set("unittests_sources") {
} }
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") { } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ sources += [
"assembler/disasm-ppc-unittest.cc",
"assembler/turbo-assembler-ppc-unittest.cc", "assembler/turbo-assembler-ppc-unittest.cc",
"compiler/ppc/instruction-selector-ppc-unittest.cc", "compiler/ppc/instruction-selector-ppc-unittest.cc",
] ]
......
...@@ -28,18 +28,20 @@ ...@@ -28,18 +28,20 @@
#include <stdlib.h> #include <stdlib.h>
#include "src/init/v8.h"
#include "src/codegen/macro-assembler.h" #include "src/codegen/macro-assembler.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/diagnostics/disasm.h" #include "src/diagnostics/disasm.h"
#include "src/diagnostics/disassembler.h" #include "src/diagnostics/disassembler.h"
#include "src/execution/frames-inl.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 v8 {
namespace internal { namespace internal {
using DisasmPpcTest = TestWithIsolate;
bool DisassembleAndCompare(byte* pc, const char* compare_string) { bool DisassembleAndCompare(byte* pc, const char* compare_string) {
disasm::NameConverter converter; disasm::NameConverter converter;
disasm::Disassembler disasm(converter); disasm::Disassembler disasm(converter);
...@@ -59,14 +61,11 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) { ...@@ -59,14 +61,11 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
return true; return true;
} }
// Set up V8 to a state where we can at least run the assembler and // 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 // 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)); \
...@@ -87,7 +86,6 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) { ...@@ -87,7 +86,6 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
// Force emission of any pending literals into a pool. // Force emission of any pending literals into a pool.
#define EMIT_PENDING_LITERALS() assm.CheckConstPool(true, false) #define EMIT_PENDING_LITERALS() 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.
#define VERIFY_RUN() \ #define VERIFY_RUN() \
...@@ -95,7 +93,7 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) { ...@@ -95,7 +93,7 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
FATAL("PPC Disassembler tests failed.\n"); \ FATAL("PPC Disassembler tests failed.\n"); \
} }
TEST(DisasmPPC) { TEST_F(DisasmPpcTest, DisasmPPC) {
SET_UP(); SET_UP();
COMPARE(addc(r9, r7, r9), "7d274814 addc r9, r7, r9"); COMPARE(addc(r9, r7, r9), "7d274814 addc r9, r7, r9");
......
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