Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: src/bootstrapper.cc

Issue 217013002: Revert r20335 - "Raise StackOverflow during bootstrapping" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 } 1469 }
1470 1470
1471 1471
1472 bool Genesis::CompileNative(Isolate* isolate, 1472 bool Genesis::CompileNative(Isolate* isolate,
1473 Vector<const char> name, 1473 Vector<const char> name,
1474 Handle<String> source) { 1474 Handle<String> source) {
1475 HandleScope scope(isolate); 1475 HandleScope scope(isolate);
1476 #ifdef ENABLE_DEBUGGER_SUPPORT 1476 #ifdef ENABLE_DEBUGGER_SUPPORT
1477 isolate->debugger()->set_compiling_natives(true); 1477 isolate->debugger()->set_compiling_natives(true);
1478 #endif 1478 #endif
1479 // During genesis, the boilerplate for stack overflow won't work until the
1480 // environment has been at least partially initialized. Add a stack check
1481 // before entering JS code to catch overflow early.
1482 StackLimitCheck check(isolate);
1483 if (check.HasOverflowed()) return false;
1479 1484
1480 bool result = CompileScriptCached(isolate, 1485 bool result = CompileScriptCached(isolate,
1481 name, 1486 name,
1482 source, 1487 source,
1483 NULL, 1488 NULL,
1484 NULL, 1489 NULL,
1485 Handle<Context>(isolate->context()), 1490 Handle<Context>(isolate->context()),
1486 true); 1491 true);
1487 ASSERT(isolate->has_pending_exception() != result); 1492 ASSERT(isolate->has_pending_exception() != result);
1488 if (!result) isolate->clear_pending_exception(); 1493 if (!result) isolate->clear_pending_exception();
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 // If V8 cannot be initialized, just return. 2607 // If V8 cannot be initialized, just return.
2603 if (!V8::Initialize(NULL)) return; 2608 if (!V8::Initialize(NULL)) return;
2604 2609
2605 // Before creating the roots we must save the context and restore it 2610 // Before creating the roots we must save the context and restore it
2606 // on all function exits. 2611 // on all function exits.
2607 SaveContext saved_context(isolate); 2612 SaveContext saved_context(isolate);
2608 2613
2609 // During genesis, the boilerplate for stack overflow won't work until the 2614 // During genesis, the boilerplate for stack overflow won't work until the
2610 // environment has been at least partially initialized. Add a stack check 2615 // environment has been at least partially initialized. Add a stack check
2611 // before entering JS code to catch overflow early. 2616 // before entering JS code to catch overflow early.
2612 const uint32_t stack_to_get_through_genesis = 3500 * sizeof(intptr_t);
2613 StackLimitCheck check(isolate); 2617 StackLimitCheck check(isolate);
2614 if (check.WillOverflow(stack_to_get_through_genesis)) { 2618 if (check.HasOverflowed()) return;
2615 // Only raise a StackOverflow if there is a valid current context
2616 if (isolate->context() != NULL) {
2617 isolate->StackOverflow();
2618 isolate->OptionalRescheduleException(true);
2619 }
2620 return;
2621 }
2622 2619
2623 // We can only de-serialize a context if the isolate was initialized from 2620 // We can only de-serialize a context if the isolate was initialized from
2624 // a snapshot. Otherwise we have to build the context from scratch. 2621 // a snapshot. Otherwise we have to build the context from scratch.
2625 if (isolate->initialized_from_snapshot()) { 2622 if (isolate->initialized_from_snapshot()) {
2626 native_context_ = Snapshot::NewContextFromSnapshot(isolate); 2623 native_context_ = Snapshot::NewContextFromSnapshot(isolate);
2627 } else { 2624 } else {
2628 native_context_ = Handle<Context>(); 2625 native_context_ = Handle<Context>();
2629 } 2626 }
2630 2627
2631 if (!native_context().is_null()) { 2628 if (!native_context().is_null()) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 return from + sizeof(NestingCounterType); 2753 return from + sizeof(NestingCounterType);
2757 } 2754 }
2758 2755
2759 2756
2760 // Called when the top-level V8 mutex is destroyed. 2757 // Called when the top-level V8 mutex is destroyed.
2761 void Bootstrapper::FreeThreadResources() { 2758 void Bootstrapper::FreeThreadResources() {
2762 ASSERT(!IsActive()); 2759 ASSERT(!IsActive());
2763 } 2760 }
2764 2761
2765 } } // namespace v8::internal 2762 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698