45038a2e71
Currently every invocation of a dart function will set and later on reset the stack limits. Doing so requires acquiring locks. Similarly because we have async ffi callbacks (another way to invoke dart code) the logic was duplicated there. Though the stack limit never changes for a given [OSThread]. Isolates can run on different [OSThread]s throughtout its lifetime. But an isolate always has to be entered on a native thread before it can execute dart code. => We initialize the stack limit when we scheduling an isolate on a thread and re-set it when unscheduling it. => That centralizes the place to one where we have to deal with stack limits and avoids repeated acquiring of locks on each embedder dart function invocation. TEST=ci Change-Id: Ia59ba8f92b93c58a990010ec75dfcd879aea2c43 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311960 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>