PPC/s390: [assembler] Remove legacy constructor

Port edfb8cadd0

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/1417950
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#58896}
This commit is contained in:
Junliang Yan 2019-01-17 11:31:05 -05:00 committed by Commit Bot
parent aac8b6e348
commit b7205f462f
6 changed files with 19 additions and 42 deletions

View File

@ -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

View File

@ -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),

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -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