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

Unified Diff: runtime/lib/class_id.cc

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month 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/lib/class_id.cc
diff --git a/runtime/lib/class_id.cc b/runtime/lib/class_id.cc
index 2d9f67d3defa7e0f00e1046d9dda4117b79b61a8..c950b0edd22e9128f893da29b1a7857b1dab943a 100644
--- a/runtime/lib/class_id.cc
+++ b/runtime/lib/class_id.cc
@@ -13,4 +13,24 @@ DEFINE_NATIVE_ENTRY(ClassID_getID, 1) {
return Smi::New(instance.GetClassId());
}
+
+DEFINE_NATIVE_ENTRY(ClassID_byName, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
+
+#define CLASS_LIST_WITH_NULL(V) \
+ V(Null) \
+ CLASS_LIST_NO_OBJECT(V)
+
+#define COMPARE(clazz) \
+ if (name.Equals(#clazz)) return Smi::New(k##clazz##Cid);
+
+ CLASS_LIST_WITH_NULL(COMPARE)
+
+#undef COMPARE
+#undef CLASS_LIST_WITH_NULL
+
+ UNREACHABLE();
+ return Smi::New(-1);
+}
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698