Commit 30617b77 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: Use forwarding constructors for MacroAssembler

Port edab9a20

Original Commit Message:

    and TurboAssembler. Instead of listing all the different combinations
    of arguments (which is one more now, temporarily), just forward all
    arguments down via MacroAssembler and TurboAssembler to
    TurboAssemblerBase.
    Interestingly, this requires more specific types sometimes (int instead
    of size_t), since further down the forwarding chain, the compiler does
    not recognize any more that the value is a constant, and emits a
    warning about a possibly truncating implicit conversion.

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

Change-Id: I6dddc58b81d020570087393158f4ad0f37efa9ce
Reviewed-on: https://chromium-review.googlesource.com/c/1417379Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#58889}
parent 4108304f
......@@ -199,10 +199,7 @@ class Assembler : public AssemblerBase {
// 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, buffer ? ExternalAssemblerBuffer(buffer, buffer_size)
: NewAssemblerBuffer(
buffer_size ? buffer_size
: kMinimalBufferSize)) {}
: Assembler(options, GetBuffer(buffer, buffer_size)) {}
virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor
......
......@@ -32,11 +32,6 @@
namespace v8 {
namespace internal {
MacroAssembler::MacroAssembler(Isolate* isolate,
const AssemblerOptions& options, void* buffer,
int size, CodeObjectRequired create_code_object)
: TurboAssembler(isolate, options, buffer, size, create_code_object) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,
......
......@@ -68,14 +68,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
TurboAssembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: TurboAssemblerBase(options, buffer, buffer_size) {}
TurboAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: TurboAssemblerBase(isolate, options, buffer, buffer_size,
create_code_object) {}
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
// Converts the integer (untagged smi) in |src| to a double, storing
// the result to |dst|
......@@ -647,16 +642,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used acros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
MacroAssembler(const AssemblerOptions& options, void* buffer, int size)
: TurboAssembler(options, buffer, size) {}
MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: MacroAssembler(isolate, AssemblerOptions::Default(isolate), buffer,
size, create_code_object) {}
MacroAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int size, CodeObjectRequired create_code_object);
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
// ---------------------------------------------------------------------------
// GC Support
......
......@@ -91,6 +91,8 @@ namespace internal {
#define __ ACCESS_MASM(masm_)
const int RegExpMacroAssemblerPPC::kRegExpCodeSize;
RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone,
Mode mode,
int registers_to_save)
......
......@@ -117,7 +117,7 @@ class RegExpMacroAssemblerPPC : public NativeRegExpMacroAssembler {
static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
// Initial size of code buffer.
static const size_t kRegExpCodeSize = 1024;
static const int kRegExpCodeSize = 1024;
// Load a number of characters at the given offset from the
// current position, into the current-character register.
......
......@@ -93,6 +93,8 @@ namespace internal {
#define __ ACCESS_MASM(masm_)
const int RegExpMacroAssemblerS390::kRegExpCodeSize;
RegExpMacroAssemblerS390::RegExpMacroAssemblerS390(Isolate* isolate, Zone* zone,
Mode mode,
int registers_to_save)
......
......@@ -117,7 +117,7 @@ class RegExpMacroAssemblerS390 : public NativeRegExpMacroAssembler {
static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
// Initial size of code buffer.
static const size_t kRegExpCodeSize = 1024;
static const int kRegExpCodeSize = 1024;
// Load a number of characters at the given offset from the
// current position, into the current-character register.
......
......@@ -238,10 +238,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// 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, buffer ? ExternalAssemblerBuffer(buffer, buffer_size)
: NewAssemblerBuffer(
buffer_size ? buffer_size
: kMinimalBufferSize)) {}
: Assembler(options, GetBuffer(buffer, buffer_size)) {}
virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor
......
......@@ -33,11 +33,6 @@
namespace v8 {
namespace internal {
MacroAssembler::MacroAssembler(Isolate* isolate,
const AssemblerOptions& options, void* buffer,
int size, CodeObjectRequired create_code_object)
: TurboAssembler(isolate, options, buffer, size, create_code_object) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,
......
......@@ -126,14 +126,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
TurboAssembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: TurboAssemblerBase(options, buffer, buffer_size) {}
TurboAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: TurboAssemblerBase(isolate, options, buffer, buffer_size,
create_code_object) {}
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
void LoadFromConstantsTable(Register destination,
int constant_index) override;
......@@ -1006,16 +1001,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
MacroAssembler(const AssemblerOptions& options, void* buffer, int size)
: TurboAssembler(options, buffer, size) {}
MacroAssembler(Isolate* isolate, void* buffer, int size,
CodeObjectRequired create_code_object)
: MacroAssembler(isolate, AssemblerOptions::Default(isolate), buffer,
size, create_code_object) {}
MacroAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int size, CodeObjectRequired create_code_object);
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
void CallRuntime(const Runtime::Function* f, int num_arguments,
SaveFPRegsMode save_doubles = kDontSaveFPRegs);
......
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