| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
| 10 | 10 |
| (...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3396 extension_event.event_kind = &event_kind; | 3396 extension_event.event_kind = &event_kind; |
| 3397 extension_event.event_data = &event_data; | 3397 extension_event.event_data = &event_data; |
| 3398 ServiceEvent event(isolate, ServiceEvent::kExtension); | 3398 ServiceEvent event(isolate, ServiceEvent::kExtension); |
| 3399 event.set_extension_event(extension_event); | 3399 event.set_extension_event(extension_event); |
| 3400 Service::HandleEvent(&event); | 3400 Service::HandleEvent(&event); |
| 3401 } | 3401 } |
| 3402 | 3402 |
| 3403 | 3403 |
| 3404 class ContainsAddressVisitor : public FindObjectVisitor { | 3404 class ContainsAddressVisitor : public FindObjectVisitor { |
| 3405 public: | 3405 public: |
| 3406 ContainsAddressVisitor(Isolate* isolate, uword addr) | 3406 explicit ContainsAddressVisitor(uword addr) : addr_(addr) { } |
| 3407 : FindObjectVisitor(isolate), addr_(addr) { } | |
| 3408 virtual ~ContainsAddressVisitor() { } | 3407 virtual ~ContainsAddressVisitor() { } |
| 3409 | 3408 |
| 3410 virtual uword filter_addr() const { return addr_; } | 3409 virtual uword filter_addr() const { return addr_; } |
| 3411 | 3410 |
| 3412 virtual bool FindObject(RawObject* obj) const { | 3411 virtual bool FindObject(RawObject* obj) const { |
| 3413 // Free list elements are not real objects, so skip them. | 3412 // Free list elements are not real objects, so skip them. |
| 3414 if (obj->IsFreeListElement()) { | 3413 if (obj->IsFreeListElement()) { |
| 3415 return false; | 3414 return false; |
| 3416 } | 3415 } |
| 3417 uword obj_begin = RawObject::ToAddr(obj); | 3416 uword obj_begin = RawObject::ToAddr(obj); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3428 NULL, | 3427 NULL, |
| 3429 }; | 3428 }; |
| 3430 | 3429 |
| 3431 | 3430 |
| 3432 static RawObject* GetObjectHelper(Thread* thread, uword addr) { | 3431 static RawObject* GetObjectHelper(Thread* thread, uword addr) { |
| 3433 Object& object = Object::Handle(thread->zone()); | 3432 Object& object = Object::Handle(thread->zone()); |
| 3434 | 3433 |
| 3435 { | 3434 { |
| 3436 NoSafepointScope no_safepoint; | 3435 NoSafepointScope no_safepoint; |
| 3437 Isolate* isolate = thread->isolate(); | 3436 Isolate* isolate = thread->isolate(); |
| 3438 ContainsAddressVisitor visitor(isolate, addr); | 3437 ContainsAddressVisitor visitor(addr); |
| 3439 object = isolate->heap()->FindObject(&visitor); | 3438 object = isolate->heap()->FindObject(&visitor); |
| 3440 } | 3439 } |
| 3441 | 3440 |
| 3442 if (!object.IsNull()) { | 3441 if (!object.IsNull()) { |
| 3443 return object.raw(); | 3442 return object.raw(); |
| 3444 } | 3443 } |
| 3445 | 3444 |
| 3446 { | 3445 { |
| 3447 NoSafepointScope no_safepoint; | 3446 NoSafepointScope no_safepoint; |
| 3448 ContainsAddressVisitor visitor(Dart::vm_isolate(), addr); | 3447 ContainsAddressVisitor visitor(addr); |
| 3449 object = Dart::vm_isolate()->heap()->FindObject(&visitor); | 3448 object = Dart::vm_isolate()->heap()->FindObject(&visitor); |
| 3450 } | 3449 } |
| 3451 | 3450 |
| 3452 return object.raw(); | 3451 return object.raw(); |
| 3453 } | 3452 } |
| 3454 | 3453 |
| 3455 | 3454 |
| 3456 static bool GetObjectByAddress(Thread* thread, JSONStream* js) { | 3455 static bool GetObjectByAddress(Thread* thread, JSONStream* js) { |
| 3457 const char* addr_str = js->LookupParam("address"); | 3456 const char* addr_str = js->LookupParam("address"); |
| 3458 if (addr_str == NULL) { | 3457 if (addr_str == NULL) { |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 if (strcmp(method_name, method.name) == 0) { | 4106 if (strcmp(method_name, method.name) == 0) { |
| 4108 return &method; | 4107 return &method; |
| 4109 } | 4108 } |
| 4110 } | 4109 } |
| 4111 return NULL; | 4110 return NULL; |
| 4112 } | 4111 } |
| 4113 | 4112 |
| 4114 #endif // !PRODUCT | 4113 #endif // !PRODUCT |
| 4115 | 4114 |
| 4116 } // namespace dart | 4115 } // namespace dart |
| OLD | NEW |