Reviewers: Rodolph Perfetta (ARM), ulan, jochen,

Description:
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.

Please review this at https://codereview.chromium.org/139983007/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+14, -6 lines):
  M src/a64/assembler-a64.cc


Index: src/a64/assembler-a64.cc
diff --git a/src/a64/assembler-a64.cc b/src/a64/assembler-a64.cc
index c06fbe900bf19cd8b57cdfbdd68039d541d68aee..ddf651b059ff6f2389db55dfb5ee5b1f31c382bc 100644
--- a/src/a64/assembler-a64.cc
+++ b/src/a64/assembler-a64.cc
@@ -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 +
-             num_pending_reloc_info_ * kPointerSize;
-  int needed_space = size + kGap;
+  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 = 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));
 }




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to