Reviewers: titzer,

Message:
Could you take a look, please?

Description:
In PrintCode, keep the debug_name string alive for all uses.

BUG=chromium:465645
LOG=n
[email protected]

Please review this at https://codereview.chromium.org/996663002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -2 lines):
  M src/codegen.cc


Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index ba32aceface87f8b71e180134da40eade6ffdf5a..796e39a50c8d2d9fc5f51ddfdd5a5e6859c0d578 100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -183,12 +183,14 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
          (info->IsOptimizing() && FLAG_print_opt_code));
   if (print_code) {
     const char* debug_name;
+    SmartArrayPointer<char> debug_name_holder;
     if (info->IsStub()) {
       CodeStub::Major major_key = info->code_stub()->MajorKey();
       debug_name = CodeStub::MajorName(major_key, false);
     } else {
-      debug_name =
-          info->parse_info()->function()->debug_name()->ToCString().get();
+      debug_name_holder =
+          info->parse_info()->function()->debug_name()->ToCString();
+      debug_name = debug_name_holder.get();
     }

     CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer());


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to