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

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

Issue 1908093002: [turbofan] Optimize tagged conversion based on type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 years, 8 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
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/change-lowering.h" 6 #include "src/compiler/change-lowering.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 118
119 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { 119 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) {
120 Node* value = Parameter(Type::Number()); 120 Node* value = Parameter(Type::Number());
121 Reduction r = 121 Reduction r =
122 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), value)); 122 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), value));
123 ASSERT_TRUE(r.Changed()); 123 ASSERT_TRUE(r.Changed());
124 EXPECT_THAT(r.replacement(), IsWordEqual(value, IsTrueConstant())); 124 EXPECT_THAT(r.replacement(), IsWordEqual(value, IsTrueConstant()));
125 } 125 }
126 126
127 127 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeInt31ToTagged) {
128 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeInt32ToTaggedWithSignedSmall) {
129 Node* value = Parameter(Type::SignedSmall()); 128 Node* value = Parameter(Type::SignedSmall());
130 Reduction r = 129 Reduction r =
131 Reduce(graph()->NewNode(simplified()->ChangeInt32ToTagged(), value)); 130 Reduce(graph()->NewNode(simplified()->ChangeInt31ToTagged(), value));
132 ASSERT_TRUE(r.Changed()); 131 ASSERT_TRUE(r.Changed());
133 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value)); 132 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value));
134 } 133 }
135 134
136
137 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeUint32ToTaggedWithUnsignedSmall) {
138 Node* value = Parameter(Type::UnsignedSmall());
139 Reduction r =
140 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), value));
141 ASSERT_TRUE(r.Changed());
142 EXPECT_THAT(r.replacement(), IsChangeUint32ToSmi(value));
143 }
144
145
146 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedSigned) { 135 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedSigned) {
147 Node* value = Parameter(Type::TaggedSigned()); 136 Node* value = Parameter(Type::TaggedSigned());
148 Reduction r = 137 Reduction r =
149 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value)); 138 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value));
150 ASSERT_TRUE(r.Changed()); 139 ASSERT_TRUE(r.Changed());
151 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value)); 140 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value));
152 } 141 }
153 142
154 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedNumber) { 143 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedNumber) {
155 Node* value = 144 Node* value =
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 CaptureEq(&branch), 609 CaptureEq(&branch),
621 IsBranch(IsUint32LessThanOrEqual( 610 IsBranch(IsUint32LessThanOrEqual(
622 value, IsInt32Constant(Smi::kMaxValue)), 611 value, IsInt32Constant(Smi::kMaxValue)),
623 graph()->start()))), 612 graph()->start()))),
624 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 613 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
625 } 614 }
626 615
627 } // namespace compiler 616 } // namespace compiler
628 } // namespace internal 617 } // namespace internal
629 } // namespace v8 618 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698