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 { ...@@ -199,10 +199,7 @@ class Assembler : public AssemblerBase {
// TODO(clemensh): Remove this constructor, refactor all call sites to use the // TODO(clemensh): Remove this constructor, refactor all call sites to use the
// one above. // one above.
Assembler(const AssemblerOptions& options, void* buffer, int buffer_size) Assembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: Assembler(options, buffer ? ExternalAssemblerBuffer(buffer, buffer_size) : Assembler(options, GetBuffer(buffer, buffer_size)) {}
: NewAssemblerBuffer(
buffer_size ? buffer_size
: kMinimalBufferSize)) {}
virtual ~Assembler() {} virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
......
...@@ -32,11 +32,6 @@ ...@@ -32,11 +32,6 @@
namespace v8 { namespace v8 {
namespace internal { 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, int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1, Register exclusion1,
Register exclusion2, Register exclusion2,
......
...@@ -68,14 +68,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg, ...@@ -68,14 +68,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public: public:
TurboAssembler(const AssemblerOptions& options, void* buffer, int buffer_size) template <typename... Args>
: TurboAssemblerBase(options, buffer, buffer_size) {} explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
TurboAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: TurboAssemblerBase(isolate, options, buffer, buffer_size,
create_code_object) {}
// Converts the integer (untagged smi) in |src| to a double, storing // Converts the integer (untagged smi) in |src| to a double, storing
// the result to |dst| // the result to |dst|
...@@ -647,16 +642,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -647,16 +642,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used acros. // MacroAssembler implements a collection of frequently used acros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public: public:
MacroAssembler(const AssemblerOptions& options, void* buffer, int size) template <typename... Args>
: TurboAssembler(options, buffer, size) {} explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
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);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// GC Support // GC Support
......
...@@ -91,6 +91,8 @@ namespace internal { ...@@ -91,6 +91,8 @@ namespace internal {
#define __ ACCESS_MASM(masm_) #define __ ACCESS_MASM(masm_)
const int RegExpMacroAssemblerPPC::kRegExpCodeSize;
RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone, RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone,
Mode mode, Mode mode,
int registers_to_save) int registers_to_save)
......
...@@ -117,7 +117,7 @@ class RegExpMacroAssemblerPPC : public NativeRegExpMacroAssembler { ...@@ -117,7 +117,7 @@ class RegExpMacroAssemblerPPC : public NativeRegExpMacroAssembler {
static const int kRegisterZero = kStringStartMinusOne - kPointerSize; static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
// Initial size of code buffer. // 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 // Load a number of characters at the given offset from the
// current position, into the current-character register. // current position, into the current-character register.
......
...@@ -93,6 +93,8 @@ namespace internal { ...@@ -93,6 +93,8 @@ namespace internal {
#define __ ACCESS_MASM(masm_) #define __ ACCESS_MASM(masm_)
const int RegExpMacroAssemblerS390::kRegExpCodeSize;
RegExpMacroAssemblerS390::RegExpMacroAssemblerS390(Isolate* isolate, Zone* zone, RegExpMacroAssemblerS390::RegExpMacroAssemblerS390(Isolate* isolate, Zone* zone,
Mode mode, Mode mode,
int registers_to_save) int registers_to_save)
......
...@@ -117,7 +117,7 @@ class RegExpMacroAssemblerS390 : public NativeRegExpMacroAssembler { ...@@ -117,7 +117,7 @@ class RegExpMacroAssemblerS390 : public NativeRegExpMacroAssembler {
static const int kRegisterZero = kStringStartMinusOne - kPointerSize; static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
// Initial size of code buffer. // 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 // Load a number of characters at the given offset from the
// current position, into the current-character register. // current position, into the current-character register.
......
...@@ -238,10 +238,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -238,10 +238,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// TODO(clemensh): Remove this constructor, refactor all call sites to use the // TODO(clemensh): Remove this constructor, refactor all call sites to use the
// one above. // one above.
Assembler(const AssemblerOptions& options, void* buffer, int buffer_size) Assembler(const AssemblerOptions& options, void* buffer, int buffer_size)
: Assembler(options, buffer ? ExternalAssemblerBuffer(buffer, buffer_size) : Assembler(options, GetBuffer(buffer, buffer_size)) {}
: NewAssemblerBuffer(
buffer_size ? buffer_size
: kMinimalBufferSize)) {}
virtual ~Assembler() {} virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
......
...@@ -33,11 +33,6 @@ ...@@ -33,11 +33,6 @@
namespace v8 { namespace v8 {
namespace internal { 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, int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1, Register exclusion1,
Register exclusion2, Register exclusion2,
......
...@@ -126,14 +126,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg, ...@@ -126,14 +126,9 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public: public:
TurboAssembler(const AssemblerOptions& options, void* buffer, int buffer_size) template <typename... Args>
: TurboAssemblerBase(options, buffer, buffer_size) {} explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
TurboAssembler(Isolate* isolate, const AssemblerOptions& options,
void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: TurboAssemblerBase(isolate, options, buffer, buffer_size,
create_code_object) {}
void LoadFromConstantsTable(Register destination, void LoadFromConstantsTable(Register destination,
int constant_index) override; int constant_index) override;
...@@ -1006,16 +1001,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -1006,16 +1001,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros. // MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public: public:
MacroAssembler(const AssemblerOptions& options, void* buffer, int size) template <typename... Args>
: TurboAssembler(options, buffer, size) {} explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
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);
void CallRuntime(const Runtime::Function* f, int num_arguments, void CallRuntime(const Runtime::Function* f, int num_arguments,
SaveFPRegsMode save_doubles = kDontSaveFPRegs); 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