Index: test/cctest/interpreter/test-interpreter-intrinsics.cc |
diff --git a/test/cctest/interpreter/test-interpreter-intrinsics.cc b/test/cctest/interpreter/test-interpreter-intrinsics.cc |
index cfbfc462c8187b8b4511bae48619724f0ae840f2..b9dffcc70a92891754d58fec08c5ed559bff8651 100644 |
--- a/test/cctest/interpreter/test-interpreter-intrinsics.cc |
+++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc |
@@ -91,6 +91,105 @@ TEST(IsArray) { |
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); |
} |
+TEST(IsJSProxy) { |
+ HandleAndZoneScope handles; |
+ |
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), |
+ Runtime::kInlineIsJSProxy); |
+ Factory* factory = handles.main_isolate()->factory(); |
+ |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("new Date()"))); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("(function() {})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("'string'"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); |
+ CHECK_EQ(*factory->true_value(), |
+ *helper.Invoke(helper.NewObject("new Proxy({},{})"))); |
+} |
+ |
+TEST(IsRegExp) { |
+ HandleAndZoneScope handles; |
+ |
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), |
+ Runtime::kInlineIsRegExp); |
+ Factory* factory = handles.main_isolate()->factory(); |
+ |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("new Date()"))); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("(function() {})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); |
+ CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("(/x/)"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("'string'"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); |
+} |
+ |
+TEST(IsTypedArray) { |
+ HandleAndZoneScope handles; |
+ |
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), |
+ Runtime::kInlineIsTypedArray); |
+ Factory* factory = handles.main_isolate()->factory(); |
+ |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("new Date()"))); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("(function() {})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("'string'"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); |
+ |
+ CHECK_EQ( |
+ *factory->true_value(), |
+ *helper.Invoke(helper.NewObject("new Uint8Array(new ArrayBuffer(1));"))); |
+ CHECK_EQ( |
+ *factory->true_value(), |
+ *helper.Invoke(helper.NewObject("new Uint16Array(new ArrayBuffer(2));"))); |
+ CHECK_EQ( |
+ *factory->true_value(), |
+ *helper.Invoke(helper.NewObject("new Int32Array(new ArrayBuffer(4));"))); |
+} |
+ |
+TEST(IsSmi) { |
+ HandleAndZoneScope handles; |
+ |
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), |
+ Runtime::kInlineIsSmi); |
+ Factory* factory = handles.main_isolate()->factory(); |
+ |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("new Date()"))); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("(function() {})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("'string'"))); |
+ CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42.2"))); |
+ CHECK_EQ(*factory->false_value(), |
+ *helper.Invoke(helper.NewObject("4294967297"))); |
+ CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("42"))); |
+} |
+ |
TEST(Call) { |
HandleAndZoneScope handles; |
Isolate* isolate = handles.main_isolate(); |