Remove AddCode and RemoveCode GDB JIT entry hooks.

R=verwaest@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22344 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9d047839
......@@ -1635,7 +1635,6 @@ void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) {
// Log the event and add the code to the builtins array.
PROFILE(isolate,
CodeCreateEvent(Logger::BUILTIN_TAG, *code, functions[i].s_name));
GDBJIT(AddCode(GDBJITInterface::BUILTIN, functions[i].s_name, *code));
builtins_[i] = *code;
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_builtin_code) {
......
......@@ -116,7 +116,6 @@ void CodeStub::RecordCodeGeneration(Handle<Code> code) {
OStringStream os;
os << *this;
PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, os.c_str()));
GDBJIT(AddCode(GDBJITInterface::STUB, os.c_str(), *code));
Counters* counters = isolate()->counters();
counters->total_stubs_code_size()->Increment(code->instruction_size());
}
......
......@@ -2063,8 +2063,6 @@ void GDBJITInterface::AddCode(const char* name,
GDBJITInterface::CodeTag tag,
Script* script,
CompilationInfo* info) {
if (!FLAG_gdbjit) return;
base::LockGuard<base::Mutex> lock_guard(mutex.Pointer());
DisallowHeapAllocation no_gc;
......@@ -2109,45 +2107,6 @@ void GDBJITInterface::AddCode(const char* name,
}
void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag,
const char* name,
Code* code) {
if (!FLAG_gdbjit) return;
EmbeddedVector<char, 256> buffer;
StringBuilder builder(buffer.start(), buffer.length());
builder.AddString(Tag2String(tag));
if ((name != NULL) && (*name != '\0')) {
builder.AddString(": ");
builder.AddString(name);
} else {
builder.AddFormatted(": code object %p", static_cast<void*>(code));
}
AddCode(builder.Finalize(), code, tag, NULL, NULL);
}
void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag,
Name* name,
Code* code) {
if (!FLAG_gdbjit) return;
if (name != NULL && name->IsString()) {
AddCode(tag, String::cast(name)->ToCString(DISALLOW_NULLS).get(), code);
} else {
AddCode(tag, "", code);
}
}
void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) {
if (!FLAG_gdbjit) return;
AddCode(tag, "", code);
}
void GDBJITInterface::RemoveCode(Code* code) {
if (!FLAG_gdbjit) return;
......@@ -2199,10 +2158,27 @@ static void RegisterDetailedLineInfo(Code* code, LineInfo* line_info) {
void GDBJITInterface::EventHandler(const v8::JitCodeEvent* event) {
if (!FLAG_gdbjit) return;
switch (event->type) {
case v8::JitCodeEvent::CODE_ADDED:
case v8::JitCodeEvent::CODE_ADDED: {
Code* code = Code::GetCodeFromTargetAddress(
reinterpret_cast<Address>(event->code_start));
if (code->kind() == Code::OPTIMIZED_FUNCTION ||
code->kind() == Code::FUNCTION) {
break;
}
EmbeddedVector<char, 256> buffer;
StringBuilder builder(buffer.start(), buffer.length());
builder.AddSubstring(event->name.str, static_cast<int>(event->name.len));
AddCode(builder.Finalize(), code, NON_FUNCTION, NULL, NULL);
break;
}
case v8::JitCodeEvent::CODE_MOVED:
case v8::JitCodeEvent::CODE_REMOVED:
break;
case v8::JitCodeEvent::CODE_REMOVED: {
Code* code = Code::GetCodeFromTargetAddress(
reinterpret_cast<Address>(event->code_start));
RemoveCode(code);
break;
}
case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: {
LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data);
line_info->SetPosition(static_cast<intptr_t>(event->line_info.offset),
......
......@@ -23,59 +23,25 @@ namespace internal {
class CompilationInfo;
#define CODE_TAGS_LIST(V) \
V(LOAD_IC) \
V(KEYED_LOAD_IC) \
V(STORE_IC) \
V(KEYED_STORE_IC) \
V(STUB) \
V(BUILTIN) \
V(SCRIPT) \
V(EVAL) \
V(FUNCTION)
class GDBJITInterface: public AllStatic {
public:
enum CodeTag {
#define V(x) x,
CODE_TAGS_LIST(V)
#undef V
TAG_COUNT
};
static const char* Tag2String(CodeTag tag) {
switch (tag) {
#define V(x) case x: return #x;
CODE_TAGS_LIST(V)
#undef V
default:
return NULL;
}
}
enum CodeTag { NON_FUNCTION, FUNCTION };
// Main entry point into GDB JIT realized as a JitCodeEventHandler.
static void EventHandler(const v8::JitCodeEvent* event);
static void AddCode(const char* name,
Code* code,
CodeTag tag,
Script* script,
CompilationInfo* info);
static void AddCode(Handle<Name> name,
Handle<Script> script,
Handle<Code> code,
CompilationInfo* info);
static void AddCode(CodeTag tag, Name* name, Code* code);
static void AddCode(CodeTag tag, const char* name, Code* code);
static void RemoveCodeRange(Address start, Address end);
static void AddCode(CodeTag tag, Code* code);
private:
static void AddCode(const char* name, Code* code, CodeTag tag, Script* script,
CompilationInfo* info);
static void RemoveCode(Code* code);
static void RemoveCodeRange(Address start, Address end);
};
#define GDBJIT(action) GDBJITInterface::action
......
......@@ -4315,11 +4315,6 @@ void MarkCompactCollector::EnableCodeFlushing(bool enable) {
// code objects. We should either reenable it or change our tools.
void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj,
Isolate* isolate) {
#ifdef ENABLE_GDB_JIT_INTERFACE
if (obj->IsCode()) {
GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj));
}
#endif
if (obj->IsCode()) {
PROFILE(isolate, CodeDeleteEvent(obj->address()));
}
......
......@@ -607,7 +607,6 @@ Handle<Code> StubCompiler::CompileLoadInitialize(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize");
PROFILE(isolate(),
CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
return code;
}
......@@ -617,7 +616,6 @@ Handle<Code> StubCompiler::CompileLoadPreMonomorphic(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic");
PROFILE(isolate(),
CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
return code;
}
......@@ -627,7 +625,6 @@ Handle<Code> StubCompiler::CompileLoadMegamorphic(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic");
PROFILE(isolate(),
CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
return code;
}
......@@ -637,7 +634,6 @@ Handle<Code> StubCompiler::CompileStoreInitialize(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize");
PROFILE(isolate(),
CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
return code;
}
......@@ -647,7 +643,6 @@ Handle<Code> StubCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic");
PROFILE(isolate(),
CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
return code;
}
......@@ -659,7 +654,6 @@ Handle<Code> StubCompiler::CompileStoreGeneric(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
PROFILE(isolate(),
CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
return code;
}
......@@ -669,7 +663,6 @@ Handle<Code> StubCompiler::CompileStoreMegamorphic(Code::Flags flags) {
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic");
PROFILE(isolate(),
CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0));
GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
return code;
}
......@@ -1166,23 +1159,6 @@ void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) {
}
void BaseLoadStoreStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
#ifdef ENABLE_GDB_JIT_INTERFACE
GDBJITInterface::CodeTag tag;
if (kind_ == Code::LOAD_IC) {
tag = GDBJITInterface::LOAD_IC;
} else if (kind_ == Code::KEYED_LOAD_IC) {
tag = GDBJITInterface::KEYED_LOAD_IC;
} else if (kind_ == Code::STORE_IC) {
tag = GDBJITInterface::STORE_IC;
} else {
tag = GDBJITInterface::KEYED_STORE_IC;
}
GDBJIT(AddCode(tag, *name, *code));
#endif
}
void BaseLoadStoreStubCompiler::InitializeRegisters() {
if (kind_ == Code::LOAD_IC) {
registers_ = LoadStubCompiler::registers();
......@@ -1204,7 +1180,6 @@ Handle<Code> BaseLoadStoreStubCompiler::GetICCode(Code::Kind kind,
Handle<Code> code = GetCodeWithFlags(flags, name);
IC::RegisterWeakMapDependency(code);
PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
JitEvent(name, code);
return code;
}
......@@ -1216,7 +1191,6 @@ Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind,
Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder_);
Handle<Code> code = GetCodeWithFlags(flags, name);
PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
JitEvent(name, code);
return code;
}
......
......@@ -486,7 +486,6 @@ class BaseLoadStoreStubCompiler: public StubCompiler {
? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG;
}
}
void JitEvent(Handle<Name> name, Handle<Code> code);
Register receiver() { return registers_[0]; }
Register name() { return registers_[1]; }
......
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