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

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

Issue 2572423004: Reapply "Save and restore feedback from JIT." (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 #include "vm/program_visitor.h"
6
7 #include "vm/object.h"
8 #include "vm/object_store.h"
9
10 namespace dart {
11
12 void ProgramVisitor::VisitClasses(ClassVisitor* visitor) {
13 Thread* thread = Thread::Current();
14 Isolate* isolate = thread->isolate();
15 Zone* zone = thread->zone();
16 GrowableObjectArray& libraries =
17 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
18 Library& lib = Library::Handle(zone);
19 Class& cls = Class::Handle(zone);
20
21 for (intptr_t i = 0; i < libraries.Length(); i++) {
22 lib ^= libraries.At(i);
23 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
24 while (it.HasNext()) {
25 cls = it.GetNextClass();
26 if (cls.IsDynamicClass()) {
27 continue; // class 'dynamic' is in the read-only VM isolate.
28 }
29 visitor->Visit(cls);
30 }
31 }
32 }
33
34
35 void ProgramVisitor::VisitFunctions(FunctionVisitor* visitor) {
36 Thread* thread = Thread::Current();
37 Isolate* isolate = thread->isolate();
38 Zone* zone = thread->zone();
39 GrowableObjectArray& libraries =
40 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
41 Library& lib = Library::Handle(zone);
42 Class& cls = Class::Handle(zone);
43 Array& functions = Array::Handle(zone);
44 Array& fields = Array::Handle(zone);
45 Field& field = Field::Handle(zone);
46 Object& object = Object::Handle(zone);
47 Function& function = Function::Handle(zone);
48 GrowableObjectArray& closures = GrowableObjectArray::Handle(zone);
49
50 for (intptr_t i = 0; i < libraries.Length(); i++) {
51 lib ^= libraries.At(i);
52 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
53 while (it.HasNext()) {
54 cls = it.GetNextClass();
55 if (cls.IsDynamicClass()) {
56 continue; // class 'dynamic' is in the read-only VM isolate.
57 }
58
59 functions = cls.functions();
60 for (intptr_t j = 0; j < functions.Length(); j++) {
61 function ^= functions.At(j);
62 visitor->Visit(function);
63 if (function.HasImplicitClosureFunction()) {
64 function = function.ImplicitClosureFunction();
65 visitor->Visit(function);
66 }
67 }
68
69 functions = cls.invocation_dispatcher_cache();
70 for (intptr_t j = 0; j < functions.Length(); j++) {
71 object = functions.At(j);
72 if (object.IsFunction()) {
73 function ^= functions.At(j);
74 visitor->Visit(function);
75 }
76 }
77 fields = cls.fields();
78 for (intptr_t j = 0; j < fields.Length(); j++) {
79 field ^= fields.At(j);
80 if (field.is_static() && field.HasPrecompiledInitializer()) {
81 function ^= field.PrecompiledInitializer();
82 visitor->Visit(function);
83 }
84 }
85 }
86 }
87 closures = isolate->object_store()->closure_functions();
88 for (intptr_t j = 0; j < closures.Length(); j++) {
89 function ^= closures.At(j);
90 visitor->Visit(function);
91 ASSERT(!function.HasImplicitClosureFunction());
92 }
93 }
94
95 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698