OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifdef ENABLE_GDB_JIT_INTERFACE | 5 #ifdef ENABLE_GDB_JIT_INTERFACE |
6 #include "src/v8.h" | 6 #include "src/v8.h" |
7 | 7 |
| 8 #include "src/base/platform/platform.h" |
8 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
9 #include "src/compiler.h" | 10 #include "src/compiler.h" |
10 #include "src/frames-inl.h" | 11 #include "src/frames-inl.h" |
11 #include "src/frames.h" | 12 #include "src/frames.h" |
12 #include "src/gdb-jit.h" | 13 #include "src/gdb-jit.h" |
13 #include "src/global-handles.h" | 14 #include "src/global-handles.h" |
14 #include "src/messages.h" | 15 #include "src/messages.h" |
15 #include "src/natives.h" | 16 #include "src/natives.h" |
16 #include "src/platform.h" | |
17 #include "src/scopes.h" | 17 #include "src/scopes.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 #ifdef __APPLE__ | 22 #ifdef __APPLE__ |
23 #define __MACH_O | 23 #define __MACH_O |
24 class MachO; | 24 class MachO; |
25 class MachOSection; | 25 class MachOSection; |
26 typedef MachO DebugObject; | 26 typedef MachO DebugObject; |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 desc->CodeStart()); | 2025 desc->CodeStart()); |
2026 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, | 2026 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, |
2027 desc->CodeStart()); | 2027 desc->CodeStart()); |
2028 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, | 2028 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, |
2029 desc->CodeEnd()); | 2029 desc->CodeEnd()); |
2030 } | 2030 } |
2031 #endif // V8_TARGET_ARCH_X64 | 2031 #endif // V8_TARGET_ARCH_X64 |
2032 } | 2032 } |
2033 | 2033 |
2034 | 2034 |
2035 static LazyMutex mutex = LAZY_MUTEX_INITIALIZER; | 2035 static base::LazyMutex mutex = LAZY_MUTEX_INITIALIZER; |
2036 | 2036 |
2037 | 2037 |
2038 void GDBJITInterface::AddCode(const char* name, | 2038 void GDBJITInterface::AddCode(const char* name, |
2039 Code* code, | 2039 Code* code, |
2040 GDBJITInterface::CodeTag tag, | 2040 GDBJITInterface::CodeTag tag, |
2041 Script* script, | 2041 Script* script, |
2042 CompilationInfo* info) { | 2042 CompilationInfo* info) { |
2043 if (!FLAG_gdbjit) return; | 2043 if (!FLAG_gdbjit) return; |
2044 | 2044 |
2045 LockGuard<Mutex> lock_guard(mutex.Pointer()); | 2045 base::LockGuard<base::Mutex> lock_guard(mutex.Pointer()); |
2046 DisallowHeapAllocation no_gc; | 2046 DisallowHeapAllocation no_gc; |
2047 | 2047 |
2048 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2048 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2049 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 2049 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
2050 | 2050 |
2051 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 2051 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
2052 CodeDescription code_desc(name, | 2052 CodeDescription code_desc(name, |
2053 code, | 2053 code, |
2054 script != NULL ? Handle<Script>(script) | 2054 script != NULL ? Handle<Script>(script) |
2055 : Handle<Script>(), | 2055 : Handle<Script>(), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 2121 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
2122 if (!FLAG_gdbjit) return; | 2122 if (!FLAG_gdbjit) return; |
2123 | 2123 |
2124 AddCode(tag, "", code); | 2124 AddCode(tag, "", code); |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2128 void GDBJITInterface::RemoveCode(Code* code) { | 2128 void GDBJITInterface::RemoveCode(Code* code) { |
2129 if (!FLAG_gdbjit) return; | 2129 if (!FLAG_gdbjit) return; |
2130 | 2130 |
2131 LockGuard<Mutex> lock_guard(mutex.Pointer()); | 2131 base::LockGuard<base::Mutex> lock_guard(mutex.Pointer()); |
2132 HashMap::Entry* e = GetEntries()->Lookup(code, | 2132 HashMap::Entry* e = GetEntries()->Lookup(code, |
2133 HashForCodeObject(code), | 2133 HashForCodeObject(code), |
2134 false); | 2134 false); |
2135 if (e == NULL) return; | 2135 if (e == NULL) return; |
2136 | 2136 |
2137 if (IsLineInfoTagged(e->value)) { | 2137 if (IsLineInfoTagged(e->value)) { |
2138 delete UntagLineInfo(e->value); | 2138 delete UntagLineInfo(e->value); |
2139 } else { | 2139 } else { |
2140 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 2140 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
2141 UnregisterCodeEntry(entry); | 2141 UnregisterCodeEntry(entry); |
(...skipping 17 matching lines...) Expand all Loading... |
2159 } | 2159 } |
2160 | 2160 |
2161 for (int i = 0; i < dead_codes.length(); i++) { | 2161 for (int i = 0; i < dead_codes.length(); i++) { |
2162 RemoveCode(dead_codes.at(i)); | 2162 RemoveCode(dead_codes.at(i)); |
2163 } | 2163 } |
2164 } | 2164 } |
2165 | 2165 |
2166 | 2166 |
2167 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 2167 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
2168 GDBJITLineInfo* line_info) { | 2168 GDBJITLineInfo* line_info) { |
2169 LockGuard<Mutex> lock_guard(mutex.Pointer()); | 2169 base::LockGuard<base::Mutex> lock_guard(mutex.Pointer()); |
2170 ASSERT(!IsLineInfoTagged(line_info)); | 2170 ASSERT(!IsLineInfoTagged(line_info)); |
2171 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2171 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2172 ASSERT(e->value == NULL); | 2172 ASSERT(e->value == NULL); |
2173 e->value = TagLineInfo(line_info); | 2173 e->value = TagLineInfo(line_info); |
2174 } | 2174 } |
2175 | 2175 |
2176 | 2176 |
2177 } } // namespace v8::internal | 2177 } } // namespace v8::internal |
2178 #endif | 2178 #endif |
OLD | NEW |