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

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: addressed comments 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
Index: runtime/vm/precompiler.h
diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h
index c32a955269d43287faa9958dac99e0cd8b9e3404..3dc25e0ce4a5d46a02db21b4972f2a92a2a54bee 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 {
@@ -256,6 +257,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_

Powered by Google App Engine
This is Rietveld 408576698