| OLD | NEW |
| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 UNVISITED, VISITED, INSTALLED | 228 UNVISITED, VISITED, INSTALLED |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 class ExtensionStates { | 231 class ExtensionStates { |
| 232 public: | 232 public: |
| 233 ExtensionStates(); | 233 ExtensionStates(); |
| 234 ExtensionTraversalState get_state(RegisteredExtension* extension); | 234 ExtensionTraversalState get_state(RegisteredExtension* extension); |
| 235 void set_state(RegisteredExtension* extension, | 235 void set_state(RegisteredExtension* extension, |
| 236 ExtensionTraversalState state); | 236 ExtensionTraversalState state); |
| 237 private: | 237 private: |
| 238 HashMap map_; | 238 base::HashMap map_; |
| 239 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); | 239 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 // Used both for deserialized and from-scratch contexts to add the extensions | 242 // Used both for deserialized and from-scratch contexts to add the extensions |
| 243 // provided. | 243 // provided. |
| 244 static bool InstallExtensions(Handle<Context> native_context, | 244 static bool InstallExtensions(Handle<Context> native_context, |
| 245 v8::ExtensionConfiguration* extensions); | 245 v8::ExtensionConfiguration* extensions); |
| 246 static bool InstallAutoExtensions(Isolate* isolate, | 246 static bool InstallAutoExtensions(Isolate* isolate, |
| 247 ExtensionStates* extension_states); | 247 ExtensionStates* extension_states); |
| 248 static bool InstallRequestedExtensions(Isolate* isolate, | 248 static bool InstallRequestedExtensions(Isolate* isolate, |
| (...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 } | 3303 } |
| 3304 | 3304 |
| 3305 return true; | 3305 return true; |
| 3306 } | 3306 } |
| 3307 | 3307 |
| 3308 | 3308 |
| 3309 static uint32_t Hash(RegisteredExtension* extension) { | 3309 static uint32_t Hash(RegisteredExtension* extension) { |
| 3310 return v8::internal::ComputePointerHash(extension); | 3310 return v8::internal::ComputePointerHash(extension); |
| 3311 } | 3311 } |
| 3312 | 3312 |
| 3313 | 3313 Genesis::ExtensionStates::ExtensionStates() |
| 3314 Genesis::ExtensionStates::ExtensionStates() : map_(HashMap::PointersMatch, 8) {} | 3314 : map_(base::HashMap::PointersMatch, 8) {} |
| 3315 | 3315 |
| 3316 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( | 3316 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( |
| 3317 RegisteredExtension* extension) { | 3317 RegisteredExtension* extension) { |
| 3318 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension)); | 3318 base::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension)); |
| 3319 if (entry == NULL) { | 3319 if (entry == NULL) { |
| 3320 return UNVISITED; | 3320 return UNVISITED; |
| 3321 } | 3321 } |
| 3322 return static_cast<ExtensionTraversalState>( | 3322 return static_cast<ExtensionTraversalState>( |
| 3323 reinterpret_cast<intptr_t>(entry->value)); | 3323 reinterpret_cast<intptr_t>(entry->value)); |
| 3324 } | 3324 } |
| 3325 | 3325 |
| 3326 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, | 3326 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, |
| 3327 ExtensionTraversalState state) { | 3327 ExtensionTraversalState state) { |
| 3328 map_.LookupOrInsert(extension, Hash(extension))->value = | 3328 map_.LookupOrInsert(extension, Hash(extension))->value = |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 } | 3795 } |
| 3796 | 3796 |
| 3797 | 3797 |
| 3798 // Called when the top-level V8 mutex is destroyed. | 3798 // Called when the top-level V8 mutex is destroyed. |
| 3799 void Bootstrapper::FreeThreadResources() { | 3799 void Bootstrapper::FreeThreadResources() { |
| 3800 DCHECK(!IsActive()); | 3800 DCHECK(!IsActive()); |
| 3801 } | 3801 } |
| 3802 | 3802 |
| 3803 } // namespace internal | 3803 } // namespace internal |
| 3804 } // namespace v8 | 3804 } // namespace v8 |
| OLD | NEW |