Commit 3ed8675b authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [test] Refactor AllocateAssemblerBuffer

Port 1a1f4e1e

Original Commit Message:

    Refactor the AllocateAssemblerBuffer helper for the new Assembler API.
    This is the only non-mechanical part, all other callsites that create
    Assembler instances can be trivially changed to the new API. This will
    be done in a separate CL.

R=clemensh@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I8e22f8c2b6c2b1b9158969d28d4edf291a84bcf0
Reviewed-on: https://chromium-review.googlesource.com/c/1416952
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#58897}
parent b7205f46
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "src/ppc/assembler-ppc-inl.h" #include "src/ppc/assembler-ppc-inl.h"
#include "src/simulator.h" #include "src/simulator.h"
#include "test/cctest/cctest.h" #include "test/cctest/cctest.h"
#include "test/common/assembler-tester.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -52,7 +53,7 @@ TEST(0) { ...@@ -52,7 +53,7 @@ TEST(0) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
__ function_descriptor(); __ function_descriptor();
...@@ -79,7 +80,7 @@ TEST(1) { ...@@ -79,7 +80,7 @@ TEST(1) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
__ function_descriptor(); __ function_descriptor();
...@@ -116,7 +117,7 @@ TEST(2) { ...@@ -116,7 +117,7 @@ TEST(2) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
__ function_descriptor(); __ function_descriptor();
...@@ -173,7 +174,7 @@ TEST(3) { ...@@ -173,7 +174,7 @@ TEST(3) {
} T; } T;
T t; T t;
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
__ function_descriptor(); __ function_descriptor();
...@@ -264,7 +265,7 @@ TEST(4) { ...@@ -264,7 +265,7 @@ TEST(4) {
// Create a function that accepts &t, and loads, manipulates, and stores // Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats. // the doubles and floats.
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
if (CpuFeatures::IsSupported(VFP3)) { if (CpuFeatures::IsSupported(VFP3)) {
...@@ -379,7 +380,7 @@ TEST(5) { ...@@ -379,7 +380,7 @@ TEST(5) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(ARMv7)) { if (CpuFeatures::IsSupported(ARMv7)) {
CpuFeatures::Scope scope(ARMv7); CpuFeatures::Scope scope(ARMv7);
...@@ -415,7 +416,7 @@ TEST(6) { ...@@ -415,7 +416,7 @@ TEST(6) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(ARMv7)) { if (CpuFeatures::IsSupported(ARMv7)) {
CpuFeatures::Scope scope(ARMv7); CpuFeatures::Scope scope(ARMv7);
...@@ -457,7 +458,7 @@ static void TestRoundingMode(VCVTTypes types, ...@@ -457,7 +458,7 @@ static void TestRoundingMode(VCVTTypes types,
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(VFP3)) { if (CpuFeatures::IsSupported(VFP3)) {
CpuFeatures::Scope scope(VFP3); CpuFeatures::Scope scope(VFP3);
...@@ -661,7 +662,7 @@ TEST(8) { ...@@ -661,7 +662,7 @@ TEST(8) {
// Create a function that uses vldm/vstm to move some double and // Create a function that uses vldm/vstm to move some double and
// single precision values around in memory. // single precision values around in memory.
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(VFP2)) { if (CpuFeatures::IsSupported(VFP2)) {
CpuFeatures::Scope scope(VFP2); CpuFeatures::Scope scope(VFP2);
...@@ -772,7 +773,7 @@ TEST(9) { ...@@ -772,7 +773,7 @@ TEST(9) {
// Create a function that uses vldm/vstm to move some double and // Create a function that uses vldm/vstm to move some double and
// single precision values around in memory. // single precision values around in memory.
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(VFP2)) { if (CpuFeatures::IsSupported(VFP2)) {
CpuFeatures::Scope scope(VFP2); CpuFeatures::Scope scope(VFP2);
...@@ -887,7 +888,7 @@ TEST(10) { ...@@ -887,7 +888,7 @@ TEST(10) {
// Create a function that uses vldm/vstm to move some double and // Create a function that uses vldm/vstm to move some double and
// single precision values around in memory. // single precision values around in memory.
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
if (CpuFeatures::IsSupported(VFP2)) { if (CpuFeatures::IsSupported(VFP2)) {
CpuFeatures::Scope scope(VFP2); CpuFeatures::Scope scope(VFP2);
...@@ -983,7 +984,7 @@ TEST(11) { ...@@ -983,7 +984,7 @@ TEST(11) {
i.a = 0xABCD0001; i.a = 0xABCD0001;
i.b = 0xABCD0000; i.b = 0xABCD0000;
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
// Test HeapObject untagging. // Test HeapObject untagging.
__ ldr(r1, MemOperand(r0, offsetof(I, a))); __ ldr(r1, MemOperand(r0, offsetof(I, a)));
...@@ -1037,7 +1038,7 @@ TEST(12) { ...@@ -1037,7 +1038,7 @@ TEST(12) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label target; Label target;
__ b(eq, &target); __ b(eq, &target);
__ b(ne, &target); __ b(ne, &target);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "src/s390/assembler-s390-inl.h" #include "src/s390/assembler-s390-inl.h"
#include "src/simulator.h" #include "src/simulator.h"
#include "test/cctest/cctest.h" #include "test/cctest/cctest.h"
#include "test/common/assembler-tester.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -52,7 +53,7 @@ TEST(0) { ...@@ -52,7 +53,7 @@ TEST(0) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
__ lhi(r1, Operand(3)); // test 4-byte instr __ lhi(r1, Operand(3)); // test 4-byte instr
__ llilf(r2, Operand(4)); // test 6-byte instr __ llilf(r2, Operand(4)); // test 6-byte instr
...@@ -79,7 +80,7 @@ TEST(1) { ...@@ -79,7 +80,7 @@ TEST(1) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
#if defined(_AIX) #if defined(_AIX)
...@@ -119,7 +120,7 @@ TEST(2) { ...@@ -119,7 +120,7 @@ TEST(2) {
// Create a function that accepts &t, and loads, manipulates, and stores // Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats. // the doubles and floats.
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L, C; Label L, C;
#if defined(_AIX) #if defined(_AIX)
...@@ -168,7 +169,7 @@ TEST(3) { ...@@ -168,7 +169,7 @@ TEST(3) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
__ ar(r14, r13); __ ar(r14, r13);
__ sr(r14, r13); __ sr(r14, r13);
...@@ -222,7 +223,7 @@ TEST(4) { ...@@ -222,7 +223,7 @@ TEST(4) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label L2, L3, L4; Label L2, L3, L4;
__ chi(r2, Operand(10)); __ chi(r2, Operand(10));
...@@ -267,7 +268,7 @@ TEST(5) { ...@@ -267,7 +268,7 @@ TEST(5) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
MacroAssembler assm(isolate, nullptr, 0); Assembler assm(AssemblerOptions{});
__ mov(r2, Operand(0x12345678)); __ mov(r2, Operand(0x12345678));
__ ExtractBitRange(r3, r2, 3, 2); __ ExtractBitRange(r3, r2, 3, 2);
...@@ -295,7 +296,7 @@ TEST(6) { ...@@ -295,7 +296,7 @@ TEST(6) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
MacroAssembler assm(isolate, nullptr, 0); Assembler assm(AssemblerOptions{});
Label yes; Label yes;
...@@ -329,7 +330,7 @@ TEST(7) { ...@@ -329,7 +330,7 @@ TEST(7) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
MacroAssembler assm(isolate, nullptr, 0); Assembler assm(AssemblerOptions{});
Label yes; Label yes;
...@@ -361,7 +362,7 @@ TEST(8) { ...@@ -361,7 +362,7 @@ TEST(8) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
MacroAssembler assm(isolate, nullptr, 0); Assembler assm(AssemblerOptions{});
// Zero upper bits of r3/r4 // Zero upper bits of r3/r4
__ llihf(r3, Operand::Zero()); __ llihf(r3, Operand::Zero());
...@@ -393,7 +394,7 @@ TEST(9) { ...@@ -393,7 +394,7 @@ TEST(9) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
MacroAssembler assm(isolate, nullptr, 0); Assembler assm(AssemblerOptions{});
__ lzdr(d4); __ lzdr(d4);
__ b(r14); __ b(r14);
...@@ -424,7 +425,7 @@ TEST(10) { ...@@ -424,7 +425,7 @@ TEST(10) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label ok, failed; Label ok, failed;
...@@ -502,7 +503,7 @@ TEST(11) { ...@@ -502,7 +503,7 @@ TEST(11) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label ok, failed, continue1, continue2; Label ok, failed, continue1, continue2;
// r1 - operand; r3 - inc / test val // r1 - operand; r3 - inc / test val
...@@ -556,7 +557,7 @@ TEST(12) { ...@@ -556,7 +557,7 @@ TEST(12) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Assembler assm(AssemblerOptions{}, nullptr, 0); Assembler assm(AssemblerOptions{});
Label ok, failed, continue1, continue2; Label ok, failed, continue1, continue2;
// r1 - operand; r3 - inc / test val // r1 - operand; r3 - inc / test val
......
...@@ -35,7 +35,7 @@ TEST_F(TurboAssemblerTest, TestHardAbort) { ...@@ -35,7 +35,7 @@ TEST_F(TurboAssemblerTest, TestHardAbort) {
tasm.GetCode(nullptr, &desc); tasm.GetCode(nullptr, &desc);
buffer->MakeExecutable(); buffer->MakeExecutable();
// We need an isolate here to execute in the simulator. // We need an isolate here to execute in the simulator.
auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer); auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer->start());
ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason"); ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
} }
...@@ -59,7 +59,7 @@ TEST_F(TurboAssemblerTest, TestCheck) { ...@@ -59,7 +59,7 @@ TEST_F(TurboAssemblerTest, TestCheck) {
tasm.GetCode(nullptr, &desc); tasm.GetCode(nullptr, &desc);
buffer->MakeExecutable(); buffer->MakeExecutable();
// We need an isolate here to execute in the simulator. // We need an isolate here to execute in the simulator.
auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer); auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer->start());
f.Call(0); f.Call(0);
f.Call(18); f.Call(18);
......
...@@ -32,7 +32,7 @@ TEST_F(TurboAssemblerTest, TestHardAbort) { ...@@ -32,7 +32,7 @@ TEST_F(TurboAssemblerTest, TestHardAbort) {
tasm.GetCode(nullptr, &desc); tasm.GetCode(nullptr, &desc);
buffer->MakeExecutable(); buffer->MakeExecutable();
// We need an isolate here to execute in the simulator. // We need an isolate here to execute in the simulator.
auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer); auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer->start());
ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason"); ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
} }
...@@ -53,7 +53,7 @@ TEST_F(TurboAssemblerTest, TestCheck) { ...@@ -53,7 +53,7 @@ TEST_F(TurboAssemblerTest, TestCheck) {
tasm.GetCode(nullptr, &desc); tasm.GetCode(nullptr, &desc);
buffer->MakeExecutable(); buffer->MakeExecutable();
// We need an isolate here to execute in the simulator. // We need an isolate here to execute in the simulator.
auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer); auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer->start());
f.Call(0); f.Call(0);
f.Call(18); f.Call(18);
......
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