Commit e059be33 authored by svenpanne's avatar svenpanne Committed by Commit bot

Make valgrind a bit more happy by zero-terminating/initializing strings.

Tiny cleanup on the way...

Review URL: https://codereview.chromium.org/1007283006

Cr-Commit-Position: refs/heads/master@{#27226}
parent dde730ff
......@@ -27,9 +27,9 @@ namespace compiler {
FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
const char* suffix, const char* mode) {
EmbeddedVector<char, 256> filename;
EmbeddedVector<char, 256> filename(0);
SmartArrayPointer<char> function_name;
if (!info->shared_info().is_null()) {
if (info->has_shared_info()) {
function_name = info->shared_info()->DebugName()->ToCString();
if (strlen(function_name.get()) > 0) {
SNPrintF(filename, "turbo-%s", function_name.get());
......
......@@ -291,20 +291,17 @@ static void TraceSchedule(Schedule* schedule) {
static SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
SmartArrayPointer<char> name;
if (info->IsStub()) {
if (info->code_stub() != NULL) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
const char* major_name = CodeStub::MajorName(major_key, false);
size_t len = strlen(major_name);
name.Reset(new char[len]);
memcpy(name.get(), major_name, len);
}
if (info->code_stub() != NULL) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
const char* major_name = CodeStub::MajorName(major_key, false);
size_t len = strlen(major_name) + 1;
SmartArrayPointer<char> name(new char[len]);
memcpy(name.get(), major_name, len);
return name;
} else {
AllowHandleDereference allow_deref;
name = info->function()->debug_name()->ToCString();
return info->function()->debug_name()->ToCString();
}
return name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment