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

Unified Diff: runtime/vm/object.cc

Issue 1410443003: Eliminate unused function maps (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index e2eaab4b34852b0e82e68b79445605391610597f..a10edc1ae8edec3bc9033c157c63ffea6fb54e9b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2168,8 +2168,8 @@ void Class::SetFunctions(const Array& value) const {
ASSERT(!value.IsNull());
StorePointer(&raw_ptr()->functions_, value.raw());
const intptr_t len = value.Length();
- ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld));
if (len >= kFunctionLookupHashTreshold) {
+ ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld));
Function& func = Function::Handle();
for (intptr_t i = 0; i < len; ++i) {
func ^= value.At(i);
@@ -2177,8 +2177,8 @@ void Class::SetFunctions(const Array& value) const {
ASSERT(func.Owner() == raw());
set.Insert(func);
}
+ StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw());
}
- StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw());
}
@@ -2204,6 +2204,7 @@ void Class::AddFunction(const Function& function) const {
void Class::RemoveFunction(const Function& function) const {
const Array& arr = Array::Handle(functions());
StorePointer(&raw_ptr()->functions_, Object::empty_array().raw());
+ StorePointer(&raw_ptr()->functions_hash_table_, Array::null());
Function& entry = Function::Handle();
for (intptr_t i = 0; i < arr.Length(); i++) {
entry ^= arr.At(i);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698