Index: test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
index 0c2568f566a3dd4f10ee38430e14de7887e175c6..5663086c1d0ea1ea3742644f4202b02ea0a0e4d6 100644 |
--- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
+++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
@@ -7,6 +7,7 @@ |
#include "src/compiler/js-graph.h" |
#include "src/compiler/js-intrinsic-lowering.h" |
#include "src/compiler/js-operator.h" |
+#include "src/types-inl.h" |
#include "test/unittests/compiler/graph-unittest.h" |
#include "test/unittests/compiler/node-test-utils.h" |
#include "testing/gmock-support.h" |
@@ -23,9 +24,9 @@ namespace v8 { |
namespace internal { |
namespace compiler { |
-class JSIntrinsicLoweringTest : public GraphTest { |
+class JSIntrinsicLoweringTest : public TypedGraphTest { |
public: |
- JSIntrinsicLoweringTest() : GraphTest(3), javascript_(zone()) {} |
+ JSIntrinsicLoweringTest() : TypedGraphTest(3), javascript_(zone()) {} |
~JSIntrinsicLoweringTest() override {} |
protected: |
@@ -287,9 +288,9 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) { |
// %_IsJSReceiver |
-TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) { |
- Node* const input = Parameter(0); |
- Node* const context = Parameter(1); |
+TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiverWithAny) { |
+ Node* const input = Parameter(Type::Any()); |
+ Node* const context = Parameter(Type::Any()); |
Node* const effect = graph()->start(); |
Node* const control = graph()->start(); |
Reduction const r = Reduce(graph()->NewNode( |
@@ -302,7 +303,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) { |
EXPECT_THAT( |
phi, |
IsPhi( |
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(), |
+ kMachAnyTagged, IsFalseConstant(), |
IsUint32LessThanOrEqual( |
IsInt32Constant(FIRST_JS_RECEIVER_TYPE), |
IsLoadField(AccessBuilder::ForMapInstanceType(), |
@@ -315,6 +316,32 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) { |
} |
+TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiverWithReceiver) { |
+ Node* const input = Parameter(Type::Receiver()); |
+ Node* const context = Parameter(Type::Any()); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, |
+ context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsTrueConstant()); |
+} |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiverWithUndefined) { |
+ Node* const input = Parameter(Type::Undefined()); |
+ Node* const context = Parameter(Type::Any()); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, |
+ context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsFalseConstant()); |
+} |
+ |
+ |
// ----------------------------------------------------------------------------- |
// %_JSValueGetValue |