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

Unified Diff: runtime/lib/object.cc

Issue 11694003: In unoptimized code use call for instanceof instead of inlined checks. This allows us to collect ty… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « no previous file | runtime/lib/object_patch.dart » ('j') | runtime/lib/object_patch.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/object.cc
===================================================================
--- runtime/lib/object.cc (revision 16547)
+++ runtime/lib/object.cc (working copy)
@@ -63,6 +63,28 @@
}
+DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) {
+ const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
+ // Instantiator at pos 1 is not used.
regis 2012/12/28 19:46:49 Do you need it for type feedback? Also, a comment
srdjan 2013/01/02 20:38:46 Added comment: // Instantiator at position 1 is
+ const AbstractTypeArguments& instantiator_type_arguments =
+ AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2));
+ const AbstractType& type =
+ AbstractType::CheckedHandle(arguments->NativeArgAt(3));
+ const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4));
+ ASSERT(type.IsFinalized());
+ Error& malformed_error = Error::Handle();
+ const bool is_instance_of = instance.IsInstanceOf(type,
+ instantiator_type_arguments,
+ &malformed_error);
+ ASSERT(malformed_error.IsNull());
regis 2012/12/28 19:46:49 Instantiating a type with a type argument that is
srdjan 2013/01/02 20:38:46 Fixed.
+ if (negate.value()) {
+ return is_instance_of ? Bool::False() : Bool::True();
+ } else {
+ return is_instance_of ? Bool::True() : Bool::False();
+ }
+}
+
+
DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) {
const AbstractType& type =
AbstractType::CheckedHandle(arguments->NativeArgAt(0));
« no previous file with comments | « no previous file | runtime/lib/object_patch.dart » ('j') | runtime/lib/object_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698