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

Side by Side Diff: src/bootstrapper.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/base/hashmap.h ('k') | src/compilation-cache.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 "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 UNVISITED, VISITED, INSTALLED 229 UNVISITED, VISITED, INSTALLED
230 }; 230 };
231 231
232 class ExtensionStates { 232 class ExtensionStates {
233 public: 233 public:
234 ExtensionStates(); 234 ExtensionStates();
235 ExtensionTraversalState get_state(RegisteredExtension* extension); 235 ExtensionTraversalState get_state(RegisteredExtension* extension);
236 void set_state(RegisteredExtension* extension, 236 void set_state(RegisteredExtension* extension,
237 ExtensionTraversalState state); 237 ExtensionTraversalState state);
238 private: 238 private:
239 HashMap map_; 239 base::HashMap map_;
240 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); 240 DISALLOW_COPY_AND_ASSIGN(ExtensionStates);
241 }; 241 };
242 242
243 // Used both for deserialized and from-scratch contexts to add the extensions 243 // Used both for deserialized and from-scratch contexts to add the extensions
244 // provided. 244 // provided.
245 static bool InstallExtensions(Handle<Context> native_context, 245 static bool InstallExtensions(Handle<Context> native_context,
246 v8::ExtensionConfiguration* extensions); 246 v8::ExtensionConfiguration* extensions);
247 static bool InstallAutoExtensions(Isolate* isolate, 247 static bool InstallAutoExtensions(Isolate* isolate,
248 ExtensionStates* extension_states); 248 ExtensionStates* extension_states);
249 static bool InstallRequestedExtensions(Isolate* isolate, 249 static bool InstallRequestedExtensions(Isolate* isolate,
(...skipping 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 } 3440 }
3441 3441
3442 return true; 3442 return true;
3443 } 3443 }
3444 3444
3445 3445
3446 static uint32_t Hash(RegisteredExtension* extension) { 3446 static uint32_t Hash(RegisteredExtension* extension) {
3447 return v8::internal::ComputePointerHash(extension); 3447 return v8::internal::ComputePointerHash(extension);
3448 } 3448 }
3449 3449
3450 3450 Genesis::ExtensionStates::ExtensionStates()
3451 Genesis::ExtensionStates::ExtensionStates() : map_(HashMap::PointersMatch, 8) {} 3451 : map_(base::HashMap::PointersMatch, 8) {}
3452 3452
3453 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( 3453 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state(
3454 RegisteredExtension* extension) { 3454 RegisteredExtension* extension) {
3455 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension)); 3455 base::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension));
3456 if (entry == NULL) { 3456 if (entry == NULL) {
3457 return UNVISITED; 3457 return UNVISITED;
3458 } 3458 }
3459 return static_cast<ExtensionTraversalState>( 3459 return static_cast<ExtensionTraversalState>(
3460 reinterpret_cast<intptr_t>(entry->value)); 3460 reinterpret_cast<intptr_t>(entry->value));
3461 } 3461 }
3462 3462
3463 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, 3463 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension,
3464 ExtensionTraversalState state) { 3464 ExtensionTraversalState state) {
3465 map_.LookupOrInsert(extension, Hash(extension))->value = 3465 map_.LookupOrInsert(extension, Hash(extension))->value =
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 } 3932 }
3933 3933
3934 3934
3935 // Called when the top-level V8 mutex is destroyed. 3935 // Called when the top-level V8 mutex is destroyed.
3936 void Bootstrapper::FreeThreadResources() { 3936 void Bootstrapper::FreeThreadResources() {
3937 DCHECK(!IsActive()); 3937 DCHECK(!IsActive());
3938 } 3938 }
3939 3939
3940 } // namespace internal 3940 } // namespace internal
3941 } // namespace v8 3941 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/hashmap.h ('k') | src/compilation-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698