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

Unified Diff: runtime/vm/precompiler.h

Issue 1686773002: Precompilation: drop unused types and type arguments and empty classes and libraries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/precompiler.h
diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h
index c32a955269d43287faa9958dac99e0cd8b9e3404..a8c98d82b57fd6f3076c0dbf255d988cc64b61a9 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -166,6 +166,75 @@ class FieldKeyValueTrait {
typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet;
+class ClassKeyValueTrait {
+ public:
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const Class* Key;
+ typedef const Class* Value;
+ typedef const Class* Pair;
+
+ static Key KeyOf(Pair kv) { return kv; }
+
+ static Value ValueOf(Pair kv) { return kv; }
+
+ static inline intptr_t Hashcode(Key key) {
+ return key->token_pos().value();
regis 2016/02/19 20:54:07 You'll get a lot of collisions, since the first cl
+ }
+
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair->raw() == key->raw();
+ }
+};
+
+typedef DirectChainedHashMap<ClassKeyValueTrait> ClassSet;
+
+
+class AbstractTypeKeyValueTrait {
+ public:
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const AbstractType* Key;
+ typedef const AbstractType* Value;
+ typedef const AbstractType* Pair;
+
+ static Key KeyOf(Pair kv) { return kv; }
+
+ static Value ValueOf(Pair kv) { return kv; }
+
+ static inline intptr_t Hashcode(Key key) {
+ return key->token_pos().value();
regis 2016/02/19 20:54:07 An AbstractType has a Hash(). You do not use Hash(
+ }
+
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair->raw() == key->raw();
+ }
+};
+
+typedef DirectChainedHashMap<AbstractTypeKeyValueTrait> AbstractTypeSet;
+
+
+class TypeArgumentsKeyValueTrait {
+ public:
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const TypeArguments* Key;
+ typedef const TypeArguments* Value;
+ typedef const TypeArguments* Pair;
+
+ static Key KeyOf(Pair kv) { return kv; }
+
+ static Value ValueOf(Pair kv) { return kv; }
+
+ static inline intptr_t Hashcode(Key key) {
+ return key->Hash();
+ }
+
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair->raw() == key->raw();
+ }
+};
+
+typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet;
+
+
class Precompiler : public ValueObject {
public:
static RawError* CompileAll(
@@ -199,6 +268,10 @@ class Precompiler : public ValueObject {
void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]);
void Iterate();
+ void AddType(const AbstractType& type);
+ void AddTypesOf(const Class& cls);
+ void AddTypesOf(const Function& function);
+ void AddTypeArguments(const TypeArguments& args);
void AddCalleesOf(const Function& function);
void AddConstObject(const Instance& instance);
void AddClosureCall(const ICData& call_site);
@@ -213,6 +286,12 @@ class Precompiler : public ValueObject {
void DropFunctions();
void DropFields();
+ void TraceTypesFromRetainedClasses();
+ void DropTypes();
+ void DropTypeArguments();
+ void DropClasses();
+ void DropLibraries();
+
void BindStaticCalls();
void DedupStackmaps();
void DedupStackmapLists();
@@ -247,12 +326,19 @@ class Precompiler : public ValueObject {
intptr_t selector_count_;
intptr_t dropped_function_count_;
intptr_t dropped_field_count_;
+ intptr_t dropped_class_count_;
+ intptr_t dropped_typearg_count_;
+ intptr_t dropped_type_count_;
+ intptr_t dropped_library_count_;
- const GrowableObjectArray& libraries_;
+ GrowableObjectArray& libraries_;
const GrowableObjectArray& pending_functions_;
SymbolSet sent_selectors_;
FunctionSet enqueued_functions_;
FieldSet fields_to_retain_;
+ ClassSet classes_to_retain_;
+ TypeArgumentsSet typeargs_to_retain_;
+ AbstractTypeSet types_to_retain_;
Error& error_;
};
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | runtime/vm/precompiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698