Commit 67d449c3 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[assembler] [cleanup] Fix field names in {IsolateData}

Struct fields should not end in an underscore according to the style
guide.

Drive-by: Add {TurboAssembler} constructor which receives an
{IsolateData} directly, to allow creating a {TurboAssembler} in a
background thread.

R=mstarzinger@chromium.org

Change-Id: I32800476690f4c8619059519b7d27b06f5d4be95
Reviewed-on: https://chromium-review.googlesource.com/1090278
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53582}
parent bca6b58e
......@@ -55,6 +55,10 @@ TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,
......
......@@ -89,6 +89,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
......@@ -566,7 +567,7 @@ class TurboAssembler : public Assembler {
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* const isolate_;
Isolate* const isolate_ = nullptr;
// Compare single values and then load the fpscr flags to a register.
void VFPCompareAndLoadFlags(const SwVfpRegister src1,
......
......@@ -563,7 +563,7 @@ Address Assembler::runtime_entry_at(Address pc) {
return Assembler::target_address_at(pc, 0 /* unused */);
} else {
DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch());
return instr->ImmPCOffset() + isolate_data().code_range_start_;
return instr->ImmPCOffset() + isolate_data().code_range_start;
}
}
......
......@@ -984,7 +984,7 @@ class Assembler : public AssemblerBase {
// at 'pc'.
// Runtime entries can be temporarily encoded as the offset between the
// runtime function entrypoint and the code range start (stored in the
// code_range_start_ field), in order to be encodable as we generate the code,
// code_range_start field), in order to be encodable as we generate the code,
// before it is moved into the code space.
inline Address runtime_entry_at(Address pc);
......
......@@ -52,20 +52,17 @@ CPURegList TurboAssembler::DefaultFPTmpList() {
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
#if DEBUG
allow_macro_instructions_(true),
#endif
tmp_list_(DefaultTmpList()),
fptmp_list_(DefaultFPTmpList()),
use_real_aborts_(true) {
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ = Handle<HeapObject>::New(
isolate->heap()->self_reference_marker(), isolate);
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion) const {
int bytes = 0;
......@@ -2163,7 +2160,7 @@ void TurboAssembler::CallForDeoptimization(Address target,
Mov(temp, Immediate(target, rmode));
int64_t offset = static_cast<int64_t>(target) -
static_cast<int64_t>(isolate_data().code_range_start_);
static_cast<int64_t>(isolate_data().code_range_start);
DCHECK_EQ(offset % kInstructionSize, 0);
offset = offset / static_cast<int>(kInstructionSize);
DCHECK(IsNearCallOffset(offset));
......
......@@ -176,6 +176,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
// The Abort method should call a V8 runtime function, but the CallRuntime
// mechanism depends on CEntry. If use_real_aborts is false, Abort will
......@@ -1275,20 +1276,20 @@ class TurboAssembler : public Assembler {
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* const isolate_;
Isolate* const isolate_ = nullptr;
#if DEBUG
// Tell whether any of the macro instruction can be used. When false the
// MacroAssembler will assert if a method which can emit a variable number
// of instructions is called.
bool allow_macro_instructions_;
bool allow_macro_instructions_ = true;
#endif
// Scratch registers available for use by the MacroAssembler.
CPURegList tmp_list_;
CPURegList fptmp_list_;
CPURegList tmp_list_ = DefaultTmpList();
CPURegList fptmp_list_ = DefaultFPTmpList();
bool use_real_aborts_;
bool use_real_aborts_ = true;
// Helps resolve branching to labels potentially out of range.
// If the label is not bound, it registers the information necessary to later
......
......@@ -54,10 +54,10 @@ const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
// Implementation of AssemblerBase
AssemblerBase::IsolateData::IsolateData(Isolate* isolate)
: serializer_enabled_(isolate->serializer_enabled())
: serializer_enabled(isolate->serializer_enabled())
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
,
code_range_start_(
code_range_start(
isolate->heap()->memory_allocator()->code_range()->start())
#endif
{
......
......@@ -92,16 +92,14 @@ class JumpOptimizationInfo {
enum class CodeObjectRequired { kNo, kYes };
class AssemblerBase: public Malloced {
class AssemblerBase : public Malloced {
public:
struct IsolateData {
explicit IsolateData(Isolate* isolate);
IsolateData(const IsolateData&) = default;
bool serializer_enabled_;
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
Address code_range_start_;
bool serializer_enabled;
#if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64
Address code_range_start;
#endif
};
......@@ -110,8 +108,8 @@ class AssemblerBase: public Malloced {
IsolateData isolate_data() const { return isolate_data_; }
bool serializer_enabled() const { return isolate_data_.serializer_enabled_; }
void enable_serializer() { isolate_data_.serializer_enabled_ = true; }
bool serializer_enabled() const { return isolate_data_.serializer_enabled; }
void enable_serializer() { isolate_data_.serializer_enabled = true; }
bool emit_debug_code() const { return emit_debug_code_; }
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
......
......@@ -50,6 +50,10 @@ TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) {
Handle<Object> object = isolate()->heap()->root_handle(index);
......
......@@ -53,6 +53,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
......@@ -382,7 +383,7 @@ class TurboAssembler : public Assembler {
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
bool root_array_available_ = false;
Isolate* const isolate_;
Isolate* const isolate_ = nullptr;
};
// MacroAssembler implements a collection of frequently used macros.
......
......@@ -43,15 +43,17 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ = Handle<HeapObject>::New(
isolate->heap()->self_reference_marker(), isolate);
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
static inline bool IsZero(const Operand& rt) {
if (rt.is_reg()) {
return rt.rm() == zero_reg;
......
......@@ -130,6 +130,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
......@@ -868,8 +869,8 @@ class TurboAssembler : public Assembler {
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* const isolate_;
bool has_double_zero_reg_set_;
Isolate* const isolate_ = nullptr;
bool has_double_zero_reg_set_ = false;
void CallCFunctionHelper(Register function_base, int16_t function_offset,
int num_reg_arguments, int num_double_arguments);
......
......@@ -43,15 +43,17 @@ MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object)
: Assembler(isolate, buffer, buffer_size),
isolate_(isolate),
has_double_zero_reg_set_(false) {
: Assembler(isolate, buffer, buffer_size), isolate_(isolate) {
if (create_code_object == CodeObjectRequired::kYes) {
code_object_ = Handle<HeapObject>::New(
isolate->heap()->self_reference_marker(), isolate);
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
static inline bool IsZero(const Operand& rt) {
if (rt.is_reg()) {
return rt.rm() == zero_reg;
......
......@@ -147,6 +147,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
......@@ -880,8 +881,8 @@ class TurboAssembler : public Assembler {
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* const isolate_;
bool has_double_zero_reg_set_;
Isolate* const isolate_ = nullptr;
bool has_double_zero_reg_set_ = false;
void CompareF(SecondaryField sizeField, FPUCondition cc, FPURegister cmp1,
FPURegister cmp2);
......
......@@ -51,6 +51,10 @@ TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,
......
......@@ -114,6 +114,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() { return has_frame_; }
......@@ -693,7 +694,7 @@ class TurboAssembler : public Assembler {
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* const isolate_;
Isolate* const isolate_ = nullptr;
void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al,
CRegister cr = cr7);
......
......@@ -51,6 +51,10 @@ TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
int TurboAssembler::RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
Register exclusion1,
Register exclusion2,
......
......@@ -171,6 +171,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
Isolate* isolate() const { return isolate_; }
......@@ -1049,7 +1050,7 @@ class TurboAssembler : public Assembler {
bool has_frame_ = false;
bool root_array_available_ = true;
Isolate* isolate_;
Isolate* const isolate_ = nullptr;
};
// MacroAssembler implements a collection of frequently used macros.
......
......@@ -66,7 +66,7 @@ void Assembler::emit_code_target(Handle<Code> target, RelocInfo::Mode rmode) {
void Assembler::emit_runtime_entry(Address entry, RelocInfo::Mode rmode) {
DCHECK(RelocInfo::IsRuntimeEntry(rmode));
RecordRelocInfo(rmode);
emitl(static_cast<uint32_t>(entry - isolate_data().code_range_start_));
emitl(static_cast<uint32_t>(entry - isolate_data().code_range_start));
}
void Assembler::emit(Immediate x) {
......@@ -282,7 +282,7 @@ Handle<Code> Assembler::code_target_object_handle_at(Address pc) {
}
Address Assembler::runtime_entry_at(Address pc) {
return Memory::int32_at(pc) + isolate_data().code_range_start_;
return Memory::int32_at(pc) + isolate_data().code_range_start;
}
// -----------------------------------------------------------------------------
......
......@@ -88,6 +88,10 @@ TurboAssembler::TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
}
}
TurboAssembler::TurboAssembler(IsolateData isolate_data, void* buffer,
int buffer_size)
: Assembler(isolate_data, buffer, buffer_size) {}
static const int64_t kInvalidRootRegisterDelta = -1;
int64_t TurboAssembler::RootRegisterDelta(ExternalReference other) {
......
......@@ -126,6 +126,7 @@ class TurboAssembler : public Assembler {
public:
TurboAssembler(Isolate* isolate, void* buffer, int buffer_size,
CodeObjectRequired create_code_object);
TurboAssembler(IsolateData isolate_data, void* buffer, int buffer_size);
void set_has_frame(bool value) { has_frame_ = value; }
bool has_frame() const { return has_frame_; }
......@@ -552,7 +553,7 @@ class TurboAssembler : public Assembler {
private:
int maybe_builtin_index_ = -1; // May be set while generating builtins.
bool has_frame_ = false;
Isolate* const isolate_;
Isolate* const isolate_ = nullptr;
};
// MacroAssembler implements a collection of frequently used macros.
......
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