| Index: runtime/vm/thread.cc
|
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
|
| index 620e542d209bec406d2116221d63c4c1a3d72e1a..3ff121d7af1443efd7851151d3453df6ab1198cc 100644
|
| --- a/runtime/vm/thread.cc
|
| +++ b/runtime/vm/thread.cc
|
| @@ -746,6 +746,12 @@ intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) {
|
| }
|
|
|
|
|
| +bool Thread::IsValidHandle(Dart_Handle object) const {
|
| + return IsValidLocalHandle(object) || IsValidZoneHandle(object) ||
|
| + IsValidScopedHandle(object);
|
| +}
|
| +
|
| +
|
| bool Thread::IsValidLocalHandle(Dart_Handle object) const {
|
| ApiLocalScope* scope = api_top_scope_;
|
| while (scope != NULL) {
|
| @@ -769,6 +775,18 @@ intptr_t Thread::CountLocalHandles() const {
|
| }
|
|
|
|
|
| +bool Thread::IsValidZoneHandle(Dart_Handle object) const {
|
| + Zone* zone = zone_;
|
| + while (zone != NULL) {
|
| + if (zone->handles()->IsValidZoneHandle(reinterpret_cast<uword>(object))) {
|
| + return true;
|
| + }
|
| + zone = zone->previous();
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| intptr_t Thread::CountZoneHandles() const {
|
| intptr_t count = 0;
|
| Zone* zone = zone_;
|
| @@ -781,6 +799,18 @@ intptr_t Thread::CountZoneHandles() const {
|
| }
|
|
|
|
|
| +bool Thread::IsValidScopedHandle(Dart_Handle object) const {
|
| + Zone* zone = zone_;
|
| + while (zone != NULL) {
|
| + if (zone->handles()->IsValidScopedHandle(reinterpret_cast<uword>(object))) {
|
| + return true;
|
| + }
|
| + zone = zone->previous();
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| intptr_t Thread::CountScopedHandles() const {
|
| intptr_t count = 0;
|
| Zone* zone = zone_;
|
|
|