Commit a82d3dc8 authored by loislo's avatar loislo Committed by Commit bot

Move identical code from platform specific assemblers to assembler.cc

BUG=none
LOG=n

Review URL: https://codereview.chromium.org/922153002

Cr-Commit-Position: refs/heads/master@{#26639}
parent 1da1e347
...@@ -3369,37 +3369,6 @@ bool Assembler::ImmediateFitsAddrMode2Instruction(int32_t imm32) { ...@@ -3369,37 +3369,6 @@ bool Assembler::ImmediateFitsAddrMode2Instruction(int32_t imm32) {
// Debugging. // Debugging.
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
CheckBuffer();
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::RecordConstPool(int size) { void Assembler::RecordConstPool(int size) {
// We only need this for debugger support, to correctly compute offsets in the // We only need this for debugger support, to correctly compute offsets in the
// code. // code.
......
...@@ -3072,42 +3072,11 @@ void Assembler::CheckVeneerPool(bool force_emit, bool require_jump, ...@@ -3072,42 +3072,11 @@ void Assembler::CheckVeneerPool(bool force_emit, bool require_jump,
} }
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
CheckBuffer();
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
int Assembler::buffer_space() const { int Assembler::buffer_space() const {
return reloc_info_writer.pos() - reinterpret_cast<byte*>(pc_); return reloc_info_writer.pos() - reinterpret_cast<byte*>(pc_);
} }
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordConstPool(int size) { void Assembler::RecordConstPool(int size) {
// We only need this for debugger support, to correctly compute offsets in the // We only need this for debugger support, to correctly compute offsets in the
// code. // code.
......
...@@ -1652,4 +1652,37 @@ bool PositionsRecorder::WriteRecordedPositions() { ...@@ -1652,4 +1652,37 @@ bool PositionsRecorder::WriteRecordedPositions() {
return written; return written;
} }
// Platform specific but identical code for all the platforms.
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
} } // namespace v8::internal } } // namespace v8::internal
...@@ -2629,37 +2629,6 @@ void Assembler::emit_vex_prefix(XMMRegister vreg, VectorLength l, SIMDPrefix pp, ...@@ -2629,37 +2629,6 @@ void Assembler::emit_vex_prefix(XMMRegister vreg, VectorLength l, SIMDPrefix pp,
} }
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg, bool force) {
if (FLAG_code_comments || force) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::GrowBuffer() { void Assembler::GrowBuffer() {
DCHECK(buffer_overflow()); DCHECK(buffer_overflow());
if (!own_buffer_) FATAL("external code buffer is too small"); if (!own_buffer_) FATAL("external code buffer is too small");
......
...@@ -1261,9 +1261,8 @@ class Assembler : public AssemblerBase { ...@@ -1261,9 +1261,8 @@ class Assembler : public AssemblerBase {
void RecordDebugBreakSlot(); void RecordDebugBreakSlot();
// Record a comment relocation entry that can be used by a disassembler. // Record a comment relocation entry that can be used by a disassembler.
// Use --code-comments to enable, or provide "force = true" flag to always // Use --code-comments to enable.
// write a comment. void RecordComment(const char* msg);
void RecordComment(const char* msg, bool force = false);
// Record a deoptimization reason that can be used by a log or cpu profiler. // Record a deoptimization reason that can be used by a log or cpu profiler.
// Use --trace-deopt to enable. // Use --trace-deopt to enable.
......
...@@ -2332,37 +2332,6 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) { ...@@ -2332,37 +2332,6 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) {
// Debugging. // Debugging.
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
CheckBuffer();
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
int Assembler::RelocateInternalReference(byte* pc, intptr_t pc_delta) { int Assembler::RelocateInternalReference(byte* pc, intptr_t pc_delta) {
Instr instr = instr_at(pc); Instr instr = instr_at(pc);
if (IsLui(instr)) { if (IsLui(instr)) {
......
...@@ -2559,37 +2559,6 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) { ...@@ -2559,37 +2559,6 @@ void Assembler::bc1t(int16_t offset, uint16_t cc) {
// Debugging. // Debugging.
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
CheckBuffer();
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
int Assembler::RelocateInternalReference(byte* pc, intptr_t pc_delta) { int Assembler::RelocateInternalReference(byte* pc, intptr_t pc_delta) {
Instr instr = instr_at(pc); Instr instr = instr_at(pc);
DCHECK(IsJ(instr) || IsLui(instr)); DCHECK(IsJ(instr) || IsLui(instr));
......
...@@ -2173,37 +2173,6 @@ bool Assembler::IsNop(Instr instr, int type) { ...@@ -2173,37 +2173,6 @@ bool Assembler::IsNop(Instr instr, int type) {
// Debugging. // Debugging.
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg) {
if (FLAG_code_comments) {
CheckBuffer();
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::GrowBuffer() { void Assembler::GrowBuffer() {
if (!own_buffer_) FATAL("external code buffer is too small"); if (!own_buffer_) FATAL("external code buffer is too small");
......
...@@ -3428,37 +3428,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { ...@@ -3428,37 +3428,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
} }
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg, bool force) {
if (FLAG_code_comments || force) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) {
// No out-of-line constant pool support. // No out-of-line constant pool support.
DCHECK(!FLAG_enable_ool_constant_pool); DCHECK(!FLAG_enable_ool_constant_pool);
......
...@@ -1337,7 +1337,7 @@ class Assembler : public AssemblerBase { ...@@ -1337,7 +1337,7 @@ class Assembler : public AssemblerBase {
// Record a comment relocation entry that can be used by a disassembler. // Record a comment relocation entry that can be used by a disassembler.
// Use --code-comments to enable. // Use --code-comments to enable.
void RecordComment(const char* msg, bool force = false); void RecordComment(const char* msg);
// Record a deoptimization reason that can be used by a log or cpu profiler. // Record a deoptimization reason that can be used by a log or cpu profiler.
// Use --trace-deopt to enable. // Use --trace-deopt to enable.
......
...@@ -1898,37 +1898,6 @@ void Assembler::setcc(Condition cc, Register reg) { ...@@ -1898,37 +1898,6 @@ void Assembler::setcc(Condition cc, Register reg) {
} }
void Assembler::RecordJSReturn() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::JS_RETURN);
}
void Assembler::RecordDebugBreakSlot() {
positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT);
}
void Assembler::RecordComment(const char* msg, bool force) {
if (FLAG_code_comments || force) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
}
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::GrowBuffer() { void Assembler::GrowBuffer() {
DCHECK(buffer_overflow()); DCHECK(buffer_overflow());
if (!own_buffer_) FATAL("external code buffer is too small"); if (!own_buffer_) FATAL("external code buffer is too small");
......
...@@ -932,9 +932,8 @@ class Assembler : public AssemblerBase { ...@@ -932,9 +932,8 @@ class Assembler : public AssemblerBase {
void RecordDebugBreakSlot(); void RecordDebugBreakSlot();
// Record a comment relocation entry that can be used by a disassembler. // Record a comment relocation entry that can be used by a disassembler.
// Use --code-comments to enable, or provide "force = true" flag to always // Use --code-comments to enable.
// write a comment. void RecordComment(const char* msg);
void RecordComment(const char* msg, bool force = false);
// Record a deoptimization reason that can be used by a log or cpu profiler. // Record a deoptimization reason that can be used by a log or cpu profiler.
// Use --trace-deopt to enable. // Use --trace-deopt to enable.
......
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