A64: Indicate the correct size for constant pools.

This fixes potential issues that would appear when trying to insert a breakpoint
from JavaScript.
Without this, computing the mapping of addresses between versions of the code with
and without debug slots could be off by an instruction, trigerring nasty bugs.

R=jochen@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19350 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5977a041
......@@ -2384,13 +2384,18 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
return;
}
Label size_check;
bind(&size_check);
// Check that the code buffer is large enough before emitting the constant
// pool (include the jump over the pool and the constant pool marker and
// the gap to the relocation information).
// pool (include the jump over the pool, the constant pool marker, the
// constant pool guard, and the gap to the relocation information).
int jump_instr = require_jump ? kInstructionSize : 0;
int size = jump_instr + kInstructionSize +
int size_pool_marker = kInstructionSize;
int size_pool_guard = kInstructionSize;
int pool_size = jump_instr + size_pool_marker + size_pool_guard +
num_pending_reloc_info_ * kPointerSize;
int needed_space = size + kGap;
int needed_space = pool_size + kGap;
while (buffer_space() <= needed_space) {
GrowBuffer();
}
......@@ -2399,7 +2404,7 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
// Block recursive calls to CheckConstPool.
BlockConstPoolScope block_const_pool(this);
RecordComment("[ Constant Pool");
RecordConstPool(size);
RecordConstPool(pool_size);
// Emit jump over constant pool if necessary.
Label after_pool;
......@@ -2451,6 +2456,9 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
// Since a constant pool was just emitted, move the check offset forward by
// the standard interval.
next_buffer_check_ = pc_offset() + kCheckPoolInterval;
ASSERT(SizeOfCodeGeneratedSince(&size_check) ==
static_cast<unsigned>(pool_size));
}
......
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