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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ | 546 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
547 ASSERT((expr)->IsVMHeapObject()); \ | 547 ASSERT((expr)->IsVMHeapObject()); \ |
548 if (object.raw() == expr) return Thread::member_name##offset(); | 548 if (object.raw() == expr) return Thread::member_name##offset(); |
549 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) | 549 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
550 #undef COMPUTE_OFFSET | 550 #undef COMPUTE_OFFSET |
551 UNREACHABLE(); | 551 UNREACHABLE(); |
552 return -1; | 552 return -1; |
553 } | 553 } |
554 | 554 |
555 | 555 |
| 556 bool Thread::ObjectAtOffset(intptr_t offset, Object* object) { |
| 557 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ |
| 558 if (Thread::member_name##offset() == offset) { \ |
| 559 *object = expr; \ |
| 560 return true; \ |
| 561 } |
| 562 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) |
| 563 #undef COMPUTE_OFFSET |
| 564 return false; |
| 565 } |
| 566 |
| 567 |
556 intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { | 568 intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { |
557 #define COMPUTE_OFFSET(name) \ | 569 #define COMPUTE_OFFSET(name) \ |
558 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ | 570 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ |
559 return Thread::name##_entry_point_offset(); \ | 571 return Thread::name##_entry_point_offset(); \ |
560 } | 572 } |
561 RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) | 573 RUNTIME_ENTRY_LIST(COMPUTE_OFFSET) |
562 #undef COMPUTE_OFFSET | 574 #undef COMPUTE_OFFSET |
563 | 575 |
564 #define COMPUTE_OFFSET(returntype, name, ...) \ | 576 #define COMPUTE_OFFSET(returntype, name, ...) \ |
565 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ | 577 if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 624 } |
613 | 625 |
614 | 626 |
615 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 627 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
616 if (thread() != NULL) { | 628 if (thread() != NULL) { |
617 thread()->EnableThreadInterrupts(); | 629 thread()->EnableThreadInterrupts(); |
618 } | 630 } |
619 } | 631 } |
620 | 632 |
621 } // namespace dart | 633 } // namespace dart |
OLD | NEW |