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

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

Issue 1748953003: - Add assertions in MutexLocker/MonitorLocker to ensure that the code enclosed (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 9 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 | « runtime/vm/lockers.cc ('k') | runtime/vm/message_handler.h » ('j') | 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/megamorphic_cache_table.h" 5 #include "vm/megamorphic_cache_table.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/stub_code.h" 10 #include "vm/stub_code.h"
11 #include "vm/symbols.h" 11 #include "vm/symbols.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 RawMegamorphicCache* MegamorphicCacheTable::Lookup(Isolate* isolate, 15 RawMegamorphicCache* MegamorphicCacheTable::Lookup(Isolate* isolate,
16 const String& name, 16 const String& name,
17 const Array& descriptor) { 17 const Array& descriptor) {
18 // Multiple compilation threads could access this lookup. 18 // Multiple compilation threads could access this lookup.
19 MutexLocker ml(isolate->mutex()); 19 SafepointMutexLocker ml(isolate->mutex());
20 ASSERT(name.IsSymbol()); 20 ASSERT(name.IsSymbol());
21 // TODO(rmacnak): ASSERT(descriptor.IsCanonical()); 21 // TODO(rmacnak): ASSERT(descriptor.IsCanonical());
22 22
23 // TODO(rmacnak): Make a proper hashtable a la symbol table. 23 // TODO(rmacnak): Make a proper hashtable a la symbol table.
24 GrowableObjectArray& table = GrowableObjectArray::Handle( 24 GrowableObjectArray& table = GrowableObjectArray::Handle(
25 isolate->object_store()->megamorphic_cache_table()); 25 isolate->object_store()->megamorphic_cache_table());
26 MegamorphicCache& cache = MegamorphicCache::Handle(); 26 MegamorphicCache& cache = MegamorphicCache::Handle();
27 if (table.IsNull()) { 27 if (table.IsNull()) {
28 table = GrowableObjectArray::New(Heap::kOld); 28 table = GrowableObjectArray::New(Heap::kOld);
29 isolate->object_store()->set_megamorphic_cache_table(table); 29 isolate->object_store()->set_megamorphic_cache_table(table);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 cache ^= table.At(i); 93 cache ^= table.At(i);
94 buckets = cache.buckets(); 94 buckets = cache.buckets();
95 size += MegamorphicCache::InstanceSize(); 95 size += MegamorphicCache::InstanceSize();
96 size += Array::InstanceSize(buckets.Length()); 96 size += Array::InstanceSize(buckets.Length());
97 } 97 }
98 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n", 98 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n",
99 table.Length(), size / 1024); 99 table.Length(), size / 1024);
100 } 100 }
101 101
102 } // namespace dart 102 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/lockers.cc ('k') | runtime/vm/message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698