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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 StubCode::GenerateMegamorphicMissStub)); | 58 StubCode::GenerateMegamorphicMissStub)); |
59 // When FLAG_lazy_dispatchers=false, this stub can be on the stack during | 59 // When FLAG_lazy_dispatchers=false, this stub can be on the stack during |
60 // exceptions, but it has a corresponding function so IsStubCode is false and | 60 // exceptions, but it has a corresponding function so IsStubCode is false and |
61 // it is considered in the search for an exception handler. | 61 // it is considered in the search for an exception handler. |
62 code.set_exception_handlers(Object::empty_exception_handlers()); | 62 code.set_exception_handlers(Object::empty_exception_handlers()); |
63 const Class& cls = | 63 const Class& cls = |
64 Class::Handle(Type::Handle(Type::DartFunctionType()).type_class()); | 64 Class::Handle(Type::Handle(Type::DartFunctionType()).type_class()); |
65 const Function& function = | 65 const Function& function = |
66 Function::Handle(Function::New(Symbols::MegamorphicMiss(), | 66 Function::Handle(Function::New(Symbols::MegamorphicMiss(), |
67 RawFunction::kRegularFunction, | 67 RawFunction::kRegularFunction, |
68 false, // Not static. | 68 true, // Static, but called as a method. |
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); // Has a single entry point, as a static function. |
79 // For inclusion in Snapshot::kAppWithJIT. | 79 // For inclusion in Snapshot::kAppWithJIT. |
80 function.set_unoptimized_code(code); | 80 function.set_unoptimized_code(code); |
81 | 81 |
82 isolate->object_store()->SetMegamorphicMissHandler(code, function); | 82 isolate->object_store()->SetMegamorphicMissHandler(code, function); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { | 86 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { |
87 StackZone zone(Thread::Current()); | 87 StackZone zone(Thread::Current()); |
88 intptr_t size = 0; | 88 intptr_t size = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 cumulative_entries += probe_counts[i]; | 145 cumulative_entries += probe_counts[i]; |
146 OS::Print("Megamorphic probe %" Pd ": %" Pd " (%lf)\n", | 146 OS::Print("Megamorphic probe %" Pd ": %" Pd " (%lf)\n", |
147 i, probe_counts[i], | 147 i, probe_counts[i], |
148 static_cast<double>(cumulative_entries) / | 148 static_cast<double>(cumulative_entries) / |
149 static_cast<double>(entry_count)); | 149 static_cast<double>(entry_count)); |
150 } | 150 } |
151 delete[] probe_counts; | 151 delete[] probe_counts; |
152 } | 152 } |
153 | 153 |
154 } // namespace dart | 154 } // namespace dart |
OLD | NEW |