Commit b7205f46 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [assembler] Remove legacy constructor

Port edfb8cad

Original Commit Message:

    Refactor all call sites to use the new API introduced in
    https://crrev.com/c/1411347 and remove the legacy constructors.

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

Change-Id: I5fea49f4d969edede114101314763d245e9a1fa1
Reviewed-on: https://chromium-review.googlesource.com/c/1417950Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#58896}
parent aac8b6e3
......@@ -185,21 +185,6 @@ class Assembler : public AssemblerBase {
explicit Assembler(const AssemblerOptions&,
std::unique_ptr<AssemblerBuffer> = {});
// Legacy constructor.
// If the provided buffer is nullptr, the assembler allocates and grows its
// own buffer, and buffer_size determines the initial buffer size. The buffer
// is owned by the assembler and deallocated upon destruction of the
// assembler.
//
// If the provided buffer is not nullptr, the assembler uses the provided
// buffer for code generation and assumes its size to be buffer_size. If the
// buffer is too small, a fatal error occurs. No deallocation of the buffer is
// done upon destruction of the assembler.
//
// TODO(clemensh): Remove this constructor, refactor all call sites to use the
// one above.
Assembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: Assembler(options, GetBuffer(buffer, buffer_size)) {}
virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor
......
......@@ -97,8 +97,8 @@ RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone,
Mode mode,
int registers_to_save)
: NativeRegExpMacroAssembler(isolate, zone),
masm_(new MacroAssembler(isolate, nullptr, kRegExpCodeSize,
CodeObjectRequired::kYes)),
masm_(new MacroAssembler(isolate, CodeObjectRequired::kYes,
NewAssemblerBuffer(kRegExpCodeSize))),
mode_(mode),
num_registers_(registers_to_save),
num_saved_registers_(registers_to_save),
......
......@@ -99,8 +99,8 @@ RegExpMacroAssemblerS390::RegExpMacroAssemblerS390(Isolate* isolate, Zone* zone,
Mode mode,
int registers_to_save)
: NativeRegExpMacroAssembler(isolate, zone),
masm_(new MacroAssembler(isolate, nullptr, kRegExpCodeSize,
CodeObjectRequired::kYes)),
masm_(new MacroAssembler(isolate, CodeObjectRequired::kYes,
NewAssemblerBuffer(kRegExpCodeSize))),
mode_(mode),
num_registers_(registers_to_save),
num_saved_registers_(registers_to_save),
......
......@@ -224,21 +224,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
explicit Assembler(const AssemblerOptions&,
std::unique_ptr<AssemblerBuffer> = {});
// Legacy constructor.
// If the provided buffer is nullptr, the assembler allocates and grows its
// own buffer, and buffer_size determines the initial buffer size. The buffer
// is owned by the assembler and deallocated upon destruction of the
// assembler.
//
// If the provided buffer is not nullptr, the assembler uses the provided
// buffer for code generation and assumes its size to be buffer_size. If the
// buffer is too small, a fatal error occurs. No deallocation of the buffer is
// done upon destruction of the assembler.
//
// TODO(clemensh): Remove this constructor, refactor all call sites to use the
// one above.
Assembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: Assembler(options, GetBuffer(buffer, buffer_size)) {}
virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor
......
......@@ -67,8 +67,9 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
CcTest::InitializeVM(); \
Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, buffer, 4 * 1024); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, \
ExternalAssemblerBuffer(buffer, 4 * 1024)); \
bool failure = false;
// This macro assembles one instruction using the preallocated assembler and
......
......@@ -62,12 +62,13 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
// 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); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, buffer, 4 * 1024); \
#define SET_UP() \
CcTest::InitializeVM(); \
Isolate* isolate = CcTest::i_isolate(); \
HandleScope scope(isolate); \
byte* buffer = reinterpret_cast<byte*>(malloc(4 * 1024)); \
Assembler assm(AssemblerOptions{}, \
ExternalAssemblerBuffer(buffer, 4 * 1024)); \
bool failure = false;
// This macro assembles one instruction using the preallocated assembler and
......@@ -298,5 +299,10 @@ TEST(SixBytes) {
VERIFY_RUN();
}
#undef SET_UP
#undef COMPARE
#undef EMIT_PENDING_LITERALS
#undef VERIFY_RUN
} // namespace internal
} // namespace v8
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