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

Unified Diff: runtime/lib/object.cc

Issue 14703005: Added Object._cid getter, optimized it. Added to (some) classes a static final _clCid. Use those to… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/lib/object.cc
===================================================================
--- runtime/lib/object.cc (revision 22603)
+++ runtime/lib/object.cc (working copy)
@@ -15,6 +15,13 @@
DECLARE_FLAG(bool, enable_type_checks);
+DEFINE_NATIVE_ENTRY(Object_cid, 1) {
+ const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
siva 2013/05/13 20:38:00 GET_NONE_NULL_NATIVE_ARGUMENT(Instance, instance,
Ivan Posva 2013/05/13 22:12:37 Null is a valid receiver for the _cid method. So I
srdjan 2013/05/14 17:46:31 What Ivan said.
+ const Class& cls = Class::Handle(instance.clazz());
+ return Smi::New(cls.id());
+}
+
+
DEFINE_NATIVE_ENTRY(Object_toString, 1) {
const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
const char* c_str = instance.ToCString();

Powered by Google App Engine
This is Rietveld 408576698