| 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 return CompileNative(name, source_code); | 1294 return CompileNative(name, source_code); |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 | 1297 |
| 1298 bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) { | 1298 bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) { |
| 1299 HandleScope scope; | 1299 HandleScope scope; |
| 1300 Isolate* isolate = source->GetIsolate(); | 1300 Isolate* isolate = source->GetIsolate(); |
| 1301 #ifdef ENABLE_DEBUGGER_SUPPORT | 1301 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1302 isolate->debugger()->set_compiling_natives(true); | 1302 isolate->debugger()->set_compiling_natives(true); |
| 1303 #endif | 1303 #endif |
| 1304 // During genesis, the boilerplate for stack overflow won't work until the |
| 1305 // environment has been at least partially initialized. Add a stack check |
| 1306 // before entering JS code to catch overflow early. |
| 1307 StackLimitCheck check(Isolate::Current()); |
| 1308 if (check.HasOverflowed()) return false; |
| 1309 |
| 1304 bool result = CompileScriptCached(name, | 1310 bool result = CompileScriptCached(name, |
| 1305 source, | 1311 source, |
| 1306 NULL, | 1312 NULL, |
| 1307 NULL, | 1313 NULL, |
| 1308 Handle<Context>(isolate->context()), | 1314 Handle<Context>(isolate->context()), |
| 1309 true); | 1315 true); |
| 1310 ASSERT(isolate->has_pending_exception() != result); | 1316 ASSERT(isolate->has_pending_exception() != result); |
| 1311 if (!result) isolate->clear_pending_exception(); | 1317 if (!result) isolate->clear_pending_exception(); |
| 1312 #ifdef ENABLE_DEBUGGER_SUPPORT | 1318 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1313 isolate->debugger()->set_compiling_natives(false); | 1319 isolate->debugger()->set_compiling_natives(false); |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 v8::ExtensionConfiguration* extensions) : isolate_(isolate) { | 2288 v8::ExtensionConfiguration* extensions) : isolate_(isolate) { |
| 2283 result_ = Handle<Context>::null(); | 2289 result_ = Handle<Context>::null(); |
| 2284 // If V8 isn't running and cannot be initialized, just return. | 2290 // If V8 isn't running and cannot be initialized, just return. |
| 2285 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; | 2291 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; |
| 2286 | 2292 |
| 2287 // 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 |
| 2288 // on all function exits. | 2294 // on all function exits. |
| 2289 HandleScope scope; | 2295 HandleScope scope; |
| 2290 SaveContext saved_context(isolate); | 2296 SaveContext saved_context(isolate); |
| 2291 | 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 |
| 2292 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); | 2304 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); |
| 2293 if (!new_context.is_null()) { | 2305 if (!new_context.is_null()) { |
| 2294 global_context_ = | 2306 global_context_ = |
| 2295 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); | 2307 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); |
| 2296 AddToWeakGlobalContextList(*global_context_); | 2308 AddToWeakGlobalContextList(*global_context_); |
| 2297 isolate->set_context(*global_context_); | 2309 isolate->set_context(*global_context_); |
| 2298 isolate->counters()->contexts_created_by_snapshot()->Increment(); | 2310 isolate->counters()->contexts_created_by_snapshot()->Increment(); |
| 2299 Handle<GlobalObject> inner_global; | 2311 Handle<GlobalObject> inner_global; |
| 2300 Handle<JSGlobalProxy> global_proxy = | 2312 Handle<JSGlobalProxy> global_proxy = |
| 2301 CreateNewGlobals(global_template, | 2313 CreateNewGlobals(global_template, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 return from + sizeof(NestingCounterType); | 2368 return from + sizeof(NestingCounterType); |
| 2357 } | 2369 } |
| 2358 | 2370 |
| 2359 | 2371 |
| 2360 // Called when the top-level V8 mutex is destroyed. | 2372 // Called when the top-level V8 mutex is destroyed. |
| 2361 void Bootstrapper::FreeThreadResources() { | 2373 void Bootstrapper::FreeThreadResources() { |
| 2362 ASSERT(!IsActive()); | 2374 ASSERT(!IsActive()); |
| 2363 } | 2375 } |
| 2364 | 2376 |
| 2365 } } // namespace v8::internal | 2377 } } // namespace v8::internal |
| OLD | NEW |