| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 #ifndef RUNTIME_VM_PROGRAM_VISITOR_H_ | 5 #ifndef RUNTIME_VM_PROGRAM_VISITOR_H_ |
| 6 #define RUNTIME_VM_PROGRAM_VISITOR_H_ | 6 #define RUNTIME_VM_PROGRAM_VISITOR_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 class Function; | 12 class Function; |
| 13 class Class; | 13 class Class; |
| 14 | 14 |
| 15 template <typename T> | 15 template <typename T> |
| 16 class Visitor : public ValueObject { | 16 class Visitor : public ValueObject { |
| 17 public: | 17 public: |
| 18 virtual ~Visitor() {} | 18 virtual ~Visitor() {} |
| 19 virtual void Visit(const T& obj) = 0; | 19 virtual void Visit(const T& obj) = 0; |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 typedef Visitor<Function> FunctionVisitor; | 22 typedef Visitor<Function> FunctionVisitor; |
| 23 typedef Visitor<Class> ClassVisitor; | 23 typedef Visitor<Class> ClassVisitor; |
| 24 | 24 |
| 25 class ProgramVisitor : public AllStatic { | 25 class ProgramVisitor : public AllStatic { |
| 26 public: | 26 public: |
| 27 static void VisitFunctions(FunctionVisitor* visitor); | 27 static void VisitFunctions(FunctionVisitor* visitor); |
| 28 static void VisitClasses(ClassVisitor* visitor); | 28 static void VisitClasses(ClassVisitor* visitor); |
| 29 |
| 30 static void Dedup(); |
| 31 |
| 32 private: |
| 33 static void ShareMegamorphicBuckets(); |
| 34 static void DedupStackMaps(); |
| 35 static void DedupPcDescriptors(); |
| 36 static void DedupDeoptEntries(); |
| 37 static void DedupCodeSourceMaps(); |
| 38 static void DedupLists(); |
| 39 static void DedupInstructions(); |
| 29 }; | 40 }; |
| 30 | 41 |
| 31 } // namespace dart | 42 } // namespace dart |
| 32 | 43 |
| 33 #endif // RUNTIME_VM_PROGRAM_VISITOR_H_ | 44 #endif // RUNTIME_VM_PROGRAM_VISITOR_H_ |
| OLD | NEW |