Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: src/compiler/pipeline.cc

Issue 1007283006: Make valgrind a bit more happy by zero-terminating/initializing strings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed useless assignment. Fixed a condition. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 247478f5dda639436f6341d4152fb867448f9a40..1c2e58383cf35262f629779e4803fe99980be435 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -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;
}
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698