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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2506583002: Worker: Fix wrong stack size calculation (Closed)
Patch Set: Created 4 years, 1 month 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: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index a8199a1713a6f8e0c40e09ced4df09705ec06c0d..61046d6576726a0b189ad2b3d5667393e0ef0a1a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -488,6 +488,9 @@ static void messageHandlerInWorker(v8::Local<v8::Message> message,
perIsolateData->setReportingException(false);
}
+// Stack size for workers is limited to 500KB because default stack size for
+// secondary threads is 512KB on Mac OS X. See GetDefaultThreadStackSize() in
+// base/threading/platform_thread_mac.mm for details.
static const int kWorkerMaxStackSize = 500 * 1024;
// This function uses a local stack variable to determine the isolate's stack
@@ -502,8 +505,8 @@ void V8Initializer::initializeWorker(v8::Isolate* isolate) {
isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
uint32_t here;
- isolate->SetStackLimit(reinterpret_cast<uintptr_t>(
- &here - kWorkerMaxStackSize / sizeof(uint32_t*)));
+ isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) -
+ kWorkerMaxStackSize);
isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
}
« 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