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

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

Issue 1952023002: Minor cleanup based on profiler output of CompileParseFunction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 } 2537 }
2538 if (code_trie_) { 2538 if (code_trie_) {
2539 return NULL; 2539 return NULL;
2540 } 2540 }
2541 ProfileFunction* func = profile_->GetFunction(current_->table_index()); 2541 ProfileFunction* func = profile_->GetFunction(current_->table_index());
2542 const Function& function = *(func->function()); 2542 const Function& function = *(func->function());
2543 if (function.IsNull()) { 2543 if (function.IsNull()) {
2544 // No function. 2544 // No function.
2545 return NULL; 2545 return NULL;
2546 } 2546 }
2547 const Script& script = Script::Handle(function.script()); 2547 Zone* zone = Thread::Current()->zone();
2548 const Script& script = Script::Handle(zone, function.script());
2548 if (script.IsNull()) { 2549 if (script.IsNull()) {
2549 // No script. 2550 // No script.
2550 return NULL; 2551 return NULL;
2551 } 2552 }
2552 const TokenStream& token_stream = TokenStream::Handle(script.tokens()); 2553 const TokenStream& token_stream = TokenStream::Handle(zone, script.tokens());
2553 if (token_stream.IsNull()) { 2554 if (token_stream.IsNull()) {
2554 // No token position. 2555 // No token position.
2555 return NULL; 2556 return NULL;
2556 } 2557 }
2557 ProfileFunctionSourcePosition pfsp(TokenPosition::kNoSource); 2558 ProfileFunctionSourcePosition pfsp(TokenPosition::kNoSource);
2558 if (!func->GetSinglePosition(&pfsp)) { 2559 if (!func->GetSinglePosition(&pfsp)) {
2559 // Not exactly one source position. 2560 // Not exactly one source position.
2560 return NULL; 2561 return NULL;
2561 } 2562 }
2562 TokenPosition token_pos = pfsp.token_pos(); 2563 TokenPosition token_pos = pfsp.token_pos();
2563 if (!token_pos.IsReal() && !token_pos.IsSynthetic()) { 2564 if (!token_pos.IsReal() && !token_pos.IsSynthetic()) {
2564 // Not a location in a script. 2565 // Not a location in a script.
2565 return NULL; 2566 return NULL;
2566 } 2567 }
2567 if (token_pos.IsSynthetic()) { 2568 if (token_pos.IsSynthetic()) {
2568 token_pos = token_pos.FromSynthetic(); 2569 token_pos = token_pos.FromSynthetic();
2569 } 2570 }
2570 TokenStream::Iterator iterator(token_stream, token_pos); 2571 TokenStream::Iterator iterator(zone, token_stream, token_pos);
2571 const String& str = String::Handle(iterator.CurrentLiteral()); 2572 const String& str = String::Handle(zone, iterator.CurrentLiteral());
2572 if (str.IsNull()) { 2573 if (str.IsNull()) {
2573 return NULL; 2574 return NULL;
2574 } 2575 }
2575 return str.ToCString(); 2576 return str.ToCString();
2576 } 2577 }
2577 2578
2578 bool ProfileTrieWalker::Down() { 2579 bool ProfileTrieWalker::Down() {
2579 if ((current_ == NULL) || (current_->NumChildren() == 0)) { 2580 if ((current_ == NULL) || (current_->NumChildren() == 0)) {
2580 return false; 2581 return false;
2581 } 2582 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 // Disable thread interrupts while processing the buffer. 2746 // Disable thread interrupts while processing the buffer.
2746 DisableThreadInterruptsScope dtis(thread); 2747 DisableThreadInterruptsScope dtis(thread);
2747 2748
2748 ClearProfileVisitor clear_profile(isolate); 2749 ClearProfileVisitor clear_profile(isolate);
2749 sample_buffer->VisitSamples(&clear_profile); 2750 sample_buffer->VisitSamples(&clear_profile);
2750 } 2751 }
2751 2752
2752 #endif // !PRODUCT 2753 #endif // !PRODUCT
2753 2754
2754 } // namespace dart 2755 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.h » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698