Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 3c5f4161fd00f8c162a8c0c21903cceeb8e9260f..84817160c7ae2539ea61722c2ed1942378985bbc 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -2238,28 +2238,34 @@ Handle<String> Factory::NumberToString(Handle<Object> number, |
return js_string; |
} |
- |
-Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
+Handle<DebugInfo> Factory::NewDebugInfo(Handle<AbstractCode> code) { |
// Allocate initial fixed array for active break points before allocating the |
// debug info object to avoid allocation while setting up the debug info |
// object. |
Handle<FixedArray> break_points( |
NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); |
- // 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. |
+ // Create and set up the debug info object. |
Handle<DebugInfo> debug_info = |
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
- debug_info->set_shared(*shared); |
+ debug_info->set_abstract_code(*code); |
+ debug_info->set_break_points(*break_points); |
+ |
+ return debug_info; |
+} |
+ |
+Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
+ AbstractCode* code; |
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())); |
+ code = AbstractCode::cast(shared->bytecode_array()); |
} else { |
- debug_info->set_abstract_code(AbstractCode::cast(shared->code())); |
+ code = AbstractCode::cast(shared->code()); |
} |
- debug_info->set_break_points(*break_points); |
+ |
+ Handle<DebugInfo> debug_info = NewDebugInfo(handle(code)); |
+ debug_info->set_shared(*shared); |
if (shared->HasBytecodeArray()) { |
// Create a copy for debugging. |
Handle<BytecodeArray> original(shared->bytecode_array()); |