Skip to content

Commit d30a43d

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Allow for long jumps during reusable handle scopes.
Such long jumps may occur due to Out Of Memory exceptions. TEST=run test harness with low heap limit Change-Id: Ifc8d062d4325ea3cdb4ea1f1ad1877f2dc83229e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213534 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent a2d1fa1 commit d30a43d

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

runtime/vm/longjump.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ void LongJumpScope::Jump(int value) {
3636
Thread* thread = Thread::Current();
3737
DEBUG_ASSERT(thread->TopErrorHandlerIsSetJump());
3838

39-
#if defined(DEBUG)
40-
#define CHECK_REUSABLE_HANDLE(name) \
41-
ASSERT(!thread->reusable_##name##_handle_scope_active());
42-
REUSABLE_HANDLE_LIST(CHECK_REUSABLE_HANDLE)
43-
#undef CHECK_REUSABLE_HANDLE
44-
#endif // defined(DEBUG)
45-
4639
// Destruct all the active StackResource objects.
4740
StackResource::UnwindAbove(thread, top_);
4841
longjmp(environment_, value);

runtime/vm/reusable_handles.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,13 @@ namespace dart {
3232

3333
#if defined(DEBUG)
3434
#define REUSABLE_SCOPE(name) \
35-
class Reusable##name##HandleScope : public ValueObject { \
35+
class Reusable##name##HandleScope : public StackResource { \
3636
public: \
37-
explicit Reusable##name##HandleScope(Thread* thread) : thread_(thread) { \
37+
explicit Reusable##name##HandleScope(Thread* thread = Thread::Current()) \
38+
: StackResource(thread), thread_(thread) { \
3839
ASSERT(!thread->reusable_##name##_handle_scope_active()); \
3940
thread->set_reusable_##name##_handle_scope_active(true); \
4041
} \
41-
Reusable##name##HandleScope() : thread_(Thread::Current()) { \
42-
ASSERT(!thread_->reusable_##name##_handle_scope_active()); \
43-
thread_->set_reusable_##name##_handle_scope_active(true); \
44-
} \
4542
~Reusable##name##HandleScope() { \
4643
ASSERT(thread_->reusable_##name##_handle_scope_active()); \
4744
thread_->set_reusable_##name##_handle_scope_active(false); \
@@ -60,10 +57,8 @@ namespace dart {
6057
#define REUSABLE_SCOPE(name) \
6158
class Reusable##name##HandleScope : public ValueObject { \
6259
public: \
63-
explicit Reusable##name##HandleScope(Thread* thread) \
60+
explicit Reusable##name##HandleScope(Thread* thread = Thread::Current()) \
6461
: handle_(thread->name##_handle_) {} \
65-
Reusable##name##HandleScope() \
66-
: handle_(Thread::Current()->name##_handle_) {} \
6762
~Reusable##name##HandleScope() { handle_->ptr_ = name::null(); } \
6863
name& Handle() const { \
6964
ASSERT(handle_ != NULL); \

0 commit comments

Comments
 (0)