Flutter Engine
The Flutter Engine
longjump_test.cc
Go to the documentation of this file.
1// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/longjump.h"
6#include "vm/thread.h"
7#include "vm/unit_test.h"
8
9namespace dart {
10
11static void LongJumpHelper(LongJumpScope* jump) {
12 const Error& error = Error::Handle(
13 LanguageError::New(String::Handle(String::New("LongJumpHelper"))));
14 jump->Jump(1, error);
16}
17
20 {
21 LongJumpScope jump;
22 if (setjmp(*jump.Set()) == 0) {
23 LongJumpHelper(&jump);
25 } else {
26 ASSERT(Error::Handle(thread->StealStickyError()).IsLanguageError());
27 }
28 }
29 ASSERT(base == Thread::Current()->long_jump_base());
30}
31
32} // namespace dart
#define UNREACHABLE()
Definition: assert.h:248
DART_NORETURN void Jump(int value, const Error &error)
Definition: longjump.cc:22
jmp_buf * Set()
Definition: longjump.cc:16
static Object & Handle()
Definition: object.h:407
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
LongJumpScope * long_jump_base() const
Definition: thread_state.h:47
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)
const uint8_t uint32_t uint32_t GError ** error
Definition: dart_vm.cc:33
static void LongJumpHelper(LongJumpScope *jump)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)