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

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

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « src/debug/debug.h ('k') | src/hashmap.h » ('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 // 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
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
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
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/hashmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698