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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 JSOperatorBuilder* javascript() { return &javascript_; } | 46 JSOperatorBuilder* javascript() { return &javascript_; } |
47 | 47 |
48 private: | 48 private: |
49 JSOperatorBuilder javascript_; | 49 JSOperatorBuilder javascript_; |
50 }; | 50 }; |
51 | 51 |
52 | 52 |
53 // ----------------------------------------------------------------------------- | 53 // ----------------------------------------------------------------------------- |
54 // %_DoubleLo | |
55 | |
56 | |
57 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) { | |
58 Node* const input = Parameter(0); | |
59 Node* const context = Parameter(1); | |
60 Node* const effect = graph()->start(); | |
61 Node* const control = graph()->start(); | |
62 Reduction const r = Reduce( | |
63 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1), | |
64 input, context, effect, control)); | |
65 ASSERT_TRUE(r.Changed()); | |
66 EXPECT_THAT(r.replacement(), | |
67 IsFloat64ExtractLowWord32(IsTypeGuard(Type::Number(), input, _))); | |
68 } | |
69 | |
70 | |
71 // ----------------------------------------------------------------------------- | |
72 // %_DoubleHi | |
73 | |
74 | |
75 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) { | |
76 Node* const input = Parameter(0); | |
77 Node* const context = Parameter(1); | |
78 Node* const effect = graph()->start(); | |
79 Node* const control = graph()->start(); | |
80 Reduction const r = Reduce( | |
81 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1), | |
82 input, context, effect, control)); | |
83 ASSERT_TRUE(r.Changed()); | |
84 EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32( | |
85 IsTypeGuard(Type::Number(), input, _))); | |
86 } | |
87 | |
88 | |
89 // ----------------------------------------------------------------------------- | |
90 // %_IsSmi | 54 // %_IsSmi |
91 | 55 |
92 | 56 |
93 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { | 57 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { |
94 Node* const input = Parameter(0); | 58 Node* const input = Parameter(0); |
95 Node* const context = Parameter(1); | 59 Node* const context = Parameter(1); |
96 Node* const effect = graph()->start(); | 60 Node* const effect = graph()->start(); |
97 Node* const control = graph()->start(); | 61 Node* const control = graph()->start(); |
98 Reduction const r = Reduce( | 62 Reduction const r = Reduce( |
99 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), | 63 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 CaptureEq(&if_false0)))))), | 216 CaptureEq(&if_false0)))))), |
253 IsMerge( | 217 IsMerge( |
254 IsIfTrue(AllOf(CaptureEq(&branch0), | 218 IsIfTrue(AllOf(CaptureEq(&branch0), |
255 IsBranch(IsObjectIsSmi(input), control))), | 219 IsBranch(IsObjectIsSmi(input), control))), |
256 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 220 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
257 } | 221 } |
258 | 222 |
259 } // namespace compiler | 223 } // namespace compiler |
260 } // namespace internal | 224 } // namespace internal |
261 } // namespace v8 | 225 } // namespace v8 |
OLD | NEW |