mirror of
https://github.com/dart-lang/sdk
synced 2024-10-15 00:28:05 +00:00
9bdd2ff1de
Some cleanups factored out of a larger CL (which refactors enter/exit of threads): * remove unused `#include "vm/thread_registry.h"` * remove unused/unnecessary fields from [Thread] object * rename IsMutator() -> IsDartMutator() * make tests using setjmp() drain the sticky error => to ensure there's no sticky error on isolate shutdown TEST=ci Change-Id: I53935e8bd0628ab3768627d6d5e01c3f0e3a57ad Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296582 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
33 lines
903 B
C++
33 lines
903 B
C++
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/longjump.h"
|
|
#include "vm/thread.h"
|
|
#include "vm/unit_test.h"
|
|
|
|
namespace dart {
|
|
|
|
static void LongJumpHelper(LongJumpScope* jump) {
|
|
const Error& error = Error::Handle(
|
|
LanguageError::New(String::Handle(String::New("LongJumpHelper"))));
|
|
jump->Jump(1, error);
|
|
UNREACHABLE();
|
|
}
|
|
|
|
ISOLATE_UNIT_TEST_CASE(LongJump) {
|
|
LongJumpScope* base = Thread::Current()->long_jump_base();
|
|
{
|
|
LongJumpScope jump;
|
|
if (setjmp(*jump.Set()) == 0) {
|
|
LongJumpHelper(&jump);
|
|
UNREACHABLE();
|
|
} else {
|
|
ASSERT(Error::Handle(thread->StealStickyError()).IsLanguageError());
|
|
}
|
|
}
|
|
ASSERT(base == Thread::Current()->long_jump_base());
|
|
}
|
|
|
|
} // namespace dart
|