Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Unified Diff: src/heap/heap.cc

Issue 1059903004: [heap] Assert that code objects are always properly aligned. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comment. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 85c59696a77357d3ebf565298bc1b270abb57190..5e515337c832457284d19aded7d254e77f0b5105 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);
@@ -3826,6 +3828,7 @@ AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
static_cast<size_t>(reloc_info.length()));
// 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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698