Revision: 20337
Author:   [email protected]
Date:     Fri Mar 28 14:16:11 2014 UTC
Log:      Revert r20335 - "Raise StackOverflow during bootstrapping"

Reason for revert: New test crashes on nosnap bots

See https://github.com/joyent/node/issues/7120

[email protected]
BUG=

Review URL: https://codereview.chromium.org/178073002

Patch from Alexis Campailla <[email protected]>.

[email protected]
BUG=none
LOG=n

Review URL: https://codereview.chromium.org/217013002
http://code.google.com/p/v8/source/detail?r=20337

Modified:
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Fri Mar 28 13:26:20 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Fri Mar 28 14:16:11 2014 UTC
@@ -1476,6 +1476,11 @@
 #ifdef ENABLE_DEBUGGER_SUPPORT
   isolate->debugger()->set_compiling_natives(true);
 #endif
+ // During genesis, the boilerplate for stack overflow won't work until the
+  // environment has been at least partially initialized. Add a stack check
+  // before entering JS code to catch overflow early.
+  StackLimitCheck check(isolate);
+  if (check.HasOverflowed()) return false;

   bool result = CompileScriptCached(isolate,
                                     name,
@@ -2609,16 +2614,8 @@
// During genesis, the boilerplate for stack overflow won't work until the
   // environment has been at least partially initialized. Add a stack check
   // before entering JS code to catch overflow early.
-  const uint32_t stack_to_get_through_genesis = 3500 * sizeof(intptr_t);
   StackLimitCheck check(isolate);
-  if (check.WillOverflow(stack_to_get_through_genesis)) {
-    // Only raise a StackOverflow if there is a valid current context
-    if (isolate->context() != NULL) {
-      isolate->StackOverflow();
-      isolate->OptionalRescheduleException(true);
-    }
-    return;
-  }
+  if (check.HasOverflowed()) return;

   // We can only de-serialize a context if the isolate was initialized from
   // a snapshot. Otherwise we have to build the context from scratch.
=======================================
--- /branches/bleeding_edge/src/isolate.h       Fri Mar 28 13:26:20 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h       Fri Mar 28 14:16:11 2014 UTC
@@ -1438,11 +1438,6 @@
     StackGuard* stack_guard = isolate_->stack_guard();
return (reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit());
   }
-  bool WillOverflow(uint32_t additionalUsage) const {
-    StackGuard* stack_guard = isolate_->stack_guard();
- return (reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit() +
-        additionalUsage);
-  }
  private:
   Isolate* isolate_;
 };
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Mar 28 13:26:20 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Fri Mar 28 14:16:11 2014 UTC
@@ -5022,67 +5022,6 @@
   CHECK(message_received);
   v8::V8::RemoveMessageListeners(receive_message);
 }
-
-void APIStackOverflowNestedContextsHelper(bool is_bottom_call);
-
-void APIStackOverflowNestedContextsCallback(
-  const v8::FunctionCallbackInfo<Value>& args) {
-  APIStackOverflowNestedContextsHelper(false);
-}
-
-
-void APIStackOverflowNestedContextsHelper(bool is_bottom_call) {
-  v8::Isolate* isolate = CcTest::isolate();
-  TryCatch try_catch;
-
-  Local<ObjectTemplate> global = ObjectTemplate::New();
-  global->Set(String::NewFromUtf8(isolate, "recur"),
-  FunctionTemplate::New(isolate, APIStackOverflowNestedContextsCallback));
-
-  Local<Context> innerContext = Context::New(isolate, NULL, global);
-  if (try_catch.HasCaught()) {
-    try_catch.ReThrow();
-    return;
-  }
-  if (innerContext.IsEmpty()) return;
-
-  Context::Scope context_scope(innerContext);
-  Local<Script> script = v8::Script::Compile(v8::String::NewFromUtf8(
-      isolate,
-      "function f() {                             "
-      "  try { recur(); } catch(e) { throw e; }   "
-      "  return 'bad';                            "
-      "} f();                                     "));
-
-  Local<Value> result = script->Run();
-  CHECK(result.IsEmpty());
-  if (try_catch.HasCaught()) {
-    if (is_bottom_call) {
-      String::Utf8Value ex_value(try_catch.Exception());
-      CHECK_EQ("RangeError: Maximum call stack size exceeded", *ex_value);
-    }
-    try_catch.ReThrow();
-  }
-}
-
-
-void APIStackOverflowNestedContexts(int extra_stack_bytes) {
-  if (extra_stack_bytes) alloca(extra_stack_bytes);
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
-  APIStackOverflowNestedContextsHelper(true);
-  CHECK(try_catch.HasCaught());
-}
-
-
-TEST(APIStackOverflowNestedContexts) {
- // The place where a stack overflow can occur is not completely deterministic
-  // so probe a few different depths
-  APIStackOverflowNestedContexts(2500);
-  APIStackOverflowNestedContexts(2800);
-  APIStackOverflowNestedContexts(30000);
-}


 THREADED_TEST(ExternalScriptException) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to