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

Unified Diff: src/compiler.cc

Issue 1320103002: Improve handling of debug name in CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 7e2ea2597815aaf4f6fee1ea7c78f3b7402aece7..008bcfe9d38b131dc51869826b74f71f150eb04d 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -156,7 +156,7 @@ CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate,
: CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {}
CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
- const char* code_stub_debug_name, Mode mode,
+ const char* debug_name, Mode mode,
Isolate* isolate, Zone* zone)
: parse_info_(parse_info),
isolate_(isolate),
@@ -179,7 +179,7 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
optimization_id_(-1),
osr_expr_stack_height_(0),
function_type_(nullptr),
- code_stub_debug_name_(code_stub_debug_name) {
+ debug_name_(debug_name) {
// Parameter count is number of stack parameters.
if (code_stub_ != NULL) {
CodeStubDescriptor descriptor(code_stub_);
@@ -206,7 +206,7 @@ CompilationInfo::~CompilationInfo() {
void CompilationInfo::SetStub(CodeStub* code_stub) {
SetMode(STUB);
code_stub_ = code_stub;
- code_stub_debug_name_ = CodeStub::MajorName(code_stub->MajorKey());
+ debug_name_ = CodeStub::MajorName(code_stub->MajorKey());
}
@@ -311,15 +311,15 @@ void CompilationInfo::LogDeoptCallPosition(int pc_offset, int inlining_id) {
base::SmartArrayPointer<char> CompilationInfo::GetDebugName() const {
- if (IsStub()) {
- size_t len = strlen(code_stub_debug_name_) + 1;
- base::SmartArrayPointer<char> name(new char[len]);
- memcpy(name.get(), code_stub_debug_name_, len);
- return name;
- } else {
+ if (parse_info()) {
AllowHandleDereference allow_deref;
- return literal()->debug_name()->ToCString();
+ return parse_info()->literal()->debug_name()->ToCString();
}
+ const char* str = debug_name_ ? debug_name_ : "unknown";
+ size_t len = strlen(str) + 1;
+ base::SmartArrayPointer<char> name(new char[len]);
+ memcpy(name.get(), str, len);
+ return name;
}
« no previous file with comments | « src/compiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698