| 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 "vm/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/bigint_store.h" | 9 #include "vm/bigint_store.h" |
| 10 #include "vm/code_index_table.h" | 10 #include "vm/code_index_table.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 source_name = source_isolate->name(); | 94 source_name = source_isolate->name(); |
| 95 } | 95 } |
| 96 OS::Print("[>] Posting message:\n" | 96 OS::Print("[>] Posting message:\n" |
| 97 "\tsource: %s\n" | 97 "\tsource: %s\n" |
| 98 "\treply_port: %lld\n" | 98 "\treply_port: %lld\n" |
| 99 "\tdest: %s\n" | 99 "\tdest: %s\n" |
| 100 "\tdest_port: %lld\n", | 100 "\tdest_port: %lld\n", |
| 101 source_name, message->reply_port(), name(), message->dest_port()); | 101 source_name, message->reply_port(), name(), message->dest_port()); |
| 102 } | 102 } |
| 103 message_queue()->Enqueue(message); | 103 message_queue()->Enqueue(message); |
| 104 ASSERT(message->priority() < Message::kOOBPriority); |
| 104 if (message->priority() >= Message::kOOBPriority) { | 105 if (message->priority() >= Message::kOOBPriority) { |
| 105 // Handle out of band messages even if the isolate is busy. | 106 // Handle out of band messages even if the isolate is busy. |
| 106 ScheduleInterrupts(Isolate::kMessageInterrupt); | 107 ScheduleInterrupts(Isolate::kMessageInterrupt); |
| 107 } | 108 } |
| 108 Dart_MessageNotifyCallback callback = message_notify_callback(); | 109 Dart_MessageNotifyCallback callback = message_notify_callback(); |
| 109 if (callback) { | 110 if (callback) { |
| 110 // Allow the embedder to handle message notification. | 111 // Allow the embedder to handle message notification. |
| 111 (*callback)(Api::CastIsolate(this)); | 112 (*callback)(Api::CastIsolate(this)); |
| 112 } | 113 } |
| 113 } | 114 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 197 } |
| 197 | 198 |
| 198 | 199 |
| 199 void Isolate::ScheduleInterrupts(uword interrupt_bits) { | 200 void Isolate::ScheduleInterrupts(uword interrupt_bits) { |
| 200 // TODO(turnidge): Can't use MutexLocker here because MutexLocker is | 201 // TODO(turnidge): Can't use MutexLocker here because MutexLocker is |
| 201 // a StackResource, which requires a current isolate. Should | 202 // a StackResource, which requires a current isolate. Should |
| 202 // MutexLocker really be a StackResource? | 203 // MutexLocker really be a StackResource? |
| 203 mutex_->Lock(); | 204 mutex_->Lock(); |
| 204 ASSERT((interrupt_bits & ~kInterruptsMask) == 0); // Must fit in mask. | 205 ASSERT((interrupt_bits & ~kInterruptsMask) == 0); // Must fit in mask. |
| 205 if (stack_limit_ == saved_stack_limit_) { | 206 if (stack_limit_ == saved_stack_limit_) { |
| 206 stack_limit_ = ~static_cast<uword>(0) & ~kInterruptsMask; | 207 stack_limit_ = (~static_cast<uword>(0)) & ~kInterruptsMask; |
| 207 } | 208 } |
| 208 stack_limit_ |= interrupt_bits; | 209 stack_limit_ |= interrupt_bits; |
| 209 mutex_->Unlock(); | 210 mutex_->Unlock(); |
| 210 } | 211 } |
| 211 | 212 |
| 212 | 213 |
| 213 uword Isolate::GetAndClearInterrupts() { | 214 uword Isolate::GetAndClearInterrupts() { |
| 214 MutexLocker ml(mutex_); | 215 MutexLocker ml(mutex_); |
| 215 if (stack_limit_ == saved_stack_limit_) { | 216 if (stack_limit_ == saved_stack_limit_) { |
| 216 return 0; // No interrupt was requested. | 217 return 0; // No interrupt was requested. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 420 } |
| 420 | 421 |
| 421 | 422 |
| 422 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { | 423 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |
| 423 if (api_state() != NULL) { | 424 if (api_state() != NULL) { |
| 424 api_state()->VisitWeakHandles(visitor); | 425 api_state()->VisitWeakHandles(visitor); |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 } // namespace dart | 429 } // namespace dart |
| OLD | NEW |