| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return isolate->object_store()->megamorphic_miss_function(); | 50 return isolate->object_store()->megamorphic_miss_function(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) { | 54 void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) { |
| 55 // The miss handler for a class ID not found in the table is invoked as a | 55 // The miss handler for a class ID not found in the table is invoked as a |
| 56 // normal Dart function. | 56 // normal Dart function. |
| 57 const Code& code = | 57 const Code& code = |
| 58 Code::Handle(StubCode::Generate("_stub_MegamorphicMiss", | 58 Code::Handle(StubCode::Generate("_stub_MegamorphicMiss", |
| 59 StubCode::GenerateMegamorphicMissStub)); | 59 StubCode::GenerateMegamorphicMissStub)); |
| 60 // When FLAG_lazy_dispatchers=false, this stub can be on the stack during |
| 61 // exceptions, but it has a corresponding function so IsStubCode is false and |
| 62 // it is considered in the search for an exception handler. |
| 63 code.set_exception_handlers(Object::empty_exception_handlers()); |
| 60 const Class& cls = | 64 const Class& cls = |
| 61 Class::Handle(Type::Handle(Type::Function()).type_class()); | 65 Class::Handle(Type::Handle(Type::Function()).type_class()); |
| 62 const Function& function = | 66 const Function& function = |
| 63 Function::Handle(Function::New(Symbols::MegamorphicMiss(), | 67 Function::Handle(Function::New(Symbols::MegamorphicMiss(), |
| 64 RawFunction::kRegularFunction, | 68 RawFunction::kRegularFunction, |
| 65 false, // Not static. | 69 false, // Not static. |
| 66 false, // Not const. | 70 false, // Not const. |
| 67 false, // Not abstract. | 71 false, // Not abstract. |
| 68 false, // Not external. | 72 false, // Not external. |
| 69 false, // Not native. | 73 false, // Not native. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 88 cache ^= table.At(i + kEntryCacheOffset); | 92 cache ^= table.At(i + kEntryCacheOffset); |
| 89 buckets = cache.buckets(); | 93 buckets = cache.buckets(); |
| 90 size += MegamorphicCache::InstanceSize(); | 94 size += MegamorphicCache::InstanceSize(); |
| 91 size += Array::InstanceSize(buckets.Length()); | 95 size += Array::InstanceSize(buckets.Length()); |
| 92 } | 96 } |
| 93 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n", | 97 OS::Print("%" Pd " megamorphic caches using %" Pd "KB.\n", |
| 94 table.Length() / kEntrySize, size / 1024); | 98 table.Length() / kEntrySize, size / 1024); |
| 95 } | 99 } |
| 96 | 100 |
| 97 } // namespace dart | 101 } // namespace dart |
| OLD | NEW |