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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 Handle<JSFunction> fun = | 1361 Handle<JSFunction> fun = |
1356 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 1362 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
1357 | 1363 |
1358 // Call function using either the runtime object or the global | 1364 // Call function using either the runtime object or the global |
1359 // object as the receiver. Provide no parameters. | 1365 // object as the receiver. Provide no parameters. |
1360 Handle<Object> receiver = | 1366 Handle<Object> receiver = |
1361 Handle<Object>(use_runtime_context | 1367 Handle<Object>(use_runtime_context |
1362 ? top_context->builtins() | 1368 ? top_context->builtins() |
1363 : top_context->global()); | 1369 : top_context->global()); |
1364 bool has_pending_exception; | 1370 bool has_pending_exception; |
| 1371 |
1365 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); | 1372 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); |
1366 if (has_pending_exception) return false; | 1373 if (has_pending_exception) return false; |
1367 return true; | 1374 return true; |
1368 } | 1375 } |
1369 | 1376 |
1370 | 1377 |
1371 #define INSTALL_NATIVE(Type, name, var) \ | 1378 #define INSTALL_NATIVE(Type, name, var) \ |
1372 Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \ | 1379 Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \ |
1373 Object* var##_native = \ | 1380 Object* var##_native = \ |
1374 global_context()->builtins()->GetPropertyNoExceptionThrown( \ | 1381 global_context()->builtins()->GetPropertyNoExceptionThrown( \ |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 return from + sizeof(NestingCounterType); | 2363 return from + sizeof(NestingCounterType); |
2357 } | 2364 } |
2358 | 2365 |
2359 | 2366 |
2360 // Called when the top-level V8 mutex is destroyed. | 2367 // Called when the top-level V8 mutex is destroyed. |
2361 void Bootstrapper::FreeThreadResources() { | 2368 void Bootstrapper::FreeThreadResources() { |
2362 ASSERT(!IsActive()); | 2369 ASSERT(!IsActive()); |
2363 } | 2370 } |
2364 | 2371 |
2365 } } // namespace v8::internal | 2372 } } // namespace v8::internal |
OLD | NEW |