Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index b4d9de0fd157da66fe3400738ca44a73e4759ffc..571cd3ff9b66395a82411de91de0304353b6e16a 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -2222,26 +2222,21 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
Handle<FixedArray> break_points( |
NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); |
+ // Make a copy of the bytecode array if available. |
+ Handle<Object> maybe_debug_bytecode_array = undefined_value(); |
+ if (shared->HasBytecodeArray()) { |
+ Handle<BytecodeArray> original(shared->bytecode_array()); |
+ maybe_debug_bytecode_array = CopyBytecodeArray(original); |
+ } |
+ |
// Create and set up the debug info object. Debug info contains function, a |
// copy of the original code, the executing code and initial fixed array for |
// active break points. |
Handle<DebugInfo> debug_info = |
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
debug_info->set_shared(*shared); |
- if (shared->HasBytecodeArray()) { |
- // We need to create a copy, but delay since this may cause heap |
- // verification. |
- debug_info->set_abstract_code(AbstractCode::cast(shared->bytecode_array())); |
- } else { |
- debug_info->set_abstract_code(AbstractCode::cast(shared->code())); |
- } |
+ debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); |
debug_info->set_break_points(*break_points); |
- if (shared->HasBytecodeArray()) { |
- // Create a copy for debugging. |
- Handle<BytecodeArray> original(shared->bytecode_array()); |
- Handle<BytecodeArray> copy = CopyBytecodeArray(original); |
- debug_info->set_abstract_code(AbstractCode::cast(*copy)); |
- } |
// Link debug info to function. |
shared->set_debug_info(*debug_info); |