Revision: 19350
Author:   [email protected]
Date:     Thu Feb 13 10:27:42 2014 UTC
Log:      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.

[email protected]

Review URL: https://codereview.chromium.org/139983007
http://code.google.com/p/v8/source/detail?r=19350

Modified:
 /branches/bleeding_edge/src/a64/assembler-a64.cc

=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64.cc Wed Feb 12 11:55:52 2014 UTC +++ /branches/bleeding_edge/src/a64/assembler-a64.cc Thu Feb 13 10:27:42 2014 UTC
@@ -2383,14 +2383,19 @@
       (require_jump || (dist < (kMaxDistToPool / 2)))) {
     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 @@
     // 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 @@
// 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