[cleanup] Minor cleanups concerning assemblers and code generation.

- Use Assembler in a few places that unneccessarily used MacroAssembler before.
- Fix some comments.

R=jarin@chromium.org
BUG=v8:6048

Review-Url: https://codereview.chromium.org/2843933002
Cr-Commit-Position: refs/heads/master@{#44894}
This commit is contained in:
neis 2017-04-26 07:54:33 -07:00 committed by Commit bot
parent 6b4b062489
commit 86d2545f77
6 changed files with 23 additions and 28 deletions

View File

@ -325,7 +325,7 @@ class RelocInfo {
enum Mode {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
CODE_TARGET, // Code target which is not any of the above.
CODE_TARGET,
CODE_TARGET_WITH_ID,
EMBEDDED_OBJECT,
// To relocate pointers into the wasm memory embedded in wasm code

View File

@ -69,24 +69,20 @@ UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction)
#undef UNARY_MATH_FUNCTION
#define __ ACCESS_MASM(masm_)
#ifdef DEBUG
Comment::Comment(MacroAssembler* masm, const char* msg)
: masm_(masm), msg_(msg) {
__ RecordComment(msg);
Comment::Comment(Assembler* assembler, const char* msg)
: assembler_(assembler), msg_(msg) {
assembler_->RecordComment(msg);
}
Comment::~Comment() {
if (msg_[0] == '[') __ RecordComment("]");
if (msg_[0] == '[') assembler_->RecordComment("]");
}
#endif // DEBUG
#undef __
void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
bool print_ast = false;

View File

@ -762,7 +762,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg,
namespace {
void AdjustStackPointerForTailCall(MacroAssembler* masm,
void AdjustStackPointerForTailCall(Assembler* assembler,
FrameAccessState* state,
int new_slot_above_sp,
bool allow_shrinkage = true) {
@ -770,10 +770,10 @@ void AdjustStackPointerForTailCall(MacroAssembler* masm,
StandardFrameConstants::kFixedSlotCountAboveFp;
int stack_slot_delta = new_slot_above_sp - current_sp_offset;
if (stack_slot_delta > 0) {
masm->subq(rsp, Immediate(stack_slot_delta * kPointerSize));
assembler->subq(rsp, Immediate(stack_slot_delta * kPointerSize));
state->IncreaseSPDelta(stack_slot_delta);
} else if (allow_shrinkage && stack_slot_delta < 0) {
masm->addq(rsp, Immediate(-stack_slot_delta * kPointerSize));
assembler->addq(rsp, Immediate(-stack_slot_delta * kPointerSize));
state->IncreaseSPDelta(stack_slot_delta);
}
}

View File

@ -148,22 +148,22 @@ class FrameAndConstantPoolScope {
// Class for scoping the the unavailability of constant pool access.
class ConstantPoolUnavailableScope {
public:
explicit ConstantPoolUnavailableScope(MacroAssembler* masm)
: masm_(masm),
explicit ConstantPoolUnavailableScope(Assembler* assembler)
: assembler_(assembler),
old_constant_pool_available_(FLAG_enable_embedded_constant_pool &&
masm->is_constant_pool_available()) {
assembler->is_constant_pool_available()) {
if (FLAG_enable_embedded_constant_pool) {
masm_->set_constant_pool_available(false);
assembler->set_constant_pool_available(false);
}
}
~ConstantPoolUnavailableScope() {
if (FLAG_enable_embedded_constant_pool) {
masm_->set_constant_pool_available(old_constant_pool_available_);
assembler_->set_constant_pool_available(old_constant_pool_available_);
}
}
private:
MacroAssembler* masm_;
Assembler* assembler_;
int old_constant_pool_available_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope);
@ -199,11 +199,11 @@ class NoCurrentFrameScope {
class Comment {
public:
Comment(MacroAssembler* masm, const char* msg);
Comment(Assembler* assembler, const char* msg);
~Comment();
private:
MacroAssembler* masm_;
Assembler* assembler_;
const char* msg_;
};
@ -211,7 +211,7 @@ class Comment {
class Comment {
public:
Comment(MacroAssembler*, const char*) {}
Comment(Assembler*, const char*) {}
};
#endif // DEBUG

View File

@ -13988,7 +13988,6 @@ void Code::CopyFrom(const CodeDesc& desc) {
static_cast<size_t>(desc.reloc_size));
// unbox handles and relocate
intptr_t delta = instruction_start() - desc.buffer;
int mode_mask = RelocInfo::kCodeTargetMask |
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::ModeMask(RelocInfo::CELL) |
@ -14008,8 +14007,8 @@ void Code::CopyFrom(const CodeDesc& desc) {
it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER,
SKIP_ICACHE_FLUSH);
} else if (RelocInfo::IsCodeTarget(mode)) {
// rewrite code handles in inline cache targets to direct
// pointers to the first instruction in the code object
// rewrite code handles to direct pointers to the first instruction in the
// code object
Handle<Object> p = it.rinfo()->target_object_handle(origin);
Code* code = Code::cast(*p);
it.rinfo()->set_target_address(GetIsolate(), code->instruction_start(),
@ -14023,6 +14022,7 @@ void Code::CopyFrom(const CodeDesc& desc) {
Code* code = Code::cast(*p);
it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH);
} else {
intptr_t delta = instruction_start() - desc.buffer;
it.rinfo()->apply(delta);
}
}

View File

@ -3525,10 +3525,9 @@ TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
#undef FIXED_TYPED_ARRAY_TRAITS
// DeoptimizationInputData is a fixed array used to hold the deoptimization
// data for code generated by the Hydrogen/Lithium compiler. It also
// contains information about functions that were inlined. If N different
// functions were inlined then first N elements of the literal array will
// contain these functions.
// data for optimized code. It also contains information about functions that
// were inlined. If N different functions were inlined then first N elements of
// the literal array will contain these functions.
//
// It can be empty.
class DeoptimizationInputData: public FixedArray {