From: ishell Date: Wed, 24 Jun 2015 14:57:39 +0000 (-0700) Subject: Ensure there is some space on JS stack available for bootstrapping. X-Git-Tag: upstream/4.7.83~1784 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=339ac2700decfeab70af8335aa57fe766278ba8c;p=platform%2Fupstream%2Fv8.git Ensure there is some space on JS stack available for bootstrapping. Review URL: https://codereview.chromium.org/1203873005 Cr-Commit-Position: refs/heads/master@{#29256} --- diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index f59830e..6131a76 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1541,7 +1541,7 @@ bool Genesis::CompileNative(Isolate* isolate, Vector name, // 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()) { + if (check.JsHasOverflowed(1 * KB)) { isolate->StackOverflow(); return false; } diff --git a/src/isolate.cc b/src/isolate.cc index 17f480c..f3d047f 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -2772,15 +2772,15 @@ void Isolate::CheckDetachedContextsAfterGC() { } -bool StackLimitCheck::JsHasOverflowed() const { +bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { StackGuard* stack_guard = isolate_->stack_guard(); #ifdef USE_SIMULATOR // The simulator uses a separate JS stack. Address jssp_address = Simulator::current(isolate_)->get_sp(); uintptr_t jssp = reinterpret_cast(jssp_address); - if (jssp < stack_guard->real_jslimit()) return true; + if (jssp - gap < stack_guard->real_jslimit()) return true; #endif // USE_SIMULATOR - return GetCurrentStackPosition() < stack_guard->real_climit(); + return GetCurrentStackPosition() - gap < stack_guard->real_climit(); } diff --git a/src/isolate.h b/src/isolate.h index ffef934..a67f0c7 100644 --- a/src/isolate.h +++ b/src/isolate.h @@ -1481,7 +1481,7 @@ class StackLimitCheck BASE_EMBEDDED { } // Use this to check for stack-overflow when entering runtime from JS code. - bool JsHasOverflowed() const; + bool JsHasOverflowed(uintptr_t gap = 0) const; private: Isolate* isolate_;