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

Unified Diff: runtime/vm/kernel_to_il.h

Issue 2778423002: Revert "[kernel] Don't use kernel ast nodes as keys" (Closed)
Patch Set: Created 3 years, 9 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/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_to_il.h
diff --git a/runtime/vm/kernel_to_il.h b/runtime/vm/kernel_to_il.h
index 7d71ad21e544211cf4a2d4bc6ac0425812e1c768..e6033eb45cf6d2beee81da5201cb68ce1b3fba47 100644
--- a/runtime/vm/kernel_to_il.h
+++ b/runtime/vm/kernel_to_il.h
@@ -81,54 +81,6 @@ class Map : public DirectChainedHashMap<RawPointerKeyValueTrait<K, V> > {
}
};
-
-template <typename V>
-class IntKeyRawPointerValueTrait {
- public:
- typedef intptr_t Key;
- typedef V Value;
-
- struct Pair {
- Key key;
- Value value;
- Pair() : key(NULL), value() {}
- Pair(const Key key, const Value& value) : key(key), value(value) {}
- Pair(const Pair& other) : key(other.key), value(other.value) {}
- };
-
- static Key KeyOf(Pair kv) { return kv.key; }
- static Value ValueOf(Pair kv) { return kv.value; }
- static intptr_t Hashcode(Key key) { return reinterpret_cast<intptr_t>(key); }
- static bool IsKeyEqual(Pair kv, Key key) { return kv.key == key; }
-};
-
-template <typename V>
-class IntMap : public DirectChainedHashMap<IntKeyRawPointerValueTrait<V> > {
- public:
- typedef typename IntKeyRawPointerValueTrait<V>::Key Key;
- typedef typename IntKeyRawPointerValueTrait<V>::Value Value;
- typedef typename IntKeyRawPointerValueTrait<V>::Pair Pair;
-
- inline void Insert(const Key& key, const Value& value) {
- Pair pair(key, value);
- DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Insert(pair);
- }
-
- inline V Lookup(const Key& key) {
- Pair* pair =
- DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Lookup(key);
- if (pair == NULL) {
- return V();
- } else {
- return pair->value;
- }
- }
-
- inline Pair* LookupPair(const Key& key) {
- return DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Lookup(key);
- }
-};
-
template <typename K, typename V>
class MallocMap
: public MallocDirectChainedHashMap<RawPointerKeyValueTrait<K, V> > {
@@ -550,7 +502,7 @@ class ConstantEvaluator : public ExpressionVisitor {
struct FunctionScope {
- intptr_t kernel_offset;
+ FunctionNode* function;
LocalScope* scope;
};
@@ -566,8 +518,8 @@ class ScopeBuildingResult : public ZoneAllocated {
yield_jump_variable(NULL),
yield_context_variable(NULL) {}
- IntMap<LocalVariable*> locals;
- IntMap<LocalScope*> scopes;
+ Map<VariableDeclaration, LocalVariable*> locals;
+ Map<TreeNode, LocalScope*> scopes;
GrowableArray<FunctionScope> function_scopes;
// Only non-NULL for instance functions.
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698