Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: test/unittests/compiler/js-intrinsic-lowering-unittest.cc

Issue 974313002: [turbofan] Support for %_DoubleHi, %_DoubleLo and %_ConstructDouble. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Svens comment. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/js-intrinsic-lowering.h" 7 #include "src/compiler/js-intrinsic-lowering.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "test/unittests/compiler/graph-unittest.h" 9 #include "test/unittests/compiler/graph-unittest.h"
10 #include "test/unittests/compiler/node-test-utils.h" 10 #include "test/unittests/compiler/node-test-utils.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 JSOperatorBuilder* javascript() { return &javascript_; } 37 JSOperatorBuilder* javascript() { return &javascript_; }
38 38
39 private: 39 private:
40 JSOperatorBuilder javascript_; 40 JSOperatorBuilder javascript_;
41 }; 41 };
42 42
43 43
44 // ----------------------------------------------------------------------------- 44 // -----------------------------------------------------------------------------
45 // %_ConstructDouble
46
47
48 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) {
49 Node* const input0 = Parameter(0);
50 Node* const input1 = Parameter(1);
51 Node* const context = Parameter(2);
52 Node* const effect = graph()->start();
53 Node* const control = graph()->start();
54 Reduction const r = Reduce(graph()->NewNode(
55 javascript()->CallRuntime(Runtime::kInlineOptimizedConstructDouble, 2),
56 input0, input1, context, effect, control));
57 ASSERT_TRUE(r.Changed());
58 EXPECT_THAT(r.replacement(), IsFloat64InsertHighWord32(
59 IsFloat64InsertLowWord32(
60 IsNumberConstant(BitEq(0.0)), input1),
61 input0));
62 }
63
64
65 // -----------------------------------------------------------------------------
66 // %_DoubleLo
67
68
69 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) {
70 Node* const input = Parameter(0);
71 Node* const context = Parameter(1);
72 Node* const effect = graph()->start();
73 Node* const control = graph()->start();
74 Reduction const r = Reduce(graph()->NewNode(
75 javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleLo, 1), input,
76 context, effect, control));
77 ASSERT_TRUE(r.Changed());
78 EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input));
79 }
80
81
82 // -----------------------------------------------------------------------------
83 // %_DoubleHi
84
85
86 TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) {
87 Node* const input = Parameter(0);
88 Node* const context = Parameter(1);
89 Node* const effect = graph()->start();
90 Node* const control = graph()->start();
91 Reduction const r = Reduce(graph()->NewNode(
92 javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleHi, 1), input,
93 context, effect, control));
94 ASSERT_TRUE(r.Changed());
95 EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input));
96 }
97
98
99 // -----------------------------------------------------------------------------
45 // %_IsSmi 100 // %_IsSmi
46 101
47 102
48 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) { 103 TEST_F(JSIntrinsicLoweringTest, InlineIsSmi) {
49 Node* const input = Parameter(0); 104 Node* const input = Parameter(0);
50 Node* const context = Parameter(1); 105 Node* const context = Parameter(1);
51 Node* const effect = graph()->start(); 106 Node* const effect = graph()->start();
52 Node* const control = graph()->start(); 107 Node* const control = graph()->start();
53 Reduction const r = Reduce( 108 Reduction const r = Reduce(
54 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), 109 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 CaptureEq(&if_false0)))))), 261 CaptureEq(&if_false0)))))),
207 IsMerge( 262 IsMerge(
208 IsIfTrue(AllOf(CaptureEq(&branch0), 263 IsIfTrue(AllOf(CaptureEq(&branch0),
209 IsBranch(IsObjectIsSmi(input), control))), 264 IsBranch(IsObjectIsSmi(input), control))),
210 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); 265 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0))))));
211 } 266 }
212 267
213 } // namespace compiler 268 } // namespace compiler
214 } // namespace internal 269 } // namespace internal
215 } // namespace v8 270 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/asm/double-lo.js ('k') | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698