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
This commit is contained in:
vegorov@chromium.org 2011-04-08 11:25:19 +00:00
parent 684aa3628f
commit 1a3bbebade
3 changed files with 11 additions and 1 deletions

View File

@ -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())));
}

View File

@ -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);

View File

@ -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