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

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

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/cpu-profiler.h ('k') | src/d8.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 void CpuProfiler::DeleteAllProfiles() { 170 void CpuProfiler::DeleteAllProfiles() {
171 if (is_profiling_) StopProcessor(); 171 if (is_profiling_) StopProcessor();
172 ResetProfiles(); 172 ResetProfiles();
173 } 173 }
174 174
175 175
176 void CpuProfiler::DeleteProfile(CpuProfile* profile) { 176 void CpuProfiler::DeleteProfile(CpuProfile* profile) {
177 profiles_->RemoveProfile(profile); 177 profiles_->RemoveProfile(profile);
178 delete profile; 178 delete profile;
179 if (profiles_->profiles()->is_empty() && !is_profiling_) {
180 // If this was the last profile, clean up all accessory data as well.
181 ResetProfiles();
182 }
179 } 183 }
180 184
181 185
182 static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag) { 186 static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag) {
183 return FLAG_prof_browser_mode 187 return FLAG_prof_browser_mode
184 && (tag != Logger::CALLBACK_TAG 188 && (tag != Logger::CALLBACK_TAG
185 && tag != Logger::FUNCTION_TAG 189 && tag != Logger::FUNCTION_TAG
186 && tag != Logger::LAZY_COMPILE_TAG 190 && tag != Logger::LAZY_COMPILE_TAG
187 && tag != Logger::REG_EXP_TAG 191 && tag != Logger::REG_EXP_TAG
188 && tag != Logger::SCRIPT_TAG); 192 && tag != Logger::SCRIPT_TAG);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 rec->shared = NULL; 373 rec->shared = NULL;
370 processor_->Enqueue(evt_rec); 374 processor_->Enqueue(evt_rec);
371 } 375 }
372 376
373 377
374 CpuProfiler::CpuProfiler(Isolate* isolate) 378 CpuProfiler::CpuProfiler(Isolate* isolate)
375 : isolate_(isolate), 379 : isolate_(isolate),
376 sampling_interval_(TimeDelta::FromMicroseconds( 380 sampling_interval_(TimeDelta::FromMicroseconds(
377 FLAG_cpu_profiler_sampling_interval)), 381 FLAG_cpu_profiler_sampling_interval)),
378 profiles_(new CpuProfilesCollection(isolate->heap())), 382 profiles_(new CpuProfilesCollection(isolate->heap())),
379 next_profile_uid_(1),
380 generator_(NULL), 383 generator_(NULL),
381 processor_(NULL), 384 processor_(NULL),
382 is_profiling_(false) { 385 is_profiling_(false) {
383 } 386 }
384 387
385 388
386 CpuProfiler::CpuProfiler(Isolate* isolate, 389 CpuProfiler::CpuProfiler(Isolate* isolate,
387 CpuProfilesCollection* test_profiles, 390 CpuProfilesCollection* test_profiles,
388 ProfileGenerator* test_generator, 391 ProfileGenerator* test_generator,
389 ProfilerEventsProcessor* test_processor) 392 ProfilerEventsProcessor* test_processor)
390 : isolate_(isolate), 393 : isolate_(isolate),
391 sampling_interval_(TimeDelta::FromMicroseconds( 394 sampling_interval_(TimeDelta::FromMicroseconds(
392 FLAG_cpu_profiler_sampling_interval)), 395 FLAG_cpu_profiler_sampling_interval)),
393 profiles_(test_profiles), 396 profiles_(test_profiles),
394 next_profile_uid_(1),
395 generator_(test_generator), 397 generator_(test_generator),
396 processor_(test_processor), 398 processor_(test_processor),
397 is_profiling_(false) { 399 is_profiling_(false) {
398 } 400 }
399 401
400 402
401 CpuProfiler::~CpuProfiler() { 403 CpuProfiler::~CpuProfiler() {
402 ASSERT(!is_profiling_); 404 ASSERT(!is_profiling_);
403 delete profiles_; 405 delete profiles_;
404 } 406 }
405 407
406 408
407 void CpuProfiler::set_sampling_interval(TimeDelta value) { 409 void CpuProfiler::set_sampling_interval(TimeDelta value) {
408 ASSERT(!is_profiling_); 410 ASSERT(!is_profiling_);
409 sampling_interval_ = value; 411 sampling_interval_ = value;
410 } 412 }
411 413
412 414
413 void CpuProfiler::ResetProfiles() { 415 void CpuProfiler::ResetProfiles() {
414 delete profiles_; 416 delete profiles_;
415 profiles_ = new CpuProfilesCollection(isolate()->heap()); 417 profiles_ = new CpuProfilesCollection(isolate()->heap());
416 } 418 }
417 419
418 420
419 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { 421 void CpuProfiler::StartProfiling(const char* title, bool record_samples) {
420 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) { 422 if (profiles_->StartProfiling(title, record_samples)) {
421 StartProcessorIfNotStarted(); 423 StartProcessorIfNotStarted();
422 } 424 }
423 processor_->AddCurrentStack(isolate_); 425 processor_->AddCurrentStack(isolate_);
424 } 426 }
425 427
426 428
427 void CpuProfiler::StartProfiling(String* title, bool record_samples) { 429 void CpuProfiler::StartProfiling(String* title, bool record_samples) {
428 StartProfiling(profiles_->GetName(title), record_samples); 430 StartProfiling(profiles_->GetName(title), record_samples);
429 } 431 }
430 432
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 515 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
514 Builtins::Name id = static_cast<Builtins::Name>(i); 516 Builtins::Name id = static_cast<Builtins::Name>(i);
515 rec->start = builtins->builtin(id)->address(); 517 rec->start = builtins->builtin(id)->address();
516 rec->builtin_id = id; 518 rec->builtin_id = id;
517 processor_->Enqueue(evt_rec); 519 processor_->Enqueue(evt_rec);
518 } 520 }
519 } 521 }
520 522
521 523
522 } } // namespace v8::internal 524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698