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 #include "src/gdb-jit.h" | 5 #include "src/gdb-jit.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 return code_map; | 2005 return code_map; |
2006 } | 2006 } |
2007 | 2007 |
2008 | 2008 |
2009 static uint32_t HashCodeAddress(Address addr) { | 2009 static uint32_t HashCodeAddress(Address addr) { |
2010 static const uintptr_t kGoldenRatio = 2654435761u; | 2010 static const uintptr_t kGoldenRatio = 2654435761u; |
2011 uintptr_t offset = OffsetFrom(addr); | 2011 uintptr_t offset = OffsetFrom(addr); |
2012 return static_cast<uint32_t>((offset >> kCodeAlignmentBits) * kGoldenRatio); | 2012 return static_cast<uint32_t>((offset >> kCodeAlignmentBits) * kGoldenRatio); |
2013 } | 2013 } |
2014 | 2014 |
2015 | 2015 static base::HashMap* GetLineMap() { |
2016 static HashMap* GetLineMap() { | 2016 static base::HashMap* line_map = NULL; |
2017 static HashMap* line_map = NULL; | 2017 if (line_map == NULL) { |
2018 if (line_map == NULL) line_map = new HashMap(&HashMap::PointersMatch); | 2018 line_map = new base::HashMap(&base::HashMap::PointersMatch); |
| 2019 } |
2019 return line_map; | 2020 return line_map; |
2020 } | 2021 } |
2021 | 2022 |
2022 | 2023 |
2023 static void PutLineInfo(Address addr, LineInfo* info) { | 2024 static void PutLineInfo(Address addr, LineInfo* info) { |
2024 HashMap* line_map = GetLineMap(); | 2025 base::HashMap* line_map = GetLineMap(); |
2025 HashMap::Entry* e = line_map->LookupOrInsert(addr, HashCodeAddress(addr)); | 2026 base::HashMap::Entry* e = |
| 2027 line_map->LookupOrInsert(addr, HashCodeAddress(addr)); |
2026 if (e->value != NULL) delete static_cast<LineInfo*>(e->value); | 2028 if (e->value != NULL) delete static_cast<LineInfo*>(e->value); |
2027 e->value = info; | 2029 e->value = info; |
2028 } | 2030 } |
2029 | 2031 |
2030 | 2032 |
2031 static LineInfo* GetLineInfo(Address addr) { | 2033 static LineInfo* GetLineInfo(Address addr) { |
2032 void* value = GetLineMap()->Remove(addr, HashCodeAddress(addr)); | 2034 void* value = GetLineMap()->Remove(addr, HashCodeAddress(addr)); |
2033 return static_cast<LineInfo*>(value); | 2035 return static_cast<LineInfo*>(value); |
2034 } | 2036 } |
2035 | 2037 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); | 2212 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); |
2211 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); | 2213 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); |
2212 break; | 2214 break; |
2213 } | 2215 } |
2214 } | 2216 } |
2215 } | 2217 } |
2216 #endif | 2218 #endif |
2217 } // namespace GDBJITInterface | 2219 } // namespace GDBJITInterface |
2218 } // namespace internal | 2220 } // namespace internal |
2219 } // namespace v8 | 2221 } // namespace v8 |
OLD | NEW |