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

Unified Diff: runtime/vm/precompiler.h

Issue 1714743002: VM: Separate precompilation-specific code, make flags const. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix build after merge 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
« no previous file with comments | « runtime/vm/parser.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 3f16a2815365e9c7b09cd8d77040d4416bf18de4..43b7b96f9a7e9ab75861830c2dae29872fa3fee0 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -7,6 +7,7 @@
#include "vm/allocation.h"
#include "vm/hash_map.h"
+#include "vm/hash_table.h"
#include "vm/object.h"
namespace dart {
@@ -342,6 +343,34 @@ class Precompiler : public ValueObject {
Error& error_;
};
+
+class FunctionsTraits {
+ public:
+ static bool IsMatch(const Object& a, const Object& b) {
+ Zone* zone = Thread::Current()->zone();
+ String& a_s = String::Handle(zone);
+ String& b_s = String::Handle(zone);
+ a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw();
+ b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw();
+ ASSERT(a_s.IsSymbol() && b_s.IsSymbol());
+ return a_s.raw() == b_s.raw();
+ }
+ static uword Hash(const Object& obj) {
+ if (obj.IsFunction()) {
+ return String::Handle(Function::Cast(obj).name()).Hash();
+ } else {
+ ASSERT(String::Cast(obj).IsSymbol());
+ return String::Cast(obj).Hash();
+ }
+ }
+ static RawObject* NewKey(const Function& function) {
+ return function.raw();
+ }
+};
+
+typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet;
+
+
} // namespace dart
#endif // VM_PRECOMPILER_H_
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698