| OLD | NEW |
| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 false, // Not const. | 69 false, // Not const. |
| 70 false, // Not abstract. | 70 false, // Not abstract. |
| 71 false, // Not external. | 71 false, // Not external. |
| 72 false, // Not native. | 72 false, // Not native. |
| 73 cls, | 73 cls, |
| 74 TokenPosition::kNoSource)); | 74 TokenPosition::kNoSource)); |
| 75 function.set_result_type(Type::Handle(Type::DynamicType())); | 75 function.set_result_type(Type::Handle(Type::DynamicType())); |
| 76 function.set_is_debuggable(false); | 76 function.set_is_debuggable(false); |
| 77 function.set_is_visible(false); | 77 function.set_is_visible(false); |
| 78 function.AttachCode(code); | 78 function.AttachCode(code); |
| 79 // For inclusion in Snapshot::kAppWithJIT. |
| 80 function.set_unoptimized_code(code); |
| 79 | 81 |
| 80 isolate->object_store()->SetMegamorphicMissHandler(code, function); | 82 isolate->object_store()->SetMegamorphicMissHandler(code, function); |
| 81 } | 83 } |
| 82 | 84 |
| 83 | 85 |
| 84 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { | 86 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { |
| 85 StackZone zone(Thread::Current()); | 87 StackZone zone(Thread::Current()); |
| 86 intptr_t size = 0; | 88 intptr_t size = 0; |
| 87 MegamorphicCache& cache = MegamorphicCache::Handle(); | 89 MegamorphicCache& cache = MegamorphicCache::Handle(); |
| 88 Array& buckets = Array::Handle(); | 90 Array& buckets = Array::Handle(); |
| 89 const GrowableObjectArray& table = GrowableObjectArray::Handle( | 91 const GrowableObjectArray& table = GrowableObjectArray::Handle( |
| 90 isolate->object_store()->megamorphic_cache_table()); | 92 isolate->object_store()->megamorphic_cache_table()); |
| 91 if (table.IsNull()) return; | 93 if (table.IsNull()) return; |
| 92 for (intptr_t i = 0; i < table.Length(); i++) { | 94 for (intptr_t i = 0; i < table.Length(); i++) { |
| 93 cache ^= table.At(i); | 95 cache ^= table.At(i); |
| 94 buckets = cache.buckets(); | 96 buckets = cache.buckets(); |
| 95 size += MegamorphicCache::InstanceSize(); | 97 size += MegamorphicCache::InstanceSize(); |
| 96 size += Array::InstanceSize(buckets.Length()); | 98 size += Array::InstanceSize(buckets.Length()); |
| 97 } | 99 } |
| 98 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n", | 100 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n", |
| 99 table.Length(), size / 1024); | 101 table.Length(), size / 1024); |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace dart | 104 } // namespace dart |
| OLD | NEW |