Commit 1a3bbeba authored by vegorov@chromium.org's avatar vegorov@chromium.org

Fix compilation with gdbjit=on.

Ensure mutual exclusion on access to GDBJITInterface internal structures to make it work correctly with several isolates.

Review URL: http://codereview.chromium.org/6816053

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7557 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 684aa362
......@@ -784,7 +784,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
}
}
GDBJIT(AddCode(name,
GDBJIT(AddCode(Handle<String>(shared->DebugName()),
Handle<Script>(info->script()),
Handle<Code>(info->code())));
}
......
......@@ -1445,11 +1445,16 @@ static void AddUnwindInfo(CodeDescription *desc) {
}
Mutex* GDBJITInterface::mutex_ = OS::CreateMutex();
void GDBJITInterface::AddCode(const char* name,
Code* code,
GDBJITInterface::CodeTag tag,
Script* script) {
if (!FLAG_gdbjit) return;
ScopedLock lock(mutex_);
AssertNoAllocation no_gc;
HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
......@@ -1518,6 +1523,7 @@ void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) {
void GDBJITInterface::RemoveCode(Code* code) {
if (!FLAG_gdbjit) return;
ScopedLock lock(mutex_);
HashMap::Entry* e = GetEntries()->Lookup(code,
HashForCodeObject(code),
false);
......@@ -1537,6 +1543,7 @@ void GDBJITInterface::RemoveCode(Code* code) {
void GDBJITInterface::RegisterDetailedLineInfo(Code* code,
GDBJITLineInfo* line_info) {
ScopedLock lock(mutex_);
ASSERT(!IsLineInfoTagged(line_info));
HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
ASSERT(e->value == NULL);
......
......@@ -126,6 +126,9 @@ class GDBJITInterface: public AllStatic {
static void RemoveCode(Code* code);
static void RegisterDetailedLineInfo(Code* code, GDBJITLineInfo* line_info);
private:
static Mutex* mutex_;
};
#define GDBJIT(action) GDBJITInterface::action
......
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