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

Unified Diff: src/execution.h

Issue 242014: Adds an API for setting the stack limit per-thread. (Closed)
Patch Set: Leaves the limits of pending interrupts alone instead of reestablishing them." Created 11 years, 3 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 | « src/arm/simulator-arm.h ('k') | src/execution.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.h
diff --git a/src/execution.h b/src/execution.h
index 4cdfd2be6a1391ff2c6ecd8de32804bf516b91b1..36b74e70722da6647b050a85112341d5fcb3aa60 100644
--- a/src/execution.h
+++ b/src/execution.h
@@ -159,6 +159,7 @@ class StackGuard BASE_EMBEDDED {
static char* ArchiveStackGuard(char* to);
static char* RestoreStackGuard(char* from);
static int ArchiveSpacePerThread();
+ static void InitThread(const ExecutionAccess& lock);
static bool IsStackOverflow();
static bool IsPreempted();
@@ -190,11 +191,26 @@ class StackGuard BASE_EMBEDDED {
return thread_local_.climit_;
}
- // You should hold the ExecutionAccess lock when calling this method.
- static void set_limits(uintptr_t value, const ExecutionAccess& lock) {
- Heap::SetStackLimit(value);
- thread_local_.jslimit_ = value;
- thread_local_.climit_ = value;
+ // Sets the JavaScript and C stack limits, and updates the stack
+ // limit in the heap. You should hold the ExecutionAccess lock when
+ // calling this method.
+ static void set_limits(uintptr_t jslimit, uintptr_t climit,
+ const ExecutionAccess& lock) {
+ Heap::SetStackLimit(jslimit);
+ thread_local_.jslimit_ = jslimit;
+ thread_local_.climit_ = climit;
+ }
+
+ // You should hold the ExecutionAccess lock when calling this
+ // method.
+ static void set_illegal_limit(const ExecutionAccess& lock) {
+ set_limits(kIllegalLimit, kIllegalLimit, lock);
+ }
+
+ // You should hold the ExecutionAccess lock when calling this
+ // method.
+ static void set_interrupt_limit(const ExecutionAccess& lock) {
+ set_limits(kInterruptLimit, kInterruptLimit, lock);
}
// Reset limits to initial values. For example after handling interrupt.
@@ -202,11 +218,10 @@ class StackGuard BASE_EMBEDDED {
static void reset_limits(const ExecutionAccess& lock) {
if (thread_local_.nesting_ == 0) {
// No limits have been set yet.
- set_limits(kIllegalLimit, lock);
+ set_illegal_limit(lock);
} else {
- thread_local_.jslimit_ = thread_local_.initial_jslimit_;
- Heap::SetStackLimit(thread_local_.jslimit_);
- thread_local_.climit_ = thread_local_.initial_climit_;
+ set_limits(thread_local_.initial_jslimit_, thread_local_.initial_climit_,
+ lock);
}
}
« no previous file with comments | « src/arm/simulator-arm.h ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698