OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/thread.h" | 5 #include "vm/thread.h" |
6 | 6 |
7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/log.h" | 10 #include "vm/log.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 #endif | 335 #endif |
336 ASSERT(callback != NULL); | 336 ASSERT(callback != NULL); |
337 ASSERT(data != NULL); | 337 ASSERT(data != NULL); |
338 *callback = thread_interrupt_callback_; | 338 *callback = thread_interrupt_callback_; |
339 *data = thread_interrupt_data_; | 339 *data = thread_interrupt_data_; |
340 return (*callback != NULL) && | 340 return (*callback != NULL) && |
341 (*data != NULL); | 341 (*data != NULL); |
342 } | 342 } |
343 | 343 |
344 | 344 |
| 345 void Thread::CloseTimelineBlock() { |
| 346 if (timeline_block() != NULL) { |
| 347 timeline_block()->Finish(); |
| 348 set_timeline_block(NULL); |
| 349 } |
| 350 } |
| 351 |
| 352 |
345 bool Thread::CanLoadFromThread(const Object& object) { | 353 bool Thread::CanLoadFromThread(const Object& object) { |
346 #define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \ | 354 #define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \ |
347 if (object.raw() == expr) return true; | 355 if (object.raw() == expr) return true; |
348 CACHED_VM_OBJECTS_LIST(CHECK_OBJECT) | 356 CACHED_VM_OBJECTS_LIST(CHECK_OBJECT) |
349 #undef CHECK_OBJECT | 357 #undef CHECK_OBJECT |
350 return false; | 358 return false; |
351 } | 359 } |
352 | 360 |
353 | 361 |
354 intptr_t Thread::OffsetFromThread(const Object& object) { | 362 intptr_t Thread::OffsetFromThread(const Object& object) { |
355 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 363 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
356 ASSERT((expr)->IsVMHeapObject()); \ | 364 ASSERT((expr)->IsVMHeapObject()); \ |
357 if (object.raw() == expr) return Thread::member_name##offset(); | 365 if (object.raw() == expr) return Thread::member_name##offset(); |
358 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 366 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
359 #undef COMPUTE_OFFSET | 367 #undef COMPUTE_OFFSET |
360 UNREACHABLE(); | 368 UNREACHABLE(); |
361 return -1; | 369 return -1; |
362 } | 370 } |
363 | 371 |
| 372 |
364 intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { | 373 intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { |
365 #define COMPUTE_OFFSET(name) \ | 374 #define COMPUTE_OFFSET(name) \ |
366 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ | 375 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ |
367 return Thread::name##_entry_point_offset(); \ | 376 return Thread::name##_entry_point_offset(); \ |
368 } | 377 } |
369 RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) | 378 RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) |
370 #undef COMPUTE_OFFSET | 379 #undef COMPUTE_OFFSET |
371 | 380 |
372 #define COMPUTE_OFFSET(returntype, name, ...) \ | 381 #define COMPUTE_OFFSET(returntype, name, ...) \ |
373 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ | 382 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ |
374 return Thread::name##_entry_point_offset(); \ | 383 return Thread::name##_entry_point_offset(); \ |
375 } | 384 } |
376 LEAF_RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) | 385 LEAF_RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) |
377 #undef COMPUTE_OFFSET | 386 #undef COMPUTE_OFFSET |
378 | 387 |
379 UNREACHABLE(); | 388 UNREACHABLE(); |
380 return -1; | 389 return -1; |
381 } | 390 } |
382 | 391 |
383 } // namespace dart | 392 } // namespace dart |
OLD | NEW |