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

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

Issue 11543020: Removed RuntimeProfilerRateLimiter class and RuntimeProfiler::IsSomeIsolateInJS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/runtime-profiler.h ('k') | no next file » | 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // The profiler thread must still be waiting. 423 // The profiler thread must still be waiting.
424 ASSERT(NoBarrier_Load(&state_) >= 0); 424 ASSERT(NoBarrier_Load(&state_) >= 0);
425 // In IsolateEnteredJS we have already incremented the counter and 425 // In IsolateEnteredJS we have already incremented the counter and
426 // undid the decrement done by the profiler thread. Increment again 426 // undid the decrement done by the profiler thread. Increment again
427 // to get the right count of active isolates. 427 // to get the right count of active isolates.
428 NoBarrier_AtomicIncrement(&state_, 1); 428 NoBarrier_AtomicIncrement(&state_, 1);
429 semaphore.Pointer()->Signal(); 429 semaphore.Pointer()->Signal();
430 } 430 }
431 431
432 432
433 bool RuntimeProfiler::IsSomeIsolateInJS() {
434 return NoBarrier_Load(&state_) > 0;
435 }
436
437
438 bool RuntimeProfiler::WaitForSomeIsolateToEnterJS() { 433 bool RuntimeProfiler::WaitForSomeIsolateToEnterJS() {
439 Atomic32 old_state = NoBarrier_CompareAndSwap(&state_, 0, -1); 434 Atomic32 old_state = NoBarrier_CompareAndSwap(&state_, 0, -1);
440 ASSERT(old_state >= -1); 435 ASSERT(old_state >= -1);
441 if (old_state != 0) return false; 436 if (old_state != 0) return false;
442 semaphore.Pointer()->Wait(); 437 semaphore.Pointer()->Wait();
443 return true; 438 return true;
444 } 439 }
445 440
446 441
447 void RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(Thread* thread) { 442 void RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(Thread* thread) {
(...skipping 29 matching lines...) Expand all
477 } 472 }
478 473
479 474
480 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { 475 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) {
481 for (int i = 0; i < kSamplerWindowSize; i++) { 476 for (int i = 0; i < kSamplerWindowSize; i++) {
482 visitor->VisitPointer(&sampler_window_[i]); 477 visitor->VisitPointer(&sampler_window_[i]);
483 } 478 }
484 } 479 }
485 480
486 481
487 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
488 if (!RuntimeProfiler::IsSomeIsolateInJS()) {
489 return RuntimeProfiler::WaitForSomeIsolateToEnterJS();
490 }
491 return false;
492 }
493
494
495 } } // namespace v8::internal 482 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698