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 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 | 2507 |
2508 static uint32_t Hash(RegisteredExtension* extension) { | 2508 static uint32_t Hash(RegisteredExtension* extension) { |
2509 return v8::internal::ComputePointerHash(extension); | 2509 return v8::internal::ComputePointerHash(extension); |
2510 } | 2510 } |
2511 | 2511 |
2512 | 2512 |
2513 Genesis::ExtensionStates::ExtensionStates() : map_(HashMap::PointersMatch, 8) {} | 2513 Genesis::ExtensionStates::ExtensionStates() : map_(HashMap::PointersMatch, 8) {} |
2514 | 2514 |
2515 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( | 2515 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( |
2516 RegisteredExtension* extension) { | 2516 RegisteredExtension* extension) { |
2517 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension), false); | 2517 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension)); |
2518 if (entry == NULL) { | 2518 if (entry == NULL) { |
2519 return UNVISITED; | 2519 return UNVISITED; |
2520 } | 2520 } |
2521 return static_cast<ExtensionTraversalState>( | 2521 return static_cast<ExtensionTraversalState>( |
2522 reinterpret_cast<intptr_t>(entry->value)); | 2522 reinterpret_cast<intptr_t>(entry->value)); |
2523 } | 2523 } |
2524 | 2524 |
2525 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, | 2525 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, |
2526 ExtensionTraversalState state) { | 2526 ExtensionTraversalState state) { |
2527 map_.Lookup(extension, Hash(extension), true)->value = | 2527 map_.LookupOrInsert(extension, Hash(extension))->value = |
2528 reinterpret_cast<void*>(static_cast<intptr_t>(state)); | 2528 reinterpret_cast<void*>(static_cast<intptr_t>(state)); |
2529 } | 2529 } |
2530 | 2530 |
2531 | 2531 |
2532 bool Genesis::InstallExtensions(Handle<Context> native_context, | 2532 bool Genesis::InstallExtensions(Handle<Context> native_context, |
2533 v8::ExtensionConfiguration* extensions) { | 2533 v8::ExtensionConfiguration* extensions) { |
2534 Isolate* isolate = native_context->GetIsolate(); | 2534 Isolate* isolate = native_context->GetIsolate(); |
2535 ExtensionStates extension_states; // All extensions have state UNVISITED. | 2535 ExtensionStates extension_states; // All extensions have state UNVISITED. |
2536 return InstallAutoExtensions(isolate, &extension_states) && | 2536 return InstallAutoExtensions(isolate, &extension_states) && |
2537 (!FLAG_expose_free_buffer || | 2537 (!FLAG_expose_free_buffer || |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 return from + sizeof(NestingCounterType); | 2964 return from + sizeof(NestingCounterType); |
2965 } | 2965 } |
2966 | 2966 |
2967 | 2967 |
2968 // Called when the top-level V8 mutex is destroyed. | 2968 // Called when the top-level V8 mutex is destroyed. |
2969 void Bootstrapper::FreeThreadResources() { | 2969 void Bootstrapper::FreeThreadResources() { |
2970 DCHECK(!IsActive()); | 2970 DCHECK(!IsActive()); |
2971 } | 2971 } |
2972 | 2972 |
2973 } } // namespace v8::internal | 2973 } } // namespace v8::internal |
OLD | NEW |