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

Unified Diff: runtime/vm/precompiler.h

Issue 2300873002: VM: Compute static guarded cid for final instance fields. (Closed)
Patch Set: address comments Created 4 years, 3 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/precompiler.h
diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h
index 38e16fefd32dd9988c35a995b53b59abe1bb3b32..e5d4742e7d2f8f4ad0f9181363df0125e7294048 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -259,13 +259,47 @@ class InstanceKeyValueTrait {
typedef DirectChainedHashMap<InstanceKeyValueTrait> InstanceSet;
+struct FieldTypePair {
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const Field* Key;
+ typedef intptr_t Value;
+ typedef FieldTypePair Pair;
+
+ static Key KeyOf(Pair kv) { return kv.field_; }
+
+ static Value ValueOf(Pair kv) { return kv.cid_; }
+
+ static inline intptr_t Hashcode(Key key) {
+ return key->token_pos().value();
+ }
+
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair.field_->raw() == key->raw();
+ }
+
+ FieldTypePair(const Field* f, intptr_t cid) : field_(f), cid_(cid) { }
+
+ FieldTypePair() : field_(NULL), cid_(-1) { }
+
+ void Print() const;
+
+ const Field* field_;
+ intptr_t cid_;
+};
+
+typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap;
+
+
class Precompiler : public ValueObject {
public:
static RawError* CompileAll(
Dart_QualifiedFunctionName embedder_entry_points[],
bool reset_fields);
- static RawError* CompileFunction(Thread* thread, const Function& function);
+ static RawError* CompileFunction(Thread* thread,
+ Zone* zone,
+ const Function& function,
+ FieldTypeMap* field_type_map = NULL);
static RawObject* EvaluateStaticInitializer(const Field& field);
static RawObject* ExecuteOnce(SequenceNode* fragment);
@@ -276,7 +310,6 @@ class Precompiler : public ValueObject {
private:
Precompiler(Thread* thread, bool reset_fields);
-
void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]);
void ClearAllCode();
void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]);
@@ -321,6 +354,7 @@ class Precompiler : public ValueObject {
void CollectDynamicFunctionNames();
void PrecompileStaticInitializers();
+ void PrecompileConstructors();
template<typename T>
class Visitor : public ValueObject {
@@ -369,6 +403,7 @@ class Precompiler : public ValueObject {
TypeArgumentsSet typeargs_to_retain_;
AbstractTypeSet types_to_retain_;
InstanceSet consts_to_retain_;
+ FieldTypeMap field_type_map_;
Error& error_;
};
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698