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

Unified Diff: runtime/vm/precompiler.h

Issue 1387613003: Dedup stackmaps. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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.h ('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 3106984a178f95d30e37ea31d9c4b0a78deaf43b..5d3362e842b079900d2aab328d1e5bfa023e4744 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -20,61 +20,50 @@ class GrowableObjectArray;
class RawError;
class String;
-class SymbolPair {
+class SymbolKeyValueTrait {
public:
// Typedefs needed for the DirectChainedHashMap template.
typedef const String* Key;
- typedef bool Value;
- typedef SymbolPair Pair;
+ typedef const String* Value;
+ typedef const String* Pair;
- SymbolPair() : key_(NULL), value_(false) {}
- SymbolPair(Key key, Value value) : key_(key), value_(value) {
- ASSERT(key->IsNotTemporaryScopedHandle());
- }
-
- static Key KeyOf(Pair kv) { return kv.key_; }
+ static Key KeyOf(Pair kv) { return kv; }
- static Value ValueOf(Pair kv) { return kv.value_; }
+ 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.key_->raw() == key->raw();
+ return pair->raw() == key->raw();
}
-
- private:
- Key key_;
- Value value_;
};
+typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet;
-class SymbolSet : public ValueObject {
+class StackmapKeyValueTrait {
public:
- explicit SymbolSet(Zone* zone) : zone_(zone), map_() {}
-
- void Add(const String& symbol) {
- ASSERT(symbol.IsSymbol());
- if (symbol.IsNotTemporaryScopedHandle()) {
- SymbolPair pair(&symbol, true);
- map_.Insert(pair);
- } else {
- SymbolPair pair(&String::ZoneHandle(zone_, symbol.raw()), true);
- map_.Insert(pair);
- }
- }
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef const Stackmap* Key;
+ typedef const Stackmap* Value;
+ typedef const Stackmap* Pair;
+
+ static Key KeyOf(Pair kv) { return kv; }
+
+ static Value ValueOf(Pair kv) { return kv; }
- bool Includes(const String& symbol) {
- ASSERT(symbol.IsSymbol());
- return map_.Lookup(&symbol);
+ static inline intptr_t Hashcode(Key key) {
+ return key->PcOffset();
}
- private:
- Zone* zone_;
- DirectChainedHashMap<SymbolPair> map_;
+ static inline bool IsKeyEqual(Pair pair, Key key) {
+ return pair->Equals(*key);
+ }
};
+typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet;
+
class Precompiler : public ValueObject {
public:
@@ -105,7 +94,15 @@ class Precompiler : public ValueObject {
void DropUncompiledFunctions();
void BindStaticCalls();
- void BindStaticCalls(const Function& function);
+ void DedupStackmaps();
+
+ class FunctionVisitor : public ValueObject {
+ public:
+ virtual ~FunctionVisitor() { }
+ virtual void VisitFunction(const Function& function) = 0;
+ };
+
+ void VisitFunctions(FunctionVisitor* visitor);
Thread* thread() const { return thread_; }
Zone* zone() const { return zone_; }
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698