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 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 bool Genesis::InstallExtension(Isolate* isolate, | 2286 bool Genesis::InstallExtension(Isolate* isolate, |
2287 const char* name, | 2287 const char* name, |
2288 ExtensionStates* extension_states) { | 2288 ExtensionStates* extension_states) { |
2289 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); | 2289 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); |
2290 // Loop until we find the relevant extension | 2290 // Loop until we find the relevant extension |
2291 while (current != NULL) { | 2291 while (current != NULL) { |
2292 if (strcmp(name, current->extension()->name()) == 0) break; | 2292 if (strcmp(name, current->extension()->name()) == 0) break; |
2293 current = current->next(); | 2293 current = current->next(); |
2294 } | 2294 } |
2295 // Didn't find the extension; fail. | 2295 // Didn't find the extension; fail. |
2296 if (current == NULL) { | 2296 if (!Utils::ApiCheck(current != NULL, |
2297 v8::Utils::ReportApiFailure( | 2297 "v8::Context::New()", |
2298 "v8::Context::New()", "Cannot find required extension"); | 2298 "Cannot find required extension")) { |
2299 return false; | 2299 return false; |
2300 } | 2300 } |
2301 return InstallExtension(isolate, current, extension_states); | 2301 return InstallExtension(isolate, current, extension_states); |
2302 } | 2302 } |
2303 | 2303 |
2304 | 2304 |
2305 bool Genesis::InstallExtension(Isolate* isolate, | 2305 bool Genesis::InstallExtension(Isolate* isolate, |
2306 v8::RegisteredExtension* current, | 2306 v8::RegisteredExtension* current, |
2307 ExtensionStates* extension_states) { | 2307 ExtensionStates* extension_states) { |
2308 HandleScope scope(isolate); | 2308 HandleScope scope(isolate); |
2309 | 2309 |
2310 if (extension_states->get_state(current) == INSTALLED) return true; | 2310 if (extension_states->get_state(current) == INSTALLED) return true; |
2311 // The current node has already been visited so there must be a | 2311 // The current node has already been visited so there must be a |
2312 // cycle in the dependency graph; fail. | 2312 // cycle in the dependency graph; fail. |
2313 if (extension_states->get_state(current) == VISITED) { | 2313 if (!Utils::ApiCheck(extension_states->get_state(current) != VISITED, |
2314 v8::Utils::ReportApiFailure( | 2314 "v8::Context::New()", |
2315 "v8::Context::New()", "Circular extension dependency"); | 2315 "Circular extension dependency")) { |
2316 return false; | 2316 return false; |
2317 } | 2317 } |
2318 ASSERT(extension_states->get_state(current) == UNVISITED); | 2318 ASSERT(extension_states->get_state(current) == UNVISITED); |
2319 extension_states->set_state(current, VISITED); | 2319 extension_states->set_state(current, VISITED); |
2320 v8::Extension* extension = current->extension(); | 2320 v8::Extension* extension = current->extension(); |
2321 // Install the extension's dependencies | 2321 // Install the extension's dependencies |
2322 for (int i = 0; i < extension->dependency_count(); i++) { | 2322 for (int i = 0; i < extension->dependency_count(); i++) { |
2323 if (!InstallExtension(isolate, | 2323 if (!InstallExtension(isolate, |
2324 extension->dependencies()[i], | 2324 extension->dependencies()[i], |
2325 extension_states)) { | 2325 extension_states)) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 return from + sizeof(NestingCounterType); | 2704 return from + sizeof(NestingCounterType); |
2705 } | 2705 } |
2706 | 2706 |
2707 | 2707 |
2708 // Called when the top-level V8 mutex is destroyed. | 2708 // Called when the top-level V8 mutex is destroyed. |
2709 void Bootstrapper::FreeThreadResources() { | 2709 void Bootstrapper::FreeThreadResources() { |
2710 ASSERT(!IsActive()); | 2710 ASSERT(!IsActive()); |
2711 } | 2711 } |
2712 | 2712 |
2713 } } // namespace v8::internal | 2713 } } // namespace v8::internal |
OLD | NEW |