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

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

Issue 9666052: Landing for pliard@chromium.org: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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/gdb-jit.h ('k') | src/heap.cc » ('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 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifdef ENABLE_GDB_JIT_INTERFACE 28 #ifdef ENABLE_GDB_JIT_INTERFACE
29 #include "v8.h" 29 #include "v8.h"
30 #include "gdb-jit.h" 30 #include "gdb-jit.h"
31 31
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "compiler.h" 33 #include "compiler.h"
34 #include "global-handles.h" 34 #include "global-handles.h"
35 #include "messages.h" 35 #include "messages.h"
36 #include "platform.h"
36 #include "natives.h" 37 #include "natives.h"
37 #include "scopeinfo.h" 38 #include "scopeinfo.h"
38 39
39 namespace v8 { 40 namespace v8 {
40 namespace internal { 41 namespace internal {
41 42
42 #ifdef __APPLE__ 43 #ifdef __APPLE__
43 #define __MACH_O 44 #define __MACH_O
44 class MachO; 45 class MachO;
45 class MachOSection; 46 class MachOSection;
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 desc->CodeStart()); 2029 desc->CodeStart());
2029 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, 2030 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET,
2030 desc->CodeStart()); 2031 desc->CodeStart());
2031 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, 2032 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP,
2032 desc->CodeEnd()); 2033 desc->CodeEnd());
2033 } 2034 }
2034 #endif // V8_TARGET_ARCH_X64 2035 #endif // V8_TARGET_ARCH_X64
2035 } 2036 }
2036 2037
2037 2038
2038 Mutex* GDBJITInterface::mutex_ = OS::CreateMutex(); 2039 static LazyMutex mutex = LAZY_MUTEX_INITIALIZER;
2039 2040
2040 2041
2041 void GDBJITInterface::AddCode(const char* name, 2042 void GDBJITInterface::AddCode(const char* name,
2042 Code* code, 2043 Code* code,
2043 GDBJITInterface::CodeTag tag, 2044 GDBJITInterface::CodeTag tag,
2044 Script* script, 2045 Script* script,
2045 CompilationInfo* info) { 2046 CompilationInfo* info) {
2046 if (!FLAG_gdbjit) return; 2047 if (!FLAG_gdbjit) return;
2047 2048
2048 ScopedLock lock(mutex_); 2049 ScopedLock lock(mutex.Pointer());
2049 AssertNoAllocation no_gc; 2050 AssertNoAllocation no_gc;
2050 2051
2051 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); 2052 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
2052 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; 2053 if (e->value != NULL && !IsLineInfoTagged(e->value)) return;
2053 2054
2054 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); 2055 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value);
2055 CodeDescription code_desc(name, 2056 CodeDescription code_desc(name,
2056 code, 2057 code,
2057 script != NULL ? Handle<Script>(script) 2058 script != NULL ? Handle<Script>(script)
2058 : Handle<Script>(), 2059 : Handle<Script>(),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { 2120 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) {
2120 if (!FLAG_gdbjit) return; 2121 if (!FLAG_gdbjit) return;
2121 2122
2122 AddCode(tag, "", code); 2123 AddCode(tag, "", code);
2123 } 2124 }
2124 2125
2125 2126
2126 void GDBJITInterface::RemoveCode(Code* code) { 2127 void GDBJITInterface::RemoveCode(Code* code) {
2127 if (!FLAG_gdbjit) return; 2128 if (!FLAG_gdbjit) return;
2128 2129
2129 ScopedLock lock(mutex_); 2130 ScopedLock lock(mutex.Pointer());
2130 HashMap::Entry* e = GetEntries()->Lookup(code, 2131 HashMap::Entry* e = GetEntries()->Lookup(code,
2131 HashForCodeObject(code), 2132 HashForCodeObject(code),
2132 false); 2133 false);
2133 if (e == NULL) return; 2134 if (e == NULL) return;
2134 2135
2135 if (IsLineInfoTagged(e->value)) { 2136 if (IsLineInfoTagged(e->value)) {
2136 delete UntagLineInfo(e->value); 2137 delete UntagLineInfo(e->value);
2137 } else { 2138 } else {
2138 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); 2139 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value);
2139 UnregisterCodeEntry(entry); 2140 UnregisterCodeEntry(entry);
2140 DestroyCodeEntry(entry); 2141 DestroyCodeEntry(entry);
2141 } 2142 }
2142 e->value = NULL; 2143 e->value = NULL;
2143 GetEntries()->Remove(code, HashForCodeObject(code)); 2144 GetEntries()->Remove(code, HashForCodeObject(code));
2144 } 2145 }
2145 2146
2146 2147
2147 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, 2148 void GDBJITInterface::RegisterDetailedLineInfo(Code* code,
2148 GDBJITLineInfo* line_info) { 2149 GDBJITLineInfo* line_info) {
2149 ScopedLock lock(mutex_); 2150 ScopedLock lock(mutex.Pointer());
2150 ASSERT(!IsLineInfoTagged(line_info)); 2151 ASSERT(!IsLineInfoTagged(line_info));
2151 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); 2152 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true);
2152 ASSERT(e->value == NULL); 2153 ASSERT(e->value == NULL);
2153 e->value = TagLineInfo(line_info); 2154 e->value = TagLineInfo(line_info);
2154 } 2155 }
2155 2156
2156 2157
2157 } } // namespace v8::internal 2158 } } // namespace v8::internal
2158 #endif 2159 #endif
OLDNEW
« no previous file with comments | « src/gdb-jit.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698