Commit 26cb6b92 authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[test] Move cctest/test-disasm-ia32 to test/unittests/

... disasm-ia32-unittest.

Bug: v8:12781
Change-Id: I7291ac23571ecb5564053ba97746c8d18fd615e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3675900Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#80797}
parent 26694183
...@@ -286,7 +286,6 @@ v8_source_set("cctest_sources") { ...@@ -286,7 +286,6 @@ v8_source_set("cctest_sources") {
} else if (v8_current_cpu == "x86") { } else if (v8_current_cpu == "x86") {
sources += [ ### gcmole(arch:ia32) ### sources += [ ### gcmole(arch:ia32) ###
"test-assembler-ia32.cc", "test-assembler-ia32.cc",
"test-disasm-ia32.cc",
"test-log-stack-tracer.cc", "test-log-stack-tracer.cc",
] ]
} else if (v8_current_cpu == "mips") { } else if (v8_current_cpu == "mips") {
......
...@@ -501,6 +501,7 @@ v8_source_set("unittests_sources") { ...@@ -501,6 +501,7 @@ v8_source_set("unittests_sources") {
] ]
} else if (v8_current_cpu == "x86") { } else if (v8_current_cpu == "x86") {
sources += [ sources += [
"assembler/disasm-ia32-unittest.cc",
"assembler/turbo-assembler-ia32-unittest.cc", "assembler/turbo-assembler-ia32-unittest.cc",
"compiler/ia32/instruction-selector-ia32-unittest.cc", "compiler/ia32/instruction-selector-ia32-unittest.cc",
] ]
......
...@@ -27,28 +27,28 @@ ...@@ -27,28 +27,28 @@
#include <stdlib.h> #include <stdlib.h>
#include "src/init/v8.h"
#include "src/codegen/code-factory.h" #include "src/codegen/code-factory.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 "src/init/v8.h"
#include "src/utils/ostreams.h" #include "src/utils/ostreams.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 DisasmIa320Test = TestWithIsolate;
#define __ assm. #define __ assm.
static void DummyStaticFunction(Object result) {} static void DummyStaticFunction(Object result) {}
TEST(DisasmIa320) { TEST_F(DisasmIa320Test, DisasmIa320) {
CcTest::InitializeVM(); HandleScope scope(isolate());
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
v8::internal::byte buffer[8192]; v8::internal::byte buffer[8192];
Assembler assm(AssemblerOptions{}, Assembler assm(AssemblerOptions{},
ExternalAssemblerBuffer(buffer, sizeof buffer)); ExternalAssemblerBuffer(buffer, sizeof buffer));
...@@ -60,7 +60,7 @@ TEST(DisasmIa320) { ...@@ -60,7 +60,7 @@ TEST(DisasmIa320) {
__ xor_(eax, 12345678); __ xor_(eax, 12345678);
__ and_(eax, 12345678); __ and_(eax, 12345678);
Handle<FixedArray> foo = Handle<FixedArray> foo =
isolate->factory()->NewFixedArray(10, AllocationType::kOld); isolate()->factory()->NewFixedArray(10, AllocationType::kOld);
__ cmp(eax, foo); __ cmp(eax, foo);
// ---- This one caused crash // ---- This one caused crash
...@@ -106,7 +106,7 @@ TEST(DisasmIa320) { ...@@ -106,7 +106,7 @@ TEST(DisasmIa320) {
__ cmp(edx, Operand(esp, 4)); __ cmp(edx, Operand(esp, 4));
__ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000)); __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000));
Handle<FixedArray> foo2 = Handle<FixedArray> foo2 =
isolate->factory()->NewFixedArray(10, AllocationType::kOld); isolate()->factory()->NewFixedArray(10, AllocationType::kOld);
__ cmp(ebx, foo2); __ cmp(ebx, foo2);
__ cmpb(ebx, Operand(ebp, ecx, times_2, 0)); __ cmpb(ebx, Operand(ebp, ecx, times_2, 0));
__ cmpb(Operand(ebp, ecx, times_2, 0), ebx); __ cmpb(Operand(ebp, ecx, times_2, 0), ebx);
...@@ -232,7 +232,6 @@ TEST(DisasmIa320) { ...@@ -232,7 +232,6 @@ TEST(DisasmIa320) {
__ shr(Operand(ebx, ecx, times_4, 10000), 6); __ shr(Operand(ebx, ecx, times_4, 10000), 6);
__ shr_cl(Operand(ebx, ecx, times_4, 10000)); __ shr_cl(Operand(ebx, ecx, times_4, 10000));
// Immediates // Immediates
__ adc(edx, 12345); __ adc(edx, 12345);
...@@ -291,7 +290,7 @@ TEST(DisasmIa320) { ...@@ -291,7 +290,7 @@ TEST(DisasmIa320) {
__ bind(&L2); __ bind(&L2);
__ call(Operand(ebx, ecx, times_4, 10000)); __ call(Operand(ebx, ecx, times_4, 10000));
__ nop(); __ nop();
Handle<Code> ic = BUILTIN_CODE(isolate, ArrayFrom); Handle<Code> ic = BUILTIN_CODE(isolate(), ArrayFrom);
__ call(ic, RelocInfo::CODE_TARGET); __ call(ic, RelocInfo::CODE_TARGET);
__ nop(); __ nop();
__ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY); __ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY);
...@@ -302,7 +301,6 @@ TEST(DisasmIa320) { ...@@ -302,7 +301,6 @@ TEST(DisasmIa320) {
__ jmp(ic, RelocInfo::CODE_TARGET); __ jmp(ic, RelocInfo::CODE_TARGET);
__ nop(); __ nop();
Label Ljcc; Label Ljcc;
__ nop(); __ nop();
// long jumps // long jumps
...@@ -987,9 +985,9 @@ TEST(DisasmIa320) { ...@@ -987,9 +985,9 @@ TEST(DisasmIa320) {
__ ret(0); __ ret(0);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::FOR_TESTING).Build(); Factory::CodeBuilder(isolate(), desc, CodeKind::FOR_TESTING).Build();
USE(code); USE(code);
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
......
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