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

Side by Side Diff: runtime/vm/object.cc

Issue 1621433002: Precompilation: Class::SetFunctions can shrink the number of functions, remember to clear the hash … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 if (len >= kFunctionLookupHashTreshold) { 2152 if (len >= kFunctionLookupHashTreshold) {
2153 ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld)); 2153 ClassFunctionsSet set(HashTables::New<ClassFunctionsSet>(len, Heap::kOld));
2154 Function& func = Function::Handle(); 2154 Function& func = Function::Handle();
2155 for (intptr_t i = 0; i < len; ++i) { 2155 for (intptr_t i = 0; i < len; ++i) {
2156 func ^= value.At(i); 2156 func ^= value.At(i);
2157 // Verify that all the functions in the array have this class as owner. 2157 // Verify that all the functions in the array have this class as owner.
2158 ASSERT(func.Owner() == raw()); 2158 ASSERT(func.Owner() == raw());
2159 set.Insert(func); 2159 set.Insert(func);
2160 } 2160 }
2161 StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw()); 2161 StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw());
2162 } else {
2163 StorePointer(&raw_ptr()->functions_hash_table_, Array::null());
2162 } 2164 }
2163 } 2165 }
2164 2166
2165 2167
2166 void Class::AddFunction(const Function& function) const { 2168 void Class::AddFunction(const Function& function) const {
2167 const Array& arr = Array::Handle(functions()); 2169 const Array& arr = Array::Handle(functions());
2168 const Array& new_arr = 2170 const Array& new_arr =
2169 Array::Handle(Array::Grow(arr, arr.Length() + 1, Heap::kOld)); 2171 Array::Handle(Array::Grow(arr, arr.Length() + 1, Heap::kOld));
2170 new_arr.SetAt(arr.Length(), function); 2172 new_arr.SetAt(arr.Length(), function);
2171 StorePointer(&raw_ptr()->functions_, new_arr.raw()); 2173 StorePointer(&raw_ptr()->functions_, new_arr.raw());
(...skipping 20532 matching lines...) Expand 10 before | Expand all | Expand 10 after
22704 return tag_label.ToCString(); 22706 return tag_label.ToCString();
22705 } 22707 }
22706 22708
22707 22709
22708 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22710 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22709 Instance::PrintJSONImpl(stream, ref); 22711 Instance::PrintJSONImpl(stream, ref);
22710 } 22712 }
22711 22713
22712 22714
22713 } // namespace dart 22715 } // namespace dart
OLDNEW
« 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