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

Unified Diff: runtime/vm/weak_table.cc

Issue 1399783002: Add a hash map for a raw object to id mapping, this table will be used during snapshot writing in o… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years, 2 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 | « runtime/vm/weak_table.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/weak_table.cc
diff --git a/runtime/vm/weak_table.cc b/runtime/vm/weak_table.cc
index cb45d2ec5a89f5f649f6b6eb78cd5834e93b4c71..e45e9c8c86be9a117b57ecaea5062cadff466c84 100644
--- a/runtime/vm/weak_table.cc
+++ b/runtime/vm/weak_table.cc
@@ -75,6 +75,16 @@ void WeakTable::SetValue(RawObject* key, intptr_t val) {
}
+void WeakTable::Reset() {
+ intptr_t* old_data = data_;
+ used_ = 0;
+ count_ = 0;
+ size_ = kMinSize;
+ data_ = reinterpret_cast<intptr_t*>(calloc(size_, kEntrySize * kWordSize));
+ free(old_data);
+}
+
+
void WeakTable::Rehash() {
intptr_t old_size = size();
intptr_t* old_data = data_;
« no previous file with comments | « runtime/vm/weak_table.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698