| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 bool InstallExperimentalNatives(); | 207 bool InstallExperimentalNatives(); |
| 208 void InstallBuiltinFunctionIds(); | 208 void InstallBuiltinFunctionIds(); |
| 209 void InstallJSFunctionResultCaches(); | 209 void InstallJSFunctionResultCaches(); |
| 210 void InitializeNormalizedMapCaches(); | 210 void InitializeNormalizedMapCaches(); |
| 211 | 211 |
| 212 enum ExtensionTraversalState { | 212 enum ExtensionTraversalState { |
| 213 UNVISITED, VISITED, INSTALLED | 213 UNVISITED, VISITED, INSTALLED |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 class ExtensionStates { | 216 class ExtensionStates { |
| 217 public: | 217 public: |
| 218 ExtensionStates(); | 218 ExtensionStates(); |
| 219 ExtensionTraversalState get_state(RegisteredExtension* extension); | 219 ExtensionTraversalState get_state(RegisteredExtension* extension); |
| 220 void set_state(RegisteredExtension* extension, | 220 void set_state(RegisteredExtension* extension, |
| 221 ExtensionTraversalState state); | 221 ExtensionTraversalState state); |
| 222 private: | 222 private: |
| 223 Allocator allocator_; | |
| 224 HashMap map_; | 223 HashMap map_; |
| 225 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); | 224 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); |
| 226 }; | 225 }; |
| 227 | 226 |
| 228 // Used both for deserialized and from-scratch contexts to add the extensions | 227 // Used both for deserialized and from-scratch contexts to add the extensions |
| 229 // provided. | 228 // provided. |
| 230 static bool InstallExtensions(Handle<Context> global_context, | 229 static bool InstallExtensions(Handle<Context> global_context, |
| 231 v8::ExtensionConfiguration* extensions); | 230 v8::ExtensionConfiguration* extensions); |
| 232 static bool InstallExtension(const char* name, | 231 static bool InstallExtension(const char* name, |
| 233 ExtensionStates* extension_states); | 232 ExtensionStates* extension_states); |
| (...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 | 1953 |
| 1955 static uint32_t Hash(RegisteredExtension* extension) { | 1954 static uint32_t Hash(RegisteredExtension* extension) { |
| 1956 return v8::internal::ComputePointerHash(extension); | 1955 return v8::internal::ComputePointerHash(extension); |
| 1957 } | 1956 } |
| 1958 | 1957 |
| 1959 static bool MatchRegisteredExtensions(void* key1, void* key2) { | 1958 static bool MatchRegisteredExtensions(void* key1, void* key2) { |
| 1960 return key1 == key2; | 1959 return key1 == key2; |
| 1961 } | 1960 } |
| 1962 | 1961 |
| 1963 Genesis::ExtensionStates::ExtensionStates() | 1962 Genesis::ExtensionStates::ExtensionStates() |
| 1964 : allocator_(), | 1963 : map_(MatchRegisteredExtensions, 8) { } |
| 1965 map_(MatchRegisteredExtensions, &allocator_, 8) | |
| 1966 {} | |
| 1967 | 1964 |
| 1968 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( | 1965 Genesis::ExtensionTraversalState Genesis::ExtensionStates::get_state( |
| 1969 RegisteredExtension* extension) { | 1966 RegisteredExtension* extension) { |
| 1970 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension), false); | 1967 i::HashMap::Entry* entry = map_.Lookup(extension, Hash(extension), false); |
| 1971 if (entry == NULL) { | 1968 if (entry == NULL) { |
| 1972 return UNVISITED; | 1969 return UNVISITED; |
| 1973 } | 1970 } |
| 1974 return static_cast<ExtensionTraversalState>( | 1971 return static_cast<ExtensionTraversalState>( |
| 1975 reinterpret_cast<intptr_t>(entry->value)); | 1972 reinterpret_cast<intptr_t>(entry->value)); |
| 1976 } | 1973 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 return from + sizeof(NestingCounterType); | 2356 return from + sizeof(NestingCounterType); |
| 2360 } | 2357 } |
| 2361 | 2358 |
| 2362 | 2359 |
| 2363 // Called when the top-level V8 mutex is destroyed. | 2360 // Called when the top-level V8 mutex is destroyed. |
| 2364 void Bootstrapper::FreeThreadResources() { | 2361 void Bootstrapper::FreeThreadResources() { |
| 2365 ASSERT(!IsActive()); | 2362 ASSERT(!IsActive()); |
| 2366 } | 2363 } |
| 2367 | 2364 |
| 2368 } } // namespace v8::internal | 2365 } } // namespace v8::internal |
| OLD | NEW |