Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 3c5f4161fd00f8c162a8c0c21903cceeb8e9260f..f4e3e5dcfbfdd9e20c7cdb9e9baa836870560d61 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1426,9 +1426,17 @@ 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; |
+ if (has_unwinding_info) { |
+ body_size = |
+ RoundUp(body_size, kInt64Size) + desc.unwinding_info_size + kInt64Size; |
rmcilroy
2016/06/24 09:45:26
What's the extra kInt64Size here for? Is that the
Stefano Sanfilippo
2016/06/24 10:36:37
Done.
rmcilroy
2016/06/24 12:55:25
There are multiple kInt64Size here so the comment
Stefano Sanfilippo
2016/06/24 13:17:28
Done.
|
+ } |
+ 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 +1452,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); |