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

Side by Side Diff: src/bootstrapper.cc

Issue 239133002: Refactoring: HashMap: provide a pointer match function, so users don't need to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/debug.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "bootstrapper.h" 5 #include "bootstrapper.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "natives.h" 9 #include "natives.h"
10 #include "snapshot.h" 10 #include "snapshot.h"
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 #endif 2172 #endif
2173 return true; 2173 return true;
2174 } 2174 }
2175 2175
2176 2176
2177 static uint32_t Hash(RegisteredExtension* extension) { 2177 static uint32_t Hash(RegisteredExtension* extension) {
2178 return v8::internal::ComputePointerHash(extension); 2178 return v8::internal::ComputePointerHash(extension);
2179 } 2179 }
2180 2180
2181 2181
2182 static bool MatchRegisteredExtensions(void* key1, void* key2) { 2182 Genesis::ExtensionStates::ExtensionStates() : map_(HashMap::PointersMatch, 8) {}
2183 return key1 == key2;
2184 }
2185
2186 Genesis::ExtensionStates::ExtensionStates()
2187 : map_(MatchRegisteredExtensions, 8) { }
2188 2183
2189 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( 2184 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state(
2190 RegisteredExtension* extension) { 2185 RegisteredExtension* extension) {
2191 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension), false); 2186 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension), false);
2192 if (entry == NULL) { 2187 if (entry == NULL) {
2193 return UNVISITED; 2188 return UNVISITED;
2194 } 2189 }
2195 return static_cast<ExtensionTraversalState>( 2190 return static_cast<ExtensionTraversalState>(
2196 reinterpret_cast<intptr_t>(entry->value)); 2191 reinterpret_cast<intptr_t>(entry->value));
2197 } 2192 }
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 return from + sizeof(NestingCounterType); 2684 return from + sizeof(NestingCounterType);
2690 } 2685 }
2691 2686
2692 2687
2693 // Called when the top-level V8 mutex is destroyed. 2688 // Called when the top-level V8 mutex is destroyed.
2694 void Bootstrapper::FreeThreadResources() { 2689 void Bootstrapper::FreeThreadResources() {
2695 ASSERT(!IsActive()); 2690 ASSERT(!IsActive());
2696 } 2691 }
2697 2692
2698 } } // namespace v8::internal 2693 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698