| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 | 72 |
| 73 static void StackAllocatedDestructionHelper(int* ptr) { | 73 static void StackAllocatedDestructionHelper(int* ptr) { |
| 74 TestValueObject stacked(ptr); | 74 TestValueObject stacked(ptr); |
| 75 EXPECT_EQ(2, *ptr); | 75 EXPECT_EQ(2, *ptr); |
| 76 *ptr = 3; | 76 *ptr = 3; |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 UNIT_TEST_CASE(StackAllocatedDestruction) { | 80 VM_UNIT_TEST_CASE(StackAllocatedDestruction) { |
| 81 int data = 1; | 81 int data = 1; |
| 82 StackAllocatedDestructionHelper(&data); | 82 StackAllocatedDestructionHelper(&data); |
| 83 EXPECT_EQ(4, data); | 83 EXPECT_EQ(4, data); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 static void StackAllocatedLongJumpHelper(int* ptr, LongJumpScope* jump) { | 87 static void StackAllocatedLongJumpHelper(int* ptr, LongJumpScope* jump) { |
| 88 TestValueObject stacked(ptr); | 88 TestValueObject stacked(ptr); |
| 89 EXPECT_EQ(2, *ptr); | 89 EXPECT_EQ(2, *ptr); |
| 90 *ptr = 3; | 90 *ptr = 3; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (setjmp(*jump.Set()) == 0) { | 158 if (setjmp(*jump.Set()) == 0) { |
| 159 StackResourceLongJumpHelper(&data, &jump); | 159 StackResourceLongJumpHelper(&data, &jump); |
| 160 UNREACHABLE(); | 160 UNREACHABLE(); |
| 161 } | 161 } |
| 162 EXPECT_EQ(7, data); | 162 EXPECT_EQ(7, data); |
| 163 } | 163 } |
| 164 ASSERT(base == Thread::Current()->long_jump_base()); | 164 ASSERT(base == Thread::Current()->long_jump_base()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace dart | 167 } // namespace dart |
| OLD | NEW |