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 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 v8::ExtensionConfiguration* extensions) : isolate_(isolate) { | 2288 v8::ExtensionConfiguration* extensions) : isolate_(isolate) { |
2289 result_ = Handle<Context>::null(); | 2289 result_ = Handle<Context>::null(); |
2290 // If V8 isn't running and cannot be initialized, just return. | 2290 // If V8 isn't running and cannot be initialized, just return. |
2291 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; | 2291 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; |
2292 | 2292 |
2293 // Before creating the roots we must save the context and restore it | 2293 // Before creating the roots we must save the context and restore it |
2294 // on all function exits. | 2294 // on all function exits. |
2295 HandleScope scope; | 2295 HandleScope scope; |
2296 SaveContext saved_context(isolate); | 2296 SaveContext saved_context(isolate); |
2297 | 2297 |
| 2298 // During genesis, the boilerplate for stack overflow won't work until the |
| 2299 // environment has been at least partially initialized. Add a stack check |
| 2300 // before entering JS code to catch overflow early. |
| 2301 StackLimitCheck check(Isolate::Current()); |
| 2302 if (check.HasOverflowed()) return; |
| 2303 |
2298 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); | 2304 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); |
2299 if (!new_context.is_null()) { | 2305 if (!new_context.is_null()) { |
2300 global_context_ = | 2306 global_context_ = |
2301 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); | 2307 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); |
2302 AddToWeakGlobalContextList(*global_context_); | 2308 AddToWeakGlobalContextList(*global_context_); |
2303 isolate->set_context(*global_context_); | 2309 isolate->set_context(*global_context_); |
2304 isolate->counters()->contexts_created_by_snapshot()->Increment(); | 2310 isolate->counters()->contexts_created_by_snapshot()->Increment(); |
2305 Handle<GlobalObject> inner_global; | 2311 Handle<GlobalObject> inner_global; |
2306 Handle<JSGlobalProxy> global_proxy = | 2312 Handle<JSGlobalProxy> global_proxy = |
2307 CreateNewGlobals(global_template, | 2313 CreateNewGlobals(global_template, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 return from + sizeof(NestingCounterType); | 2368 return from + sizeof(NestingCounterType); |
2363 } | 2369 } |
2364 | 2370 |
2365 | 2371 |
2366 // Called when the top-level V8 mutex is destroyed. | 2372 // Called when the top-level V8 mutex is destroyed. |
2367 void Bootstrapper::FreeThreadResources() { | 2373 void Bootstrapper::FreeThreadResources() { |
2368 ASSERT(!IsActive()); | 2374 ASSERT(!IsActive()); |
2369 } | 2375 } |
2370 | 2376 |
2371 } } // namespace v8::internal | 2377 } } // namespace v8::internal |
OLD | NEW |