Index: src/x64/assembler-x64.cc |
=================================================================== |
--- src/x64/assembler-x64.cc (revision 3798) |
+++ src/x64/assembler-x64.cc (working copy) |
@@ -265,7 +265,7 @@ |
// ----------------------------------------------------------------------------- |
-// Implementation of Assembler |
+// Implementation of Assembler. |
#ifdef GENERATED_CODE_COVERAGE |
static void InitCoverageLog(); |
@@ -276,7 +276,7 @@ |
Assembler::Assembler(void* buffer, int buffer_size) |
: code_targets_(100) { |
if (buffer == NULL) { |
- // do our own buffer management |
+ // Do our own buffer management. |
if (buffer_size <= kMinimalBufferSize) { |
buffer_size = kMinimalBufferSize; |
@@ -293,7 +293,7 @@ |
buffer_size_ = buffer_size; |
own_buffer_ = true; |
} else { |
- // use externally provided buffer instead |
+ // Use externally provided buffer instead. |
ASSERT(buffer_size > 0); |
buffer_ = static_cast<byte*>(buffer); |
buffer_size_ = buffer_size; |
@@ -309,7 +309,7 @@ |
} |
#endif |
- // setup buffer pointers |
+ // Setup buffer pointers. |
ASSERT(buffer_ != NULL); |
pc_ = buffer_; |
reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
@@ -337,11 +337,10 @@ |
void Assembler::GetCode(CodeDesc* desc) { |
- // finalize code |
- // (at this point overflow() may be true, but the gap ensures that |
- // we are still not overlapping instructions and relocation info) |
- ASSERT(pc_ <= reloc_info_writer.pos()); // no overlap |
- // setup desc |
+ // Finalize code (at this point overflow() may be true, but the gap ensures |
+ // that we are still not overlapping instructions and relocation info). |
+ ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap. |
+ // Setup code descriptor. |
desc->buffer = buffer_; |
desc->buffer_size = buffer_size_; |
desc->instr_size = pc_offset(); |
@@ -370,7 +369,7 @@ |
int current = L->pos(); |
int next = long_at(current); |
while (next != current) { |
- // relative address, relative to point after address |
+ // Relative address, relative to point after address. |
int imm32 = pos - (current + sizeof(int32_t)); |
long_at_put(current, imm32); |
current = next; |
@@ -390,10 +389,10 @@ |
void Assembler::GrowBuffer() { |
- ASSERT(buffer_overflow()); // should not call this otherwise |
+ ASSERT(buffer_overflow()); |
if (!own_buffer_) FATAL("external code buffer is too small"); |
- // compute new buffer size |
+ // Compute new buffer size. |
CodeDesc desc; // the new buffer |
if (buffer_size_ < 4*KB) { |
desc.buffer_size = 4*KB; |
@@ -407,7 +406,7 @@ |
V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
} |
- // setup new buffer |
+ // Setup new buffer. |
desc.buffer = NewArray<byte>(desc.buffer_size); |
desc.instr_size = pc_offset(); |
desc.reloc_size = |
@@ -419,7 +418,7 @@ |
memset(desc.buffer, 0xCC, desc.buffer_size); |
#endif |
- // copy the data |
+ // Copy the data. |
intptr_t pc_delta = desc.buffer - buffer_; |
intptr_t rc_delta = (desc.buffer + desc.buffer_size) - |
(buffer_ + buffer_size_); |
@@ -427,7 +426,7 @@ |
memmove(rc_delta + reloc_info_writer.pos(), |
reloc_info_writer.pos(), desc.reloc_size); |
- // switch buffers |
+ // Switch buffers. |
if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { |
spare_buffer_ = buffer_; |
} else { |
@@ -442,7 +441,7 @@ |
reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, |
reloc_info_writer.last_pc() + pc_delta); |
- // relocate runtime entries |
+ // Relocate runtime entries. |
for (RelocIterator it(desc); !it.done(); it.next()) { |
RelocInfo::Mode rmode = it.rinfo()->rmode(); |
if (rmode == RelocInfo::INTERNAL_REFERENCE) { |
@@ -472,7 +471,7 @@ |
} |
-// Assembler Instruction implementations |
+// Assembler Instruction implementations. |
void Assembler::arithmetic_op(byte opcode, Register reg, const Operand& op) { |
EnsureSpace ensure_space(this); |
@@ -756,7 +755,7 @@ |
void Assembler::call(Label* L) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // 1110 1000 #32-bit disp |
+ // 1110 1000 #32-bit disp. |
emit(0xE8); |
if (L->is_bound()) { |
int offset = L->pos() - pc_offset() - sizeof(int32_t); |
@@ -777,7 +776,7 @@ |
void Assembler::call(Handle<Code> target, RelocInfo::Mode rmode) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // 1110 1000 #32-bit disp |
+ // 1110 1000 #32-bit disp. |
emit(0xE8); |
emit_code_target(target, rmode); |
} |
@@ -786,7 +785,7 @@ |
void Assembler::call(Register adr) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: FF /2 r64 |
+ // Opcode: FF /2 r64. |
if (adr.high_bit()) { |
emit_rex_64(adr); |
} |
@@ -798,7 +797,7 @@ |
void Assembler::call(const Operand& op) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: FF /2 m64 |
+ // Opcode: FF /2 m64. |
emit_rex_64(op); |
emit(0xFF); |
emit_operand(2, op); |
@@ -829,7 +828,7 @@ |
ASSERT(cc >= 0); // Use mov for unconditional moves. |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: REX.W 0f 40 + cc /r |
+ // Opcode: REX.W 0f 40 + cc /r. |
emit_rex_64(dst, src); |
emit(0x0f); |
emit(0x40 + cc); |
@@ -846,7 +845,7 @@ |
ASSERT(cc >= 0); |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: REX.W 0f 40 + cc /r |
+ // Opcode: REX.W 0f 40 + cc /r. |
emit_rex_64(dst, src); |
emit(0x0f); |
emit(0x40 + cc); |
@@ -863,7 +862,7 @@ |
ASSERT(cc >= 0); |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: 0f 40 + cc /r |
+ // Opcode: 0f 40 + cc /r. |
emit_optional_rex_32(dst, src); |
emit(0x0f); |
emit(0x40 + cc); |
@@ -880,7 +879,7 @@ |
ASSERT(cc >= 0); |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode: 0f 40 + cc /r |
+ // Opcode: 0f 40 + cc /r. |
emit_optional_rex_32(dst, src); |
emit(0x0f); |
emit(0x40 + cc); |
@@ -1110,17 +1109,17 @@ |
int offs = L->pos() - pc_offset(); |
ASSERT(offs <= 0); |
if (is_int8(offs - short_size)) { |
- // 0111 tttn #8-bit disp |
+ // 0111 tttn #8-bit disp. |
emit(0x70 | cc); |
emit((offs - short_size) & 0xFF); |
} else { |
- // 0000 1111 1000 tttn #32-bit disp |
+ // 0000 1111 1000 tttn #32-bit disp. |
emit(0x0F); |
emit(0x80 | cc); |
emitl(offs - long_size); |
} |
} else if (L->is_linked()) { |
- // 0000 1111 1000 tttn #32-bit disp |
+ // 0000 1111 1000 tttn #32-bit disp. |
emit(0x0F); |
emit(0x80 | cc); |
emitl(L->pos()); |
@@ -1142,7 +1141,7 @@ |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
ASSERT(is_uint4(cc)); |
- // 0000 1111 1000 tttn #32-bit disp |
+ // 0000 1111 1000 tttn #32-bit disp. |
emit(0x0F); |
emit(0x80 | cc); |
emit_code_target(target, rmode); |
@@ -1156,21 +1155,21 @@ |
int offs = L->pos() - pc_offset() - 1; |
ASSERT(offs <= 0); |
if (is_int8(offs - sizeof(int8_t))) { |
- // 1110 1011 #8-bit disp |
+ // 1110 1011 #8-bit disp. |
emit(0xEB); |
emit((offs - sizeof(int8_t)) & 0xFF); |
} else { |
- // 1110 1001 #32-bit disp |
+ // 1110 1001 #32-bit disp. |
emit(0xE9); |
emitl(offs - sizeof(int32_t)); |
} |
} else if (L->is_linked()) { |
- // 1110 1001 #32-bit disp |
+ // 1110 1001 #32-bit disp. |
emit(0xE9); |
emitl(L->pos()); |
L->link_to(pc_offset() - sizeof(int32_t)); |
} else { |
- // 1110 1001 #32-bit disp |
+ // 1110 1001 #32-bit disp. |
ASSERT(L->is_unused()); |
emit(0xE9); |
int32_t current = pc_offset(); |
@@ -1183,7 +1182,7 @@ |
void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // 1110 1001 #32-bit disp |
+ // 1110 1001 #32-bit disp. |
emit(0xE9); |
emit_code_target(target, rmode); |
} |
@@ -1192,7 +1191,7 @@ |
void Assembler::jmp(Register target) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode FF/4 r64 |
+ // Opcode FF/4 r64. |
if (target.high_bit()) { |
emit_rex_64(target); |
} |
@@ -1204,7 +1203,7 @@ |
void Assembler::jmp(const Operand& src) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
- // Opcode FF/4 m64 |
+ // Opcode FF/4 m64. |
emit_optional_rex_32(src); |
emit(0xFF); |
emit_operand(0x4, src); |
@@ -1413,10 +1412,8 @@ |
} |
-/* |
- * Loads the ip-relative location of the src label into the target |
- * location (as a 32-bit offset sign extended to 64-bit). |
- */ |
+// Loads the ip-relative location of the src label into the target location |
+// (as a 32-bit offset sign extended to 64-bit). |
void Assembler::movl(const Operand& dst, Label* src) { |
EnsureSpace ensure_space(this); |
last_pc_ = pc_; |
@@ -2006,7 +2003,7 @@ |
} |
-// FPU instructions |
+// FPU instructions. |
void Assembler::fld(int i) { |
@@ -2377,7 +2374,7 @@ |
emit(b2 + i); |
} |
-// SSE 2 operations |
+// SSE 2 operations. |
void Assembler::movsd(const Operand& dst, XMMRegister src) { |
EnsureSpace ensure_space(this); |
@@ -2527,7 +2524,7 @@ |
} |
-// Relocation information implementations |
+// Relocation information implementations. |
void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
ASSERT(rmode != RelocInfo::NONE); |