Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 22f6b0975498b975b53f0bc9a58cefd2cea1be1b..15ddb5ff438c66ee4045ac3dd2facd7ffbf426a6 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1481,6 +1481,12 @@ Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { |
Code); |
} |
+Handle<BytecodeArray> Factory::CopyBytecodeArray( |
+ Handle<BytecodeArray> bytecode_array) { |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->CopyBytecodeArray(*bytecode_array), |
+ BytecodeArray); |
+} |
Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
PretenureFlag pretenure) { |
@@ -2129,7 +2135,7 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
share->set_instance_class_name(*Object_string()); |
share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
- share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); |
+ share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); |
share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); |
StaticFeedbackVectorSpec empty_spec; |
Handle<TypeFeedbackMetadata> feedback_metadata = |
@@ -2248,7 +2254,10 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
debug_info->set_shared(*shared); |
if (shared->HasBytecodeArray()) { |
- debug_info->set_abstract_code(AbstractCode::cast(shared->bytecode_array())); |
+ // Create a copy for debugging. |
+ Handle<BytecodeArray> original(shared->bytecode_array(), isolate()); |
+ Handle<BytecodeArray> copy = CopyBytecodeArray(original); |
+ debug_info->set_abstract_code(AbstractCode::cast(*copy)); |
} else { |
debug_info->set_abstract_code(AbstractCode::cast(shared->code())); |
} |