OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-intrinsic-lowering.h" | 8 #include "src/compiler/js-intrinsic-lowering.h" |
9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 Node* const control = graph()->start(); | 119 Node* const control = graph()->start(); |
120 Reduction const r = Reduce( | 120 Reduction const r = Reduce( |
121 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), | 121 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), |
122 input, context, effect, control)); | 122 input, context, effect, control)); |
123 ASSERT_TRUE(r.Changed()); | 123 ASSERT_TRUE(r.Changed()); |
124 EXPECT_THAT(r.replacement(), IsObjectIsSmi(input)); | 124 EXPECT_THAT(r.replacement(), IsObjectIsSmi(input)); |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 // ----------------------------------------------------------------------------- | 128 // ----------------------------------------------------------------------------- |
129 // %_IsNonNegativeSmi | |
130 | |
131 | |
132 TEST_F(JSIntrinsicLoweringTest, InlineIsNonNegativeSmi) { | |
133 Node* const input = Parameter(0); | |
134 Node* const context = Parameter(1); | |
135 Node* const effect = graph()->start(); | |
136 Node* const control = graph()->start(); | |
137 Reduction const r = Reduce(graph()->NewNode( | |
138 javascript()->CallRuntime(Runtime::kInlineIsNonNegativeSmi, 1), input, | |
139 context, effect, control)); | |
140 ASSERT_TRUE(r.Changed()); | |
141 EXPECT_THAT(r.replacement(), IsObjectIsNonNegativeSmi(input)); | |
142 } | |
143 | |
144 | |
145 // ----------------------------------------------------------------------------- | |
146 // %_IsArray | 129 // %_IsArray |
147 | 130 |
148 | 131 |
149 TEST_F(JSIntrinsicLoweringTest, InlineIsArray) { | 132 TEST_F(JSIntrinsicLoweringTest, InlineIsArray) { |
150 Node* const input = Parameter(0); | 133 Node* const input = Parameter(0); |
151 Node* const context = Parameter(1); | 134 Node* const context = Parameter(1); |
152 Node* const effect = graph()->start(); | 135 Node* const effect = graph()->start(); |
153 Node* const control = graph()->start(); | 136 Node* const control = graph()->start(); |
154 Reduction const r = Reduce( | 137 Reduction const r = Reduce( |
155 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsArray, 1), | 138 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsArray, 1), |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 CaptureEq(&if_false0)))))), | 455 CaptureEq(&if_false0)))))), |
473 IsMerge( | 456 IsMerge( |
474 IsIfTrue(AllOf(CaptureEq(&branch0), | 457 IsIfTrue(AllOf(CaptureEq(&branch0), |
475 IsBranch(IsObjectIsSmi(input), control))), | 458 IsBranch(IsObjectIsSmi(input), control))), |
476 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 459 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
477 } | 460 } |
478 | 461 |
479 } // namespace compiler | 462 } // namespace compiler |
480 } // namespace internal | 463 } // namespace internal |
481 } // namespace v8 | 464 } // namespace v8 |
OLD | NEW |