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

Side by Side Diff: src/cpu-profiler.cc

Issue 2745002: Move token-related constants from CodeEntry to TokenEnumerator. (Closed)
Patch Set: Created 10 years, 6 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 | « no previous file | src/profile-generator.h » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 CpuProfile* CpuProfiler::StopProfiling(Object* security_token, String* title) { 288 CpuProfile* CpuProfiler::StopProfiling(Object* security_token, String* title) {
289 return is_profiling() ? 289 return is_profiling() ?
290 singleton_->StopCollectingProfile(security_token, title) : NULL; 290 singleton_->StopCollectingProfile(security_token, title) : NULL;
291 } 291 }
292 292
293 293
294 int CpuProfiler::GetProfilesCount() { 294 int CpuProfiler::GetProfilesCount() {
295 ASSERT(singleton_ != NULL); 295 ASSERT(singleton_ != NULL);
296 // The count of profiles doesn't depend on a security token. 296 // The count of profiles doesn't depend on a security token.
297 return singleton_->profiles_->Profiles(CodeEntry::kNoSecurityToken)->length(); 297 return singleton_->profiles_->Profiles(
298 TokenEnumerator::kNoSecurityToken)->length();
298 } 299 }
299 300
300 301
301 CpuProfile* CpuProfiler::GetProfile(Object* security_token, int index) { 302 CpuProfile* CpuProfiler::GetProfile(Object* security_token, int index) {
302 ASSERT(singleton_ != NULL); 303 ASSERT(singleton_ != NULL);
303 const int token = singleton_->token_enumerator_->GetTokenId(security_token); 304 const int token = singleton_->token_enumerator_->GetTokenId(security_token);
304 return singleton_->profiles_->Profiles(token)->at(index); 305 return singleton_->profiles_->Profiles(token)->at(index);
305 } 306 }
306 307
307 308
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 singleton_->processor_->CodeMoveEvent(from, to); 374 singleton_->processor_->CodeMoveEvent(from, to);
374 } 375 }
375 376
376 377
377 void CpuProfiler::CodeDeleteEvent(Address from) { 378 void CpuProfiler::CodeDeleteEvent(Address from) {
378 singleton_->processor_->CodeDeleteEvent(from); 379 singleton_->processor_->CodeDeleteEvent(from);
379 } 380 }
380 381
381 382
382 void CpuProfiler::FunctionCreateEvent(JSFunction* function) { 383 void CpuProfiler::FunctionCreateEvent(JSFunction* function) {
383 int security_token_id = CodeEntry::kNoSecurityToken; 384 int security_token_id = TokenEnumerator::kNoSecurityToken;
384 if (function->unchecked_context()->IsContext()) { 385 if (function->unchecked_context()->IsContext()) {
385 security_token_id = singleton_->token_enumerator_->GetTokenId( 386 security_token_id = singleton_->token_enumerator_->GetTokenId(
386 function->context()->global_context()->security_token()); 387 function->context()->global_context()->security_token());
387 } 388 }
388 singleton_->processor_->FunctionCreateEvent( 389 singleton_->processor_->FunctionCreateEvent(
389 function->address(), 390 function->address(),
390 function->code()->address(), 391 function->code()->address(),
391 security_token_id); 392 security_token_id);
392 } 393 }
393 394
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 470 }
470 // Enable stack sampling. 471 // Enable stack sampling.
471 reinterpret_cast<Sampler*>(Logger::ticker_)->Start(); 472 reinterpret_cast<Sampler*>(Logger::ticker_)->Start();
472 } 473 }
473 } 474 }
474 475
475 476
476 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { 477 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) {
477 const double actual_sampling_rate = generator_->actual_sampling_rate(); 478 const double actual_sampling_rate = generator_->actual_sampling_rate();
478 StopProcessorIfLastProfile(); 479 StopProcessorIfLastProfile();
479 CpuProfile* result = profiles_->StopProfiling(CodeEntry::kNoSecurityToken, 480 CpuProfile* result =
480 title, 481 profiles_->StopProfiling(TokenEnumerator::kNoSecurityToken,
481 actual_sampling_rate); 482 title,
483 actual_sampling_rate);
482 if (result != NULL) { 484 if (result != NULL) {
483 result->Print(); 485 result->Print();
484 } 486 }
485 return result; 487 return result;
486 } 488 }
487 489
488 490
489 CpuProfile* CpuProfiler::StopCollectingProfile(Object* security_token, 491 CpuProfile* CpuProfiler::StopCollectingProfile(Object* security_token,
490 String* title) { 492 String* title) {
491 const double actual_sampling_rate = generator_->actual_sampling_rate(); 493 const double actual_sampling_rate = generator_->actual_sampling_rate();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 void CpuProfiler::TearDown() { 529 void CpuProfiler::TearDown() {
528 #ifdef ENABLE_LOGGING_AND_PROFILING 530 #ifdef ENABLE_LOGGING_AND_PROFILING
529 if (singleton_ != NULL) { 531 if (singleton_ != NULL) {
530 delete singleton_; 532 delete singleton_;
531 } 533 }
532 singleton_ = NULL; 534 singleton_ = NULL;
533 #endif 535 #endif
534 } 536 }
535 537
536 } } // namespace v8::internal 538 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698