summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2016-03-01 08:58:05 -0800
committerAli Sheikh <ofrobots@lemonhope.roam.corp.google.com>2016-03-03 20:35:20 -0800
commit069e02ab47656b3efd1b6829c65856b2e1c2d1db (patch)
treeeb643e0a2e88fd64bb9fc927423458d2ae96c2db /deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
parent8938355398c79f583a468284b768652d12ba9bc9 (diff)
downloadnode-new-069e02ab47656b3efd1b6829c65856b2e1c2d1db.tar.gz
deps: upgrade to V8 4.9.385.18
Pick up the current branch head for V8 4.9 https://github.com/v8/v8/commit/1ecba0f PR-URL: https://github.com/nodejs/node/pull/4722 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc')
-rw-r--r--deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc116
1 files changed, 80 insertions, 36 deletions
diff --git a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
index a22f660c21..f38f8eaac7 100644
--- a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
+++ b/deps/v8/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,15 +24,16 @@ 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:
Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
MachineOperatorBuilder::kNoFlags) {
- MachineOperatorBuilder machine(zone(), kMachPtr, flags);
+ MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
+ flags);
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
@@ -147,7 +149,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsArray) {
EXPECT_THAT(
phi,
IsPhi(
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
+ MachineRepresentation::kTagged, IsFalseConstant(),
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
IsLoadField(AccessBuilder::ForMap(), input,
effect, CaptureEq(&if_false)),
@@ -178,7 +180,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsDate) {
EXPECT_THAT(
phi,
IsPhi(
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
+ MachineRepresentation::kTagged, IsFalseConstant(),
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
IsLoadField(AccessBuilder::ForMap(), input,
effect, CaptureEq(&if_false)),
@@ -209,7 +211,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) {
EXPECT_THAT(
phi,
IsPhi(
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
+ MachineRepresentation::kTagged, IsFalseConstant(),
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
IsLoadField(AccessBuilder::ForMap(), input,
effect, CaptureEq(&if_false)),
@@ -226,8 +228,8 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) {
TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) {
- Node* const input = Parameter(0);
- Node* const context = Parameter(1);
+ 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(
@@ -240,12 +242,13 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) {
EXPECT_THAT(
phi,
IsPhi(
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
- IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
- IsLoadField(AccessBuilder::ForMap(), input,
- effect, CaptureEq(&if_false)),
- effect, _),
- IsInt32Constant(JS_FUNCTION_TYPE)),
+ MachineRepresentation::kTagged, IsFalseConstant(),
+ IsUint32LessThanOrEqual(
+ IsInt32Constant(FIRST_FUNCTION_TYPE),
+ IsLoadField(AccessBuilder::ForMapInstanceType(),
+ IsLoadField(AccessBuilder::ForMap(), input, effect,
+ CaptureEq(&if_false)),
+ effect, _)),
IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
IsBranch(IsObjectIsSmi(input), control))),
AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
@@ -271,7 +274,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) {
EXPECT_THAT(
phi,
IsPhi(
- static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
+ MachineRepresentation::kTagged, IsFalseConstant(),
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
IsLoadField(AccessBuilder::ForMap(), input,
effect, CaptureEq(&if_false)),
@@ -284,6 +287,64 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) {
// -----------------------------------------------------------------------------
+// %_IsJSReceiver
+
+
+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(
+ javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+
+ Node* phi = r.replacement();
+ Capture<Node *> branch, if_false;
+ EXPECT_THAT(
+ phi,
+ IsPhi(
+ MachineRepresentation::kTagged, IsFalseConstant(),
+ IsUint32LessThanOrEqual(
+ IsInt32Constant(FIRST_JS_RECEIVER_TYPE),
+ IsLoadField(AccessBuilder::ForMapInstanceType(),
+ IsLoadField(AccessBuilder::ForMap(), input, effect,
+ CaptureEq(&if_false)),
+ effect, _)),
+ IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
+ IsBranch(IsObjectIsSmi(input), control))),
+ AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
+}
+
+
+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
@@ -337,24 +398,6 @@ TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) {
// -----------------------------------------------------------------------------
-// %_StringGetLength
-
-
-TEST_F(JSIntrinsicLoweringTest, InlineStringGetLength) {
- Node* const input = Parameter(0);
- Node* const context = Parameter(1);
- Node* const effect = graph()->start();
- Node* const control = graph()->start();
- Reduction const r = Reduce(graph()->NewNode(
- javascript()->CallRuntime(Runtime::kInlineStringGetLength, 1), input,
- context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(),
- input, effect, control));
-}
-
-
-// -----------------------------------------------------------------------------
// %_MathClz32
@@ -390,9 +433,10 @@ TEST_F(JSIntrinsicLoweringTest, InlineValueOf) {
EXPECT_THAT(
phi,
IsPhi(
- kMachAnyTagged, input,
- IsPhi(kMachAnyTagged, IsLoadField(AccessBuilder::ForValue(), input,
- effect, CaptureEq(&if_true1)),
+ MachineRepresentation::kTagged, input,
+ IsPhi(MachineRepresentation::kTagged,
+ IsLoadField(AccessBuilder::ForValue(), input, effect,
+ CaptureEq(&if_true1)),
input,
IsMerge(
AllOf(CaptureEq(&if_true1), IsIfTrue(CaptureEq(&branch1))),