- Add more data collection to the scavenger.

- Fix runtime/PRESUBMIT.py script.

R=asiva@google.com

Review URL: https://codereview.chromium.org//27604002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28759 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
iposva@google.com
2013-10-16 23:15:11 +00:00
parent 333054ee75
commit 0be514a68c
3 changed files with 37 additions and 33 deletions
+18 -28
View File
@@ -14,6 +14,14 @@ class PathHackException(Exception):
def __str__(self):
return repr(self.error_msg)
def AddSvnPathIfNeeded(runtime_path):
# Add the .svn into the runtime directory if needed for git or svn 1.7.
fake_svn_path = os.path.join(runtime_path, '.svn')
if os.path.exists(fake_svn_path):
return None
open(fake_svn_path, 'w').close()
return lambda: os.remove(fake_svn_path)
def TrySvnPathHack(parent_path):
orig_path = os.path.join(parent_path, '.svn')
@@ -31,27 +39,6 @@ def TrySvnPathHack(parent_path):
return lambda: os.rename(renamed_path, orig_path)
def TryGitPathHack(filename, parent_path):
def CommonSubdirectory(parent, child):
while len(child) > len(parent):
child, tail = os.path.split(child)
if child == parent:
return os.path.join(parent, tail)
if os.path.exists(os.path.join(parent_path, '.git')):
runtime_path = CommonSubdirectory(parent_path, filename)
if runtime_path is not None:
fake_svn_path = os.path.join(runtime_path, '.svn')
if os.path.exists(fake_svn_path):
error_msg = '".svn" exists in presubmit parent subdirectory('
error_msg += fake_svn_path
error_msg += '). Consider removing it manually.'
raise PathHackException(error_msg)
# Deposit a file named ".svn" in the runtime directory to fool
# cpplint into thinking it is the source root.
open(fake_svn_path, 'w').close()
return lambda: os.remove(fake_svn_path)
def RunLint(input_api, output_api):
result = []
cpplint._cpplint_state.ResetErrorCounts()
@@ -60,19 +47,22 @@ def RunLint(input_api, output_api):
for svn_file in input_api.AffectedTextFiles():
filename = svn_file.AbsoluteLocalPath()
if filename.endswith('.cc') or filename.endswith('.h'):
cleanup = None
parent_path = os.path.dirname(input_api.PresubmitLocalPath())
cleanup_parent = None
cleanup_runtime = None
try:
runtime_path = input_api.PresubmitLocalPath()
parent_path = os.path.dirname(runtime_path)
if filename.endswith('.h'):
cleanup = TrySvnPathHack(parent_path)
if cleanup is None:
cleanup = TryGitPathHack(filename, parent_path)
cleanup_runtime = AddSvnPathIfNeeded(runtime_path)
cleanup_parent = TrySvnPathHack(parent_path)
except PathHackException, exception:
return [output_api.PresubmitError(str(exception))]
# Run cpplint on the file.
cpplint.ProcessFile(filename, 1)
if cleanup is not None:
cleanup()
if cleanup_parent is not None:
cleanup_parent()
if cleanup_runtime is not None:
cleanup_runtime()
# memcpy does not handle overlapping memory regions. Even though this
# is well documented it seems to be used in error quite often. To avoid
# problems we disallow the direct use of memcpy. The exceptions are in
+16 -4
View File
@@ -73,6 +73,8 @@ class ScavengerVisitor : public ObjectPointerVisitor {
scavenger_(scavenger),
heap_(scavenger->heap_),
vm_heap_(Dart::vm_isolate()->heap()),
visited_count_(0),
handled_count_(0),
delayed_weak_stack_(),
growth_policy_(PageSpace::kControlGrowth),
bytes_promoted_(0),
@@ -113,6 +115,8 @@ class ScavengerVisitor : public ObjectPointerVisitor {
}
}
intptr_t visited_count() const { return visited_count_; }
intptr_t handled_count() const { return handled_count_; }
intptr_t bytes_promoted() const { return bytes_promoted_; }
private:
@@ -137,6 +141,7 @@ class ScavengerVisitor : public ObjectPointerVisitor {
BoolScope bs(&in_scavenge_pointer_, true);
#endif
visited_count_++;
RawObject* raw_obj = *p;
// Fast exit if the raw object is a Smi or an old object.
@@ -153,6 +158,7 @@ class ScavengerVisitor : public ObjectPointerVisitor {
return;
}
handled_count_++;
// Read the header word of the object and determine if the object has
// already been copied.
uword header = *reinterpret_cast<uword*>(raw_addr);
@@ -237,6 +243,8 @@ class ScavengerVisitor : public ObjectPointerVisitor {
Scavenger* scavenger_;
Heap* heap_;
Heap* vm_heap_;
intptr_t visited_count_;
intptr_t handled_count_;
typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet;
DelaySet delay_set_;
GrowableArray<RawObject*> delayed_weak_stack_;
@@ -379,16 +387,16 @@ void Scavenger::Epilogue(Isolate* isolate, bool invoke_api_callbacks) {
void Scavenger::IterateStoreBuffers(Isolate* isolate,
ScavengerVisitor* visitor) {
StoreBuffer* buffer = isolate->store_buffer();
heap_->RecordData(kStoreBufferBlockEntries, buffer->Count());
heap_->RecordData(kStoreBufferEntries, buffer->Count());
// Iterating through the store buffers.
// Grab the deduplication sets out of the store buffer.
StoreBufferBlock* pending = isolate->store_buffer()->Blocks();
intptr_t entries = 0;
intptr_t visited_count_before = visitor->visited_count();
intptr_t handled_count_before = visitor->handled_count();
while (pending != NULL) {
StoreBufferBlock* next = pending->next();
intptr_t count = pending->Count();
entries += count;
for (intptr_t i = 0; i < count; i++) {
RawObject* raw_object = pending->At(i);
ASSERT(raw_object->IsRemembered());
@@ -399,7 +407,10 @@ void Scavenger::IterateStoreBuffers(Isolate* isolate,
delete pending;
pending = next;
}
heap_->RecordData(kStoreBufferEntries, entries);
heap_->RecordData(kStoreBufferVisited,
visitor->visited_count() - visited_count_before);
heap_->RecordData(kStoreBufferPointers,
visitor->handled_count() - handled_count_before);
// Done iterating through old objects remembered in the store buffers.
visitor->VisitingOldObject(NULL);
}
@@ -428,6 +439,7 @@ void Scavenger::IterateRoots(Isolate* isolate,
IterateStoreBuffers(isolate, visitor);
IterateObjectIdTable(isolate, visitor);
int64_t end = OS::GetCurrentTimeMicros();
heap_->RecordData(kToKBAfterStoreBuffer, (in_use() + (KB >> 1)) >> KBLog2);
heap_->RecordTime(kVisitIsolateRoots, middle - start);
heap_->RecordTime(kIterateStoreBuffers, end - middle);
}
+3 -1
View File
@@ -97,7 +97,9 @@ class Scavenger {
kIterateWeaks = 3,
// Data
kStoreBufferEntries = 0,
kStoreBufferBlockEntries = 1
kStoreBufferVisited = 1,
kStoreBufferPointers = 2,
kToKBAfterStoreBuffer = 3
};
uword FirstObjectStart() const { return to_->start() | object_alignment_; }