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/profiler_service.h" | 5 #include "vm/profiler_service.h" |
6 | 6 |
7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 ProfileFunction* function = NULL; | 546 ProfileFunction* function = NULL; |
547 if ((kind() == kReusedCode) || (kind() == kCollectedCode)) { | 547 if ((kind() == kReusedCode) || (kind() == kCollectedCode)) { |
548 if (name() == NULL) { | 548 if (name() == NULL) { |
549 // Lazily set generated name. | 549 // Lazily set generated name. |
550 GenerateAndSetSymbolName("[Collected]"); | 550 GenerateAndSetSymbolName("[Collected]"); |
551 } | 551 } |
552 // Map these to a canonical unknown function. | 552 // Map these to a canonical unknown function. |
553 function = table->GetUnknown(); | 553 function = table->GetUnknown(); |
554 } else if (kind() == kDartCode) { | 554 } else if (kind() == kDartCode) { |
555 ASSERT(!code_.IsNull()); | 555 ASSERT(!code_.IsNull()); |
| 556 const String& name = String::Handle(code_.QualifiedName()); |
556 const Object& obj = Object::Handle(code_.owner()); | 557 const Object& obj = Object::Handle(code_.owner()); |
557 if (obj.IsFunction()) { | 558 if (obj.IsFunction()) { |
558 const String& user_name = String::Handle(code_.PrettyName()); | |
559 function = table->LookupOrAdd(Function::Cast(obj)); | 559 function = table->LookupOrAdd(Function::Cast(obj)); |
560 SetName(user_name.ToCString()); | |
561 } else { | 560 } else { |
562 // A stub. | 561 // A stub. |
563 const String& user_name = String::Handle(code_.PrettyName()); | 562 function = table->AddStub(start(), name.ToCString()); |
564 function = table->AddStub(start(), user_name.ToCString()); | |
565 SetName(user_name.ToCString()); | |
566 } | 563 } |
| 564 SetName(name.ToCString()); |
567 } else if (kind() == kNativeCode) { | 565 } else if (kind() == kNativeCode) { |
568 if (name() == NULL) { | 566 if (name() == NULL) { |
569 // Lazily set generated name. | 567 // Lazily set generated name. |
570 GenerateAndSetSymbolName("[Native]"); | 568 GenerateAndSetSymbolName("[Native]"); |
571 } | 569 } |
572 function = table->AddNative(start(), name()); | 570 function = table->AddNative(start(), name()); |
573 } else if (kind() == kTagCode) { | 571 } else if (kind() == kTagCode) { |
574 if (name() == NULL) { | 572 if (name() == NULL) { |
575 if (UserTags::IsUserTag(start())) { | 573 if (UserTags::IsUserTag(start())) { |
576 const char* tag_name = UserTags::TagName(start()); | 574 const char* tag_name = UserTags::TagName(start()); |
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 // Disable thread interrupts while processing the buffer. | 2403 // Disable thread interrupts while processing the buffer. |
2406 DisableThreadInterruptsScope dtis(thread); | 2404 DisableThreadInterruptsScope dtis(thread); |
2407 | 2405 |
2408 ClearProfileVisitor clear_profile(isolate); | 2406 ClearProfileVisitor clear_profile(isolate); |
2409 sample_buffer->VisitSamples(&clear_profile); | 2407 sample_buffer->VisitSamples(&clear_profile); |
2410 } | 2408 } |
2411 | 2409 |
2412 #endif // !PRODUCT | 2410 #endif // !PRODUCT |
2413 | 2411 |
2414 } // namespace dart | 2412 } // namespace dart |
OLD | NEW |