OLD | NEW |
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 Loading... |
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" | |
37 #include "natives.h" | 36 #include "natives.h" |
38 #include "scopeinfo.h" | 37 #include "scopeinfo.h" |
39 | 38 |
40 namespace v8 { | 39 namespace v8 { |
41 namespace internal { | 40 namespace internal { |
42 | 41 |
43 #ifdef __APPLE__ | 42 #ifdef __APPLE__ |
44 #define __MACH_O | 43 #define __MACH_O |
45 class MachO; | 44 class MachO; |
46 class MachOSection; | 45 class MachOSection; |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 desc->CodeStart()); | 2028 desc->CodeStart()); |
2030 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, | 2029 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, |
2031 desc->CodeStart()); | 2030 desc->CodeStart()); |
2032 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, | 2031 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, |
2033 desc->CodeEnd()); | 2032 desc->CodeEnd()); |
2034 } | 2033 } |
2035 #endif // V8_TARGET_ARCH_X64 | 2034 #endif // V8_TARGET_ARCH_X64 |
2036 } | 2035 } |
2037 | 2036 |
2038 | 2037 |
2039 static LazyMutex mutex = LAZY_MUTEX_INITIALIZER; | 2038 Mutex* GDBJITInterface::mutex_ = OS::CreateMutex(); |
2040 | 2039 |
2041 | 2040 |
2042 void GDBJITInterface::AddCode(const char* name, | 2041 void GDBJITInterface::AddCode(const char* name, |
2043 Code* code, | 2042 Code* code, |
2044 GDBJITInterface::CodeTag tag, | 2043 GDBJITInterface::CodeTag tag, |
2045 Script* script, | 2044 Script* script, |
2046 CompilationInfo* info) { | 2045 CompilationInfo* info) { |
2047 if (!FLAG_gdbjit) return; | 2046 if (!FLAG_gdbjit) return; |
2048 | 2047 |
2049 ScopedLock lock(mutex.Pointer()); | 2048 ScopedLock lock(mutex_); |
2050 AssertNoAllocation no_gc; | 2049 AssertNoAllocation no_gc; |
2051 | 2050 |
2052 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2051 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2053 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 2052 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
2054 | 2053 |
2055 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 2054 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
2056 CodeDescription code_desc(name, | 2055 CodeDescription code_desc(name, |
2057 code, | 2056 code, |
2058 script != NULL ? Handle<Script>(script) | 2057 script != NULL ? Handle<Script>(script) |
2059 : Handle<Script>(), | 2058 : Handle<Script>(), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 2119 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
2121 if (!FLAG_gdbjit) return; | 2120 if (!FLAG_gdbjit) return; |
2122 | 2121 |
2123 AddCode(tag, "", code); | 2122 AddCode(tag, "", code); |
2124 } | 2123 } |
2125 | 2124 |
2126 | 2125 |
2127 void GDBJITInterface::RemoveCode(Code* code) { | 2126 void GDBJITInterface::RemoveCode(Code* code) { |
2128 if (!FLAG_gdbjit) return; | 2127 if (!FLAG_gdbjit) return; |
2129 | 2128 |
2130 ScopedLock lock(mutex.Pointer()); | 2129 ScopedLock lock(mutex_); |
2131 HashMap::Entry* e = GetEntries()->Lookup(code, | 2130 HashMap::Entry* e = GetEntries()->Lookup(code, |
2132 HashForCodeObject(code), | 2131 HashForCodeObject(code), |
2133 false); | 2132 false); |
2134 if (e == NULL) return; | 2133 if (e == NULL) return; |
2135 | 2134 |
2136 if (IsLineInfoTagged(e->value)) { | 2135 if (IsLineInfoTagged(e->value)) { |
2137 delete UntagLineInfo(e->value); | 2136 delete UntagLineInfo(e->value); |
2138 } else { | 2137 } else { |
2139 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 2138 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
2140 UnregisterCodeEntry(entry); | 2139 UnregisterCodeEntry(entry); |
2141 DestroyCodeEntry(entry); | 2140 DestroyCodeEntry(entry); |
2142 } | 2141 } |
2143 e->value = NULL; | 2142 e->value = NULL; |
2144 GetEntries()->Remove(code, HashForCodeObject(code)); | 2143 GetEntries()->Remove(code, HashForCodeObject(code)); |
2145 } | 2144 } |
2146 | 2145 |
2147 | 2146 |
2148 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 2147 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
2149 GDBJITLineInfo* line_info) { | 2148 GDBJITLineInfo* line_info) { |
2150 ScopedLock lock(mutex.Pointer()); | 2149 ScopedLock lock(mutex_); |
2151 ASSERT(!IsLineInfoTagged(line_info)); | 2150 ASSERT(!IsLineInfoTagged(line_info)); |
2152 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2151 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
2153 ASSERT(e->value == NULL); | 2152 ASSERT(e->value == NULL); |
2154 e->value = TagLineInfo(line_info); | 2153 e->value = TagLineInfo(line_info); |
2155 } | 2154 } |
2156 | 2155 |
2157 | 2156 |
2158 } } // namespace v8::internal | 2157 } } // namespace v8::internal |
2159 #endif | 2158 #endif |
OLD | NEW |