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

Unified Diff: runtime/lib/object.cc

Issue 2748073002: Revert "VM: Simplify lowering of is-tests." (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | runtime/lib/object_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/object.cc
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 6ce4f4774c41ca3ac92f63a4783a7311ce9c3e0e..308209a26bbd275601456134d200c8a7a4fb3f1d 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -169,13 +169,14 @@ DEFINE_NATIVE_ENTRY(Object_haveSameRuntimeType, 2) {
}
-DEFINE_NATIVE_ENTRY(Object_instanceOf, 3) {
+DEFINE_NATIVE_ENTRY(Object_instanceOf, 4) {
const Instance& instance =
Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
const TypeArguments& instantiator_type_arguments =
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
const AbstractType& type =
AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(3));
ASSERT(type.IsFinalized());
ASSERT(!type.IsMalformed());
ASSERT(!type.IsMalbounded());
@@ -208,7 +209,7 @@ DEFINE_NATIVE_ENTRY(Object_instanceOf, 3) {
Symbols::Empty(), bound_error_message);
UNREACHABLE();
}
- return Bool::Get(is_instance_of).raw();
+ return Bool::Get(negate.value() ? !is_instance_of : is_instance_of).raw();
}
DEFINE_NATIVE_ENTRY(Object_simpleInstanceOf, 2) {
@@ -242,6 +243,65 @@ DEFINE_NATIVE_ENTRY(Object_simpleInstanceOf, 2) {
return Bool::Get(is_instance_of).raw();
}
+DEFINE_NATIVE_ENTRY(Object_instanceOfNum, 2) {
+ const Instance& instance =
+ Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool is_instance_of = instance.IsNumber();
+ if (negate.value()) {
+ is_instance_of = !is_instance_of;
+ }
+ return Bool::Get(is_instance_of).raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(Object_instanceOfInt, 2) {
+ const Instance& instance =
+ Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool is_instance_of = instance.IsInteger();
+ if (negate.value()) {
+ is_instance_of = !is_instance_of;
+ }
+ return Bool::Get(is_instance_of).raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(Object_instanceOfSmi, 2) {
+ const Instance& instance =
+ Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool is_instance_of = instance.IsSmi();
+ if (negate.value()) {
+ is_instance_of = !is_instance_of;
+ }
+ return Bool::Get(is_instance_of).raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(Object_instanceOfDouble, 2) {
+ const Instance& instance =
+ Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool is_instance_of = instance.IsDouble();
+ if (negate.value()) {
+ is_instance_of = !is_instance_of;
+ }
+ return Bool::Get(is_instance_of).raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(Object_instanceOfString, 2) {
+ const Instance& instance =
+ Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
+ const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool is_instance_of = instance.IsString();
+ if (negate.value()) {
+ is_instance_of = !is_instance_of;
+ }
+ return Bool::Get(is_instance_of).raw();
+}
+
DEFINE_NATIVE_ENTRY(Object_as, 3) {
const Instance& instance =
« no previous file with comments | « no previous file | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698