OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/allocation.h" | 6 #include "vm/allocation.h" |
7 #include "vm/longjump.h" | 7 #include "vm/longjump.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 static void StackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { | 146 static void StackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { |
147 TestStackResource stacked(ptr); | 147 TestStackResource stacked(ptr); |
148 EXPECT_EQ(2, *ptr); | 148 EXPECT_EQ(2, *ptr); |
149 *ptr = 3; | 149 *ptr = 3; |
150 StackedStackResourceLongJumpHelper(ptr, jump); | 150 StackedStackResourceLongJumpHelper(ptr, jump); |
151 UNREACHABLE(); | 151 UNREACHABLE(); |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 TEST_CASE(StackResourceLongJump) { | 155 TEST_CASE(StackResourceLongJump) { |
156 LongJumpScope* base = Isolate::Current()->long_jump_base(); | 156 LongJumpScope* base = Thread::Current()->long_jump_base(); |
157 { | 157 { |
158 LongJumpScope jump; | 158 LongJumpScope jump; |
159 int data = 1; | 159 int data = 1; |
160 if (setjmp(*jump.Set()) == 0) { | 160 if (setjmp(*jump.Set()) == 0) { |
161 StackResourceLongJumpHelper(&data, &jump); | 161 StackResourceLongJumpHelper(&data, &jump); |
162 UNREACHABLE(); | 162 UNREACHABLE(); |
163 } | 163 } |
164 EXPECT_EQ(7, data); | 164 EXPECT_EQ(7, data); |
165 } | 165 } |
166 ASSERT(base == Isolate::Current()->long_jump_base()); | 166 ASSERT(base == Thread::Current()->long_jump_base()); |
167 } | 167 } |
168 | 168 |
169 } // namespace dart | 169 } // namespace dart |
OLD | NEW |