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 "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // Bitstream: [meta data size (big-endian 64 bit)] [meta data (UTF-8)] [data] | 566 // Bitstream: [meta data size (big-endian 64 bit)] [meta data (UTF-8)] [data] |
567 const intptr_t meta_bytes = Utf8::Length(meta); | 567 const intptr_t meta_bytes = Utf8::Length(meta); |
568 const intptr_t total_bytes = sizeof(uint64_t) + meta_bytes + size; | 568 const intptr_t total_bytes = sizeof(uint64_t) + meta_bytes + size; |
569 const TypedData& message = TypedData::Handle( | 569 const TypedData& message = TypedData::Handle( |
570 TypedData::New(kTypedDataUint8ArrayCid, total_bytes)); | 570 TypedData::New(kTypedDataUint8ArrayCid, total_bytes)); |
571 intptr_t offset = 0; | 571 intptr_t offset = 0; |
572 // TODO(koda): Rename these methods SetHostUint64, etc. | 572 // TODO(koda): Rename these methods SetHostUint64, etc. |
573 message.SetUint64(0, Utils::HostToBigEndian64(meta_bytes)); | 573 message.SetUint64(0, Utils::HostToBigEndian64(meta_bytes)); |
574 offset += sizeof(uint64_t); | 574 offset += sizeof(uint64_t); |
575 { | 575 { |
576 NoGCScope no_gc; | 576 NoSafepointScope no_safepoint; |
577 meta.ToUTF8(static_cast<uint8_t*>(message.DataAddr(offset)), meta_bytes); | 577 meta.ToUTF8(static_cast<uint8_t*>(message.DataAddr(offset)), meta_bytes); |
578 offset += meta_bytes; | 578 offset += meta_bytes; |
579 } | 579 } |
580 // TODO(koda): It would be nice to avoid this copy (requires changes to | 580 // TODO(koda): It would be nice to avoid this copy (requires changes to |
581 // MessageWriter code). | 581 // MessageWriter code). |
582 { | 582 { |
583 NoGCScope no_gc; | 583 NoSafepointScope no_safepoint; |
584 memmove(message.DataAddr(offset), data, size); | 584 memmove(message.DataAddr(offset), data, size); |
585 offset += size; | 585 offset += size; |
586 } | 586 } |
587 ASSERT(offset == total_bytes); | 587 ASSERT(offset == total_bytes); |
588 // TODO(turnidge): Pass the real eventType here. | 588 // TODO(turnidge): Pass the real eventType here. |
589 SendEvent(eventFamilyId, 0, message); | 589 SendEvent(eventFamilyId, 0, message); |
590 } | 590 } |
591 | 591 |
592 | 592 |
593 void Service::HandleGCEvent(GCEvent* event) { | 593 void Service::HandleGCEvent(GCEvent* event) { |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 | 2278 |
2279 // Handle heap objects. | 2279 // Handle heap objects. |
2280 uword addr = 0; | 2280 uword addr = 0; |
2281 if (!GetUnsignedIntegerId(addr_str, &addr, 16)) { | 2281 if (!GetUnsignedIntegerId(addr_str, &addr, 16)) { |
2282 PrintInvalidParamError(js, "address"); | 2282 PrintInvalidParamError(js, "address"); |
2283 return true; | 2283 return true; |
2284 } | 2284 } |
2285 bool ref = js->HasParam("ref") && js->ParamIs("ref", "true"); | 2285 bool ref = js->HasParam("ref") && js->ParamIs("ref", "true"); |
2286 Object& object = Object::Handle(isolate); | 2286 Object& object = Object::Handle(isolate); |
2287 { | 2287 { |
2288 NoGCScope no_gc; | 2288 NoSafepointScope no_safepoint; |
2289 ContainsAddressVisitor visitor(isolate, addr); | 2289 ContainsAddressVisitor visitor(isolate, addr); |
2290 object = isolate->heap()->FindObject(&visitor); | 2290 object = isolate->heap()->FindObject(&visitor); |
2291 } | 2291 } |
2292 object.PrintJSON(js, ref); | 2292 object.PrintJSON(js, ref); |
2293 return true; | 2293 return true; |
2294 } | 2294 } |
2295 | 2295 |
2296 | 2296 |
2297 static bool _RespondWithMalformedJson(Isolate* isolate, | 2297 static bool _RespondWithMalformedJson(Isolate* isolate, |
2298 JSONStream* js) { | 2298 JSONStream* js) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 ServiceMethodDescriptor& method = service_methods_[i]; | 2589 ServiceMethodDescriptor& method = service_methods_[i]; |
2590 if (strcmp(method_name, method.name) == 0) { | 2590 if (strcmp(method_name, method.name) == 0) { |
2591 return &method; | 2591 return &method; |
2592 } | 2592 } |
2593 } | 2593 } |
2594 return NULL; | 2594 return NULL; |
2595 } | 2595 } |
2596 | 2596 |
2597 | 2597 |
2598 } // namespace dart | 2598 } // namespace dart |
OLD | NEW |