Reviewers: Michael Starzinger,

Description:
[heap] Assert that code objects are always properly aligned.

[email protected]

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+2, -0 lines):
  M src/heap/heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 85c59696a77357d3ebf565298bc1b270abb57190..b2f27a39fad2dbf6bb460cf810b60947790c6f2a 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -3731,6 +3731,7 @@ AllocationResult Heap::AllocateCode(int object_size, bool immovable) {

   result->set_map_no_write_barrier(code_map());
   Code* code = Code::cast(result);
+  DCHECK(IsAligned(bit_cast<intptr_t>(code->address()), kCodeAlignment));
DCHECK(isolate_->code_range() == NULL | | !isolate_->code_range()->valid() ||
          isolate_->code_range()->contains(code->address()));
   code->set_gc_metadata(Smi::FromInt(0));
@@ -3768,6 +3769,7 @@ AllocationResult Heap::CopyCode(Code* code) {
   new_code->set_constant_pool(new_constant_pool);

   // Relocate the copy.
+ DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); DCHECK(isolate_->code_range() == NULL | | !isolate_->code_range()->valid() ||
          isolate_->code_range()->contains(code->address()));
   new_code->Relocate(new_addr - old_addr);


--
--
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/d/optout.

Reply via email to