| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 | 2009 |
| 2010 static uint32_t HashCodeAddress(Address addr) { | 2010 static uint32_t HashCodeAddress(Address addr) { |
| 2011 static const uintptr_t kGoldenRatio = 2654435761u; | 2011 static const uintptr_t kGoldenRatio = 2654435761u; |
| 2012 uintptr_t offset = OffsetFrom(addr); | 2012 uintptr_t offset = OffsetFrom(addr); |
| 2013 return static_cast<uint32_t>((offset >> kCodeAlignmentBits) * kGoldenRatio); | 2013 return static_cast<uint32_t>((offset >> kCodeAlignmentBits) * kGoldenRatio); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 static base::HashMap* GetLineMap() { | 2016 static base::HashMap* GetLineMap() { |
| 2017 static base::HashMap* line_map = NULL; | 2017 static base::HashMap* line_map = NULL; |
| 2018 if (line_map == NULL) { | 2018 if (line_map == NULL) { |
| 2019 line_map = new base::HashMap(&base::HashMap::PointersMatch); | 2019 line_map = new base::HashMap(); |
| 2020 } | 2020 } |
| 2021 return line_map; | 2021 return line_map; |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 | 2024 |
| 2025 static void PutLineInfo(Address addr, LineInfo* info) { | 2025 static void PutLineInfo(Address addr, LineInfo* info) { |
| 2026 base::HashMap* line_map = GetLineMap(); | 2026 base::HashMap* line_map = GetLineMap(); |
| 2027 base::HashMap::Entry* e = | 2027 base::HashMap::Entry* e = |
| 2028 line_map->LookupOrInsert(addr, HashCodeAddress(addr)); | 2028 line_map->LookupOrInsert(addr, HashCodeAddress(addr)); |
| 2029 if (e->value != NULL) delete static_cast<LineInfo*>(e->value); | 2029 if (e->value != NULL) delete static_cast<LineInfo*>(e->value); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); | 2213 LineInfo* line_info = reinterpret_cast<LineInfo*>(event->user_data); |
| 2214 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); | 2214 PutLineInfo(reinterpret_cast<Address>(event->code_start), line_info); |
| 2215 break; | 2215 break; |
| 2216 } | 2216 } |
| 2217 } | 2217 } |
| 2218 } | 2218 } |
| 2219 #endif | 2219 #endif |
| 2220 } // namespace GDBJITInterface | 2220 } // namespace GDBJITInterface |
| 2221 } // namespace internal | 2221 } // namespace internal |
| 2222 } // namespace v8 | 2222 } // namespace v8 |
| OLD | NEW |