| 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/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return cache.raw(); | 47 return cache.raw(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 void MegamorphicCacheTable::InitMissHandler() { | 51 void MegamorphicCacheTable::InitMissHandler() { |
| 52 // The miss handler for a class ID not found in the table is invoked as a | 52 // The miss handler for a class ID not found in the table is invoked as a |
| 53 // normal Dart function. | 53 // normal Dart function. |
| 54 const Code& code = | 54 const Code& code = |
| 55 Code::Handle(StubCode::Generate("_stub_MegamorphicMiss", | 55 Code::Handle(StubCode::Generate("_stub_MegamorphicMiss", |
| 56 StubCode::GenerateMegamorphicMissStub)); | 56 StubCode::GenerateMegamorphicMissStub)); |
| 57 const String& name = String::Handle(Symbols::New("megamorphic_miss")); | |
| 58 const Class& cls = | 57 const Class& cls = |
| 59 Class::Handle(Type::Handle(Type::Function()).type_class()); | 58 Class::Handle(Type::Handle(Type::Function()).type_class()); |
| 60 const Function& function = | 59 const Function& function = |
| 61 Function::Handle(Function::New(name, | 60 Function::Handle(Function::New(Symbols::MegamorphicMiss(), |
| 62 RawFunction::kRegularFunction, | 61 RawFunction::kRegularFunction, |
| 63 false, // Not static. | 62 false, // Not static. |
| 64 false, // Not const. | 63 false, // Not const. |
| 65 false, // Not abstract. | 64 false, // Not abstract. |
| 66 false, // Not external. | 65 false, // Not external. |
| 67 cls, | 66 cls, |
| 68 0)); // No token position. | 67 0)); // No token position. |
| 69 function.SetCode(code); | 68 function.SetCode(code); |
| 70 miss_handler_ = function.raw(); | 69 miss_handler_ = function.raw(); |
| 71 } | 70 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 90 for (intptr_t i = 0; i < length_; ++i) { | 89 for (intptr_t i = 0; i < length_; ++i) { |
| 91 cache = table_[i].cache; | 90 cache = table_[i].cache; |
| 92 buckets = cache.buckets(); | 91 buckets = cache.buckets(); |
| 93 size += MegamorphicCache::InstanceSize(); | 92 size += MegamorphicCache::InstanceSize(); |
| 94 size += Array::InstanceSize(buckets.Length()); | 93 size += Array::InstanceSize(buckets.Length()); |
| 95 } | 94 } |
| 96 OS::Print("%"Pd" megamorphic caches using %"Pd"KB.\n", length_, size / 1024); | 95 OS::Print("%"Pd" megamorphic caches using %"Pd"KB.\n", length_, size / 1024); |
| 97 } | 96 } |
| 98 | 97 |
| 99 } // namespace dart | 98 } // namespace dart |
| OLD | NEW |