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

Side by Side Diff: src/gdb-jit.cc

Issue 23625003: Cleanup Mutex and related classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug-agent.cc ('k') | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 static LazyMutex mutex = LAZY_MUTEX_INITIALIZER; 2056 static LazyMutex mutex = LAZY_MUTEX_INITIALIZER;
2057 2057
2058 2058
2059 void GDBJITInterface::AddCode(const char* name, 2059 void GDBJITInterface::AddCode(const char* name,
2060 Code* code, 2060 Code* code,
2061 GDBJITInterface::CodeTag tag, 2061 GDBJITInterface::CodeTag tag,
2062 Script* script, 2062 Script* script,
2063 CompilationInfo* info) { 2063 CompilationInfo* info) {
2064 if (!FLAG_gdbjit) return; 2064 if (!FLAG_gdbjit) return;
2065 2065
2066 ScopedLock lock(mutex.Pointer()); 2066 LockGuard<Mutex> lock_guard(mutex.Pointer());
2067 DisallowHeapAllocation no_gc; 2067 DisallowHeapAllocation no_gc;
2068 2068
2069 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); 2069 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
2070 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; 2070 if (e->value != NULL && !IsLineInfoTagged(e->value)) return;
2071 2071
2072 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); 2072 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value);
2073 CodeDescription code_desc(name, 2073 CodeDescription code_desc(name,
2074 code, 2074 code,
2075 script != NULL ? Handle<Script>(script) 2075 script != NULL ? Handle<Script>(script)
2076 : Handle<Script>(), 2076 : Handle<Script>(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { 2142 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) {
2143 if (!FLAG_gdbjit) return; 2143 if (!FLAG_gdbjit) return;
2144 2144
2145 AddCode(tag, "", code); 2145 AddCode(tag, "", code);
2146 } 2146 }
2147 2147
2148 2148
2149 void GDBJITInterface::RemoveCode(Code* code) { 2149 void GDBJITInterface::RemoveCode(Code* code) {
2150 if (!FLAG_gdbjit) return; 2150 if (!FLAG_gdbjit) return;
2151 2151
2152 ScopedLock lock(mutex.Pointer()); 2152 LockGuard<Mutex> lock_guard(mutex.Pointer());
2153 HashMap::Entry* e = GetEntries()->Lookup(code, 2153 HashMap::Entry* e = GetEntries()->Lookup(code,
2154 HashForCodeObject(code), 2154 HashForCodeObject(code),
2155 false); 2155 false);
2156 if (e == NULL) return; 2156 if (e == NULL) return;
2157 2157
2158 if (IsLineInfoTagged(e->value)) { 2158 if (IsLineInfoTagged(e->value)) {
2159 delete UntagLineInfo(e->value); 2159 delete UntagLineInfo(e->value);
2160 } else { 2160 } else {
2161 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); 2161 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value);
2162 UnregisterCodeEntry(entry); 2162 UnregisterCodeEntry(entry);
(...skipping 17 matching lines...) Expand all
2180 } 2180 }
2181 2181
2182 for (int i = 0; i < dead_codes.length(); i++) { 2182 for (int i = 0; i < dead_codes.length(); i++) {
2183 RemoveCode(dead_codes.at(i)); 2183 RemoveCode(dead_codes.at(i));
2184 } 2184 }
2185 } 2185 }
2186 2186
2187 2187
2188 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, 2188 void GDBJITInterface::RegisterDetailedLineInfo(Code* code,
2189 GDBJITLineInfo* line_info) { 2189 GDBJITLineInfo* line_info) {
2190 ScopedLock lock(mutex.Pointer()); 2190 LockGuard<Mutex> lock_guard(mutex.Pointer());
2191 ASSERT(!IsLineInfoTagged(line_info)); 2191 ASSERT(!IsLineInfoTagged(line_info));
2192 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); 2192 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
2193 ASSERT(e->value == NULL); 2193 ASSERT(e->value == NULL);
2194 e->value = TagLineInfo(line_info); 2194 e->value = TagLineInfo(line_info);
2195 } 2195 }
2196 2196
2197 2197
2198 } } // namespace v8::internal 2198 } } // namespace v8::internal
2199 #endif 2199 #endif
OLDNEW
« no previous file with comments | « src/debug-agent.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698