Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: runtime/vm/profiler_service.cc

Issue 2363413004: VM: Avoid allocating strings when disassembling code. (Closed)
Patch Set: addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/profiler.h ('k') | tests/language/disassemble_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/hash_map.h" 8 #include "vm/hash_map.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/native_symbol.h" 10 #include "vm/native_symbol.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ProfileFunction* function = NULL; 639 ProfileFunction* function = NULL;
640 if ((kind() == kReusedCode) || (kind() == kCollectedCode)) { 640 if ((kind() == kReusedCode) || (kind() == kCollectedCode)) {
641 if (name() == NULL) { 641 if (name() == NULL) {
642 // Lazily set generated name. 642 // Lazily set generated name.
643 GenerateAndSetSymbolName("[Collected]"); 643 GenerateAndSetSymbolName("[Collected]");
644 } 644 }
645 // Map these to a canonical unknown function. 645 // Map these to a canonical unknown function.
646 function = table->GetUnknown(); 646 function = table->GetUnknown();
647 } else if (kind() == kDartCode) { 647 } else if (kind() == kDartCode) {
648 ASSERT(!code_.IsNull()); 648 ASSERT(!code_.IsNull());
649 const String& name = String::Handle(code_.QualifiedName()); 649 const char* name = code_.QualifiedName();
650 const Object& obj = Object::Handle(code_.owner()); 650 const Object& obj = Object::Handle(code_.owner());
651 if (obj.IsFunction()) { 651 if (obj.IsFunction()) {
652 function = table->LookupOrAdd(Function::Cast(obj)); 652 function = table->LookupOrAdd(Function::Cast(obj));
653 } else { 653 } else {
654 // A stub. 654 // A stub.
655 function = table->AddStub(start(), name.ToCString()); 655 function = table->AddStub(start(), name);
656 } 656 }
657 SetName(name.ToCString()); 657 SetName(name);
658 } else if (kind() == kNativeCode) { 658 } else if (kind() == kNativeCode) {
659 if (name() == NULL) { 659 if (name() == NULL) {
660 // Lazily set generated name. 660 // Lazily set generated name.
661 GenerateAndSetSymbolName("[Native]"); 661 GenerateAndSetSymbolName("[Native]");
662 } 662 }
663 function = table->AddNative(start(), name()); 663 function = table->AddNative(start(), name());
664 } else if (kind() == kTagCode) { 664 } else if (kind() == kTagCode) {
665 if (name() == NULL) { 665 if (name() == NULL) {
666 if (UserTags::IsUserTag(start())) { 666 if (UserTags::IsUserTag(start())) {
667 const char* tag_name = UserTags::TagName(start()); 667 const char* tag_name = UserTags::TagName(start());
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 // Disable thread interrupts while processing the buffer. 2899 // Disable thread interrupts while processing the buffer.
2900 DisableThreadInterruptsScope dtis(thread); 2900 DisableThreadInterruptsScope dtis(thread);
2901 2901
2902 ClearProfileVisitor clear_profile(isolate); 2902 ClearProfileVisitor clear_profile(isolate);
2903 sample_buffer->VisitSamples(&clear_profile); 2903 sample_buffer->VisitSamples(&clear_profile);
2904 } 2904 }
2905 2905
2906 #endif // !PRODUCT 2906 #endif // !PRODUCT
2907 2907
2908 } // namespace dart 2908 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.h ('k') | tests/language/disassemble_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698