Skip to content

Commit

Permalink
Use inherited ctors for MacroAssembler and TurboAssembler
Browse files Browse the repository at this point in the history
instead of forwarding template constructors for these classes introduced in
edab9a2 commit.

TurboAssemblerBase constructors were declared as public to make the inherited
TurboAssembler, and MacroAssembler ctors also public.

This fixes Visual C++ 2017 compile error, when the template ctor in
TurboAssemblerBase class matches deleted copy ctor.

Bug: v8:8935
Change-Id: I1144a7025830c3a0ab86acaa8ea81def02d293b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1496977
Reviewed-by: Jakob Gruber <[email protected]>
Reviewed-by: Clemens Hammacher <[email protected]>
Commit-Queue: Jakob Gruber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#60114}
  • Loading branch information
pmed authored and Commit Bot committed Mar 8, 2019
1 parent 29633ef commit 03ce1d1
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 62 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Peter Rybin <[email protected]>
Peter Varga <[email protected]>
Peter Wong <[email protected]>
Paul Lind <[email protected]>
Pavel Medvedev <[email protected]>
PhistucK <[email protected]>
Qingyan Li <[email protected]>
Qiuyi Zhang <[email protected]>
Expand Down
8 changes: 2 additions & 6 deletions src/arm/macro-assembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ enum TargetAddressStorageMode {

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

// Activation support.
void EnterFrame(StackFrame::Type type,
Expand Down Expand Up @@ -550,9 +548,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

void Mls(Register dst, Register src1, Register src2, Register srcA,
Condition cond = al);
Expand Down
8 changes: 2 additions & 6 deletions src/arm64/macro-assembler-arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ enum PreShiftImmMode {

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

#if DEBUG
void set_allow_macro_instructions(bool value) {
Expand Down Expand Up @@ -1279,9 +1277,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {

class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

// Instruction set functions ------------------------------------------------
// Logical macros.
Expand Down
8 changes: 2 additions & 6 deletions src/ia32/macro-assembler-ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK };

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

void CheckPageFlag(Register object, Register scratch, int mask, Condition cc,
Label* condition_met,
Expand Down Expand Up @@ -430,9 +428,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

// Load a register with a long value as efficiently as possible.
void Set(Register dst, int32_t x) {
Expand Down
8 changes: 2 additions & 6 deletions src/mips/macro-assembler-mips.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ inline MemOperand CFunctionArgumentOperand(int index) {

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

// Activation support.
void EnterFrame(StackFrame::Type type);
Expand Down Expand Up @@ -900,9 +898,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

// Swap two registers. If the scratch register is omitted then a slightly
// less efficient form using xor instead of mov is emitted.
Expand Down
8 changes: 2 additions & 6 deletions src/mips64/macro-assembler-mips64.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ inline MemOperand CFunctionArgumentOperand(int index) {

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

// Activation support.
void EnterFrame(StackFrame::Type type);
Expand Down Expand Up @@ -912,9 +910,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

bool IsNear(Label* L, Condition cond, int rs_reg);

Expand Down
8 changes: 2 additions & 6 deletions src/ppc/macro-assembler-ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

// Converts the integer (untagged smi) in |src| to a double, storing
// the result to |dst|
Expand Down Expand Up @@ -649,9 +647,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used acros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

// ---------------------------------------------------------------------------
// GC Support
Expand Down
8 changes: 2 additions & 6 deletions src/s390/macro-assembler-s390.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

void LoadFromConstantsTable(Register destination,
int constant_index) override;
Expand Down Expand Up @@ -1001,9 +999,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

void CallRuntime(const Runtime::Function* f, int num_arguments,
SaveFPRegsMode save_doubles = kDontSaveFPRegs);
Expand Down
30 changes: 16 additions & 14 deletions src/turbo-assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ namespace internal {
// platform-independent bits.
class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler {
public:
// Constructors are declared public to inherit them in derived classes
// with `using` directive.
TurboAssemblerBase(const AssemblerOptions& options,
std::unique_ptr<AssemblerBuffer> buffer = {})
: TurboAssemblerBase(nullptr, options.EnableV8AgnosticCode(),
CodeObjectRequired::kNo, std::move(buffer)) {}

TurboAssemblerBase(Isolate* isolate, CodeObjectRequired create_code_object,
std::unique_ptr<AssemblerBuffer> buffer = {})
: TurboAssemblerBase(isolate, AssemblerOptions::Default(isolate),
create_code_object, std::move(buffer)) {}

TurboAssemblerBase(Isolate* isolate, const AssemblerOptions& options,
CodeObjectRequired create_code_object,
std::unique_ptr<AssemblerBuffer> buffer = {});

Isolate* isolate() const {
DCHECK(!options().v8_agnostic_code);
return isolate_;
Expand Down Expand Up @@ -89,20 +105,6 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler {
Isolate* isolate, const ExternalReference& reference);

protected:
TurboAssemblerBase(const AssemblerOptions& options,
std::unique_ptr<AssemblerBuffer> buffer = {})
: TurboAssemblerBase(nullptr, options.EnableV8AgnosticCode(),
CodeObjectRequired::kNo, std::move(buffer)) {}

TurboAssemblerBase(Isolate* isolate, CodeObjectRequired create_code_object,
std::unique_ptr<AssemblerBuffer> buffer = {})
: TurboAssemblerBase(isolate, AssemblerOptions::Default(isolate),
create_code_object, std::move(buffer)) {}

TurboAssemblerBase(Isolate* isolate, const AssemblerOptions& options,
CodeObjectRequired create_code_object,
std::unique_ptr<AssemblerBuffer> buffer = {});

void RecordCommentForOffHeapTrampoline(int builtin_index);

Isolate* const isolate_ = nullptr;
Expand Down
8 changes: 2 additions & 6 deletions src/x64/macro-assembler-x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ class StackArgumentsAccessor {

class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
public:
template <typename... Args>
explicit TurboAssembler(Args&&... args)
: TurboAssemblerBase(std::forward<Args>(args)...) {}
using TurboAssemblerBase::TurboAssemblerBase;

template <typename Dst, typename... Args>
struct AvxHelper {
Expand Down Expand Up @@ -528,9 +526,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// MacroAssembler implements a collection of frequently used macros.
class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
public:
template <typename... Args>
explicit MacroAssembler(Args&&... args)
: TurboAssembler(std::forward<Args>(args)...) {}
using TurboAssembler::TurboAssembler;

// Loads and stores the value of an external reference.
// Special case code for load and store to take advantage of
Expand Down

0 comments on commit 03ce1d1

Please sign in to comment.