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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "vm/globals.h" | 7 #include "vm/globals.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/thread_barrier.h" | 10 #include "vm/thread_barrier.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 public: | 88 public: |
89 static const intptr_t kTaskCount; | 89 static const intptr_t kTaskCount; |
90 static const intptr_t kIterations; | 90 static const intptr_t kIterations; |
91 | 91 |
92 InterruptChecker(Thread* thread, ThreadBarrier* barrier) | 92 InterruptChecker(Thread* thread, ThreadBarrier* barrier) |
93 : thread_(thread), | 93 : thread_(thread), |
94 barrier_(barrier) { | 94 barrier_(barrier) { |
95 } | 95 } |
96 | 96 |
97 virtual void Run() { | 97 virtual void Run() { |
98 Thread::EnterIsolateAsHelper(thread_->isolate()); | 98 Thread::EnterIsolateAsHelper(thread_->isolate(), Thread::kUnknownTask); |
99 // Tell main thread that we are ready. | 99 // Tell main thread that we are ready. |
100 barrier_->Sync(); | 100 barrier_->Sync(); |
101 for (intptr_t i = 0; i < kIterations; ++i) { | 101 for (intptr_t i = 0; i < kIterations; ++i) { |
102 // Busy wait for interrupts. | 102 // Busy wait for interrupts. |
103 uword limit = 0; | 103 uword limit = 0; |
104 do { | 104 do { |
105 limit = AtomicOperations::LoadRelaxed( | 105 limit = AtomicOperations::LoadRelaxed( |
106 reinterpret_cast<uword*>(thread_->stack_limit_address())); | 106 reinterpret_cast<uword*>(thread_->stack_limit_address())); |
107 } while ((limit == thread_->saved_stack_limit_) || | 107 } while ((limit == thread_->saved_stack_limit_) || |
108 (((limit & Thread::kInterruptsMask) & | 108 (((limit & Thread::kInterruptsMask) & |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Restore, then clear interrupts. The world is as it was. | 246 // Restore, then clear interrupts. The world is as it was. |
247 interrupt_bits = thread->GetAndClearInterrupts(); | 247 interrupt_bits = thread->GetAndClearInterrupts(); |
248 EXPECT_EQ(kMessageInterrupt, interrupt_bits); | 248 EXPECT_EQ(kMessageInterrupt, interrupt_bits); |
249 EXPECT_EQ(IsolateTestHelper::GetStackLimit(thread), | 249 EXPECT_EQ(IsolateTestHelper::GetStackLimit(thread), |
250 IsolateTestHelper::GetSavedStackLimit(thread)); | 250 IsolateTestHelper::GetSavedStackLimit(thread)); |
251 EXPECT_EQ(kZero, IsolateTestHelper::GetDeferredInterruptsMask(thread)); | 251 EXPECT_EQ(kZero, IsolateTestHelper::GetDeferredInterruptsMask(thread)); |
252 EXPECT_EQ(kZero, IsolateTestHelper::GetDeferredInterrupts(thread)); | 252 EXPECT_EQ(kZero, IsolateTestHelper::GetDeferredInterrupts(thread)); |
253 } | 253 } |
254 | 254 |
255 } // namespace dart | 255 } // namespace dart |
OLD | NEW |