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

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

Issue 3001463002: [gardening] Revert "Eliminate dependencies on assemblers and code stubs in precompiled runtime." (Closed)
Patch Set: Created 3 years, 4 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/megamorphic_cache_table.h ('k') | runtime/vm/object.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"
(...skipping 30 matching lines...) Expand all
41 table.Add(cache, Heap::kOld); 41 table.Add(cache, Heap::kOld);
42 return cache.raw(); 42 return cache.raw();
43 } 43 }
44 44
45 RawFunction* MegamorphicCacheTable::miss_handler(Isolate* isolate) { 45 RawFunction* MegamorphicCacheTable::miss_handler(Isolate* isolate) {
46 ASSERT(isolate->object_store()->megamorphic_miss_function() != 46 ASSERT(isolate->object_store()->megamorphic_miss_function() !=
47 Function::null()); 47 Function::null());
48 return isolate->object_store()->megamorphic_miss_function(); 48 return isolate->object_store()->megamorphic_miss_function();
49 } 49 }
50 50
51 #if !defined(DART_PRECOMPILED_RUNTIME)
52 void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) { 51 void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) {
53 // 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
54 // normal Dart function. 53 // normal Dart function.
55 const Code& code = Code::Handle(StubCode::Generate( 54 const Code& code = Code::Handle(StubCode::Generate(
56 "_stub_MegamorphicMiss", StubCode::GenerateMegamorphicMissStub)); 55 "_stub_MegamorphicMiss", StubCode::GenerateMegamorphicMissStub));
57 // When FLAG_lazy_dispatchers=false, this stub can be on the stack during 56 // When FLAG_lazy_dispatchers=false, this stub can be on the stack during
58 // exceptions, but it has a corresponding function so IsStubCode is false and 57 // exceptions, but it has a corresponding function so IsStubCode is false and
59 // it is considered in the search for an exception handler. 58 // it is considered in the search for an exception handler.
60 code.set_exception_handlers(Object::empty_exception_handlers()); 59 code.set_exception_handlers(Object::empty_exception_handlers());
61 const Class& cls = 60 const Class& cls =
(...skipping 10 matching lines...) Expand all
72 function.set_is_debuggable(false); 71 function.set_is_debuggable(false);
73 function.set_is_visible(false); 72 function.set_is_visible(false);
74 function.AttachCode(code); // Has a single entry point, as a static function. 73 function.AttachCode(code); // Has a single entry point, as a static function.
75 // For inclusion in Snapshot::kFullJIT. 74 // For inclusion in Snapshot::kFullJIT.
76 function.set_unoptimized_code(code); 75 function.set_unoptimized_code(code);
77 76
78 ASSERT(isolate->object_store()->megamorphic_miss_function() == 77 ASSERT(isolate->object_store()->megamorphic_miss_function() ==
79 Function::null()); 78 Function::null());
80 isolate->object_store()->SetMegamorphicMissHandler(code, function); 79 isolate->object_store()->SetMegamorphicMissHandler(code, function);
81 } 80 }
82 #endif // !defined(DART_PRECOMPILED_RUNTIME)
83 81
84 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { 82 void MegamorphicCacheTable::PrintSizes(Isolate* isolate) {
85 StackZone zone(Thread::Current()); 83 StackZone zone(Thread::Current());
86 intptr_t size = 0; 84 intptr_t size = 0;
87 MegamorphicCache& cache = MegamorphicCache::Handle(); 85 MegamorphicCache& cache = MegamorphicCache::Handle();
88 Array& buckets = Array::Handle(); 86 Array& buckets = Array::Handle();
89 const GrowableObjectArray& table = GrowableObjectArray::Handle( 87 const GrowableObjectArray& table = GrowableObjectArray::Handle(
90 isolate->object_store()->megamorphic_cache_table()); 88 isolate->object_store()->megamorphic_cache_table());
91 if (table.IsNull()) return; 89 if (table.IsNull()) return;
92 intptr_t max_size = 0; 90 intptr_t max_size = 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 for (intptr_t i = 0; i <= max_probe_count; i++) { 140 for (intptr_t i = 0; i <= max_probe_count; i++) {
143 cumulative_entries += probe_counts[i]; 141 cumulative_entries += probe_counts[i];
144 OS::Print("Megamorphic probe %" Pd ": %" Pd " (%lf)\n", i, probe_counts[i], 142 OS::Print("Megamorphic probe %" Pd ": %" Pd " (%lf)\n", i, probe_counts[i],
145 static_cast<double>(cumulative_entries) / 143 static_cast<double>(cumulative_entries) /
146 static_cast<double>(entry_count)); 144 static_cast<double>(entry_count));
147 } 145 }
148 delete[] probe_counts; 146 delete[] probe_counts;
149 } 147 }
150 148
151 } // namespace dart 149 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698