Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 3c5f4161fd00f8c162a8c0c21903cceeb8e9260f..456dba7fccf81fb36f879e65eb6f7818b56cade8 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1426,9 +1426,18 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc, |
bool is_debug) { |
Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED); |
+ bool has_unwinding_info = desc.unwinding_info != nullptr; |
+ DCHECK((has_unwinding_info && desc.unwinding_info_size > 0) || |
+ (!has_unwinding_info && desc.unwinding_info_size == 0)); |
+ |
// Compute size. |
- int body_size = RoundUp(desc.instr_size, kObjectAlignment); |
- int obj_size = Code::SizeFor(body_size); |
+ int body_size = desc.instr_size; |
+ int unwinding_info_size_field_size = kInt64Size; |
+ if (has_unwinding_info) { |
+ body_size = RoundUp(body_size, kInt64Size) + desc.unwinding_info_size + |
+ unwinding_info_size_field_size; |
+ } |
+ int obj_size = Code::SizeFor(RoundUp(body_size, kObjectAlignment)); |
Handle<Code> code = NewCodeRaw(obj_size, immovable); |
DCHECK(!isolate()->heap()->memory_allocator()->code_range()->valid() || |
@@ -1444,6 +1453,7 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc, |
code->set_instruction_size(desc.instr_size); |
code->set_relocation_info(*reloc_info); |
code->set_flags(flags); |
+ code->set_has_unwinding_info(has_unwinding_info); |
code->set_raw_kind_specific_flags1(0); |
code->set_raw_kind_specific_flags2(0); |
code->set_is_crankshafted(crankshafted); |