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

Unified Diff: runtime/vm/kernel_to_il.h

Issue 2781313003: Add kernel_offset to all expressions; Make KernelConstMapKeyEqualsTraits use kernel_offset (Closed)
Patch Set: Removed debug printf 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 ad47693d8eaf741aca65af1b330728d7ca5b66e6..fc28e58ae2c2a1f379cd56cbec565e6c58214787 100644
--- a/runtime/vm/kernel_to_il.h
+++ b/runtime/vm/kernel_to_il.h
@@ -20,8 +20,6 @@ namespace kernel {
class StreamingFlowGraphBuilder;
-// TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we
-// should use [TokenPosition]s.
class KernelConstMapKeyEqualsTraits {
public:
static const char* Name() { return "KernelConstMapKeyEqualsTraits"; }
@@ -32,25 +30,24 @@ class KernelConstMapKeyEqualsTraits {
const Smi& key2 = Smi::Cast(b);
return (key1.Value() == key2.Value());
}
- static bool IsMatch(const TreeNode* key1, const Object& b) {
+ static bool IsMatch(const intptr_t key1, const Object& b) {
return KeyAsSmi(key1) == Smi::Cast(b).raw();
}
static uword Hash(const Object& obj) {
const Smi& key = Smi::Cast(obj);
return HashValue(key.Value());
}
- static uword Hash(const TreeNode* key) {
+ static uword Hash(const intptr_t key) {
return HashValue(Smi::Value(KeyAsSmi(key)));
}
- static RawObject* NewKey(const TreeNode* key) { return KeyAsSmi(key); }
+ static RawObject* NewKey(const intptr_t key) { return KeyAsSmi(key); }
private:
static uword HashValue(intptr_t pos) { return pos % (Smi::kMaxValue - 13); }
- static RawSmi* KeyAsSmi(const TreeNode* key) {
- // We exploit that all [TreeNode] objects will be aligned and therefore are
- // already [Smi]s!
- return reinterpret_cast<RawSmi*>(const_cast<TreeNode*>(key));
+ static RawSmi* KeyAsSmi(const intptr_t key) {
+ ASSERT(key >= 0);
+ return Smi::New(key);
}
};
typedef UnorderedHashMap<KernelConstMapKeyEqualsTraits> KernelConstantsMap;
@@ -535,9 +532,6 @@ class ConstantEvaluator : public ExpressionVisitor {
return result_.raw() == Bool::True().raw();
}
- // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we
- // should use [TokenPosition]s as well as the existing functionality in
- // `Parser::CacheConstantValue`.
bool GetCachedConstant(TreeNode* node, Instance* value);
void CacheConstantValue(TreeNode* node, const Instance& value);
« 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