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

Unified Diff: src/runtime-profiler.cc

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime-profiler.h ('k') | src/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime-profiler.cc
===================================================================
--- src/runtime-profiler.cc (revision 7006)
+++ src/runtime-profiler.cc (working copy)
@@ -35,6 +35,7 @@
#include "deoptimizer.h"
#include "execution.h"
#include "global-handles.h"
+#include "mark-compact.h"
#include "platform.h"
#include "scopeinfo.h"
@@ -107,7 +108,6 @@
static bool IsOptimizable(JSFunction* function) {
- if (function->GetHeap()->InNewSpace(function)) return false;
Code* code = function->code();
return code->kind() == Code::FUNCTION && code->optimizable();
}
@@ -212,16 +212,6 @@
}
-void RuntimeProfiler::ClearSampleBufferNewSpaceEntries() {
- for (int i = 0; i < kSamplerWindowSize; i++) {
- if (isolate_->heap()->InNewSpace(sampler_window_[i])) {
- sampler_window_[i] = NULL;
- sampler_window_weight_[i] = 0;
- }
- }
-}
-
-
int RuntimeProfiler::LookupSample(JSFunction* function) {
int weight = 0;
for (int i = 0; i < kSamplerWindowSize; i++) {
@@ -372,19 +362,6 @@
}
-void RuntimeProfiler::MarkCompactPrologue(bool is_compacting) {
- if (is_compacting) {
- // Clear all samples before mark-sweep-compact because every
- // function might move.
- ClearSampleBuffer();
- } else {
- // Clear only new space entries on mark-sweep since none of the
- // old-space functions will move.
- ClearSampleBufferNewSpaceEntries();
- }
-}
-
-
void RuntimeProfiler::Setup() {
ClearSampleBuffer();
// If the ticker hasn't already started, make sure to do so to get
@@ -406,13 +383,24 @@
}
-Object** RuntimeProfiler::SamplerWindowAddress() {
- return sampler_window_;
+int RuntimeProfiler::SamplerWindowSize() {
+ return kSamplerWindowSize;
}
-int RuntimeProfiler::SamplerWindowSize() {
- return kSamplerWindowSize;
+// Update the pointers in the sampler window after a GC.
+void RuntimeProfiler::UpdateSamplesAfterScavenge() {
+ for (int i = 0; i < kSamplerWindowSize; i++) {
+ Object* function = sampler_window_[i];
+ if (function != NULL && isolate_->heap()->InNewSpace(function)) {
+ MapWord map_word = HeapObject::cast(function)->map_word();
+ if (map_word.IsForwardingAddress()) {
+ sampler_window_[i] = map_word.ToForwardingAddress();
+ } else {
+ sampler_window_[i] = NULL;
+ }
+ }
+ }
}
@@ -453,6 +441,23 @@
}
+void RuntimeProfiler::RemoveDeadSamples() {
+ for (int i = 0; i < kSamplerWindowSize; i++) {
+ Object* function = sampler_window_[i];
+ if (function != NULL && !HeapObject::cast(function)->IsMarked()) {
+ sampler_window_[i] = NULL;
+ }
+ }
+}
+
+
+void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) {
+ for (int i = 0; i < kSamplerWindowSize; i++) {
+ visitor->VisitPointer(&sampler_window_[i]);
+ }
+}
+
+
bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
#ifdef ENABLE_LOGGING_AND_PROFILING
static const int kNonJSTicksThreshold = 100;
« no previous file with comments | « src/runtime-profiler.h ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698