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

Unified Diff: src/execution.cc

Issue 2151663003: [simulator] Check for C stack overflows during Invoke (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index 243bb8a9117ae5998384b1146c21e8a0ec4f923e..85a73cd6676c5711bcaacdc81933efb90cbbf959 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -59,6 +59,19 @@ MUST_USE_RESULT MaybeHandle<Object> Invoke(Isolate* isolate, bool is_construct,
Handle<Object> new_target) {
DCHECK(!receiver->IsJSGlobalObject());
+#ifdef USE_SIMULATOR
+ // Simulators use separate stacks for C++ and JS. JS stack overflow checks
+ // are performed whenever a JS function is called. However, it can be the case
+ // that the C++ stack grows faster than the JS stack, resulting in an overflow
+ // there. Add a check here to make that less likely.
+ StackLimitCheck check(isolate);
+ if (check.HasOverflowed()) {
+ isolate->StackOverflow();
+ isolate->ReportPendingMessages();
+ return MaybeHandle<Object>();
+ }
+#endif
+
// Entering JavaScript.
VMState<JS> state(isolate);
CHECK(AllowJavascriptExecution::IsAllowed(isolate));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698