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

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

Issue 1514863002: [turbofan] Make FieldAccess::name usable in practice. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 5 years 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 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Node* value = Parameter(Type::TaggedPointer()); 175 Node* value = Parameter(Type::TaggedPointer());
176 Reduction r = 176 Reduction r =
177 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value)); 177 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value));
178 ASSERT_TRUE(r.Changed()); 178 ASSERT_TRUE(r.Changed());
179 EXPECT_THAT(r.replacement(), IsChangeFloat64ToUint32( 179 EXPECT_THAT(r.replacement(), IsChangeFloat64ToUint32(
180 IsLoadHeapNumber(value, graph()->start()))); 180 IsLoadHeapNumber(value, graph()->start())));
181 } 181 }
182 182
183 183
184 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) { 184 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
185 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, 185 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr,
186 Handle<Name>::null(), Type::Any(), 186 Type::Any(), MachineType::AnyTagged()};
187 MachineType::AnyTagged()};
188 Node* p0 = Parameter(Type::TaggedPointer()); 187 Node* p0 = Parameter(Type::TaggedPointer());
189 Node* p1 = Parameter(Type::TaggedSigned()); 188 Node* p1 = Parameter(Type::TaggedSigned());
190 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1, 189 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
191 graph()->start(), graph()->start()); 190 graph()->start(), graph()->start());
192 Reduction r = Reduce(store); 191 Reduction r = Reduce(store);
193 192
194 ASSERT_TRUE(r.Changed()); 193 ASSERT_TRUE(r.Changed());
195 EXPECT_THAT( 194 EXPECT_THAT(
196 r.replacement(), 195 r.replacement(),
197 IsStore(StoreRepresentation(MachineType::AnyTagged(), kNoWriteBarrier), 196 IsStore(StoreRepresentation(MachineType::AnyTagged(), kNoWriteBarrier),
198 p0, IsIntPtrConstant(access.offset - access.tag()), p1, 197 p0, IsIntPtrConstant(access.offset - access.tag()), p1,
199 graph()->start(), graph()->start())); 198 graph()->start(), graph()->start()));
200 } 199 }
201 200
202 201
203 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) { 202 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) {
204 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, 203 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr,
205 Handle<Name>::null(), Type::Any(), 204 Type::Any(), MachineType::AnyTagged()};
206 MachineType::AnyTagged()};
207 Node* p0 = Parameter(Type::TaggedPointer()); 205 Node* p0 = Parameter(Type::TaggedPointer());
208 Node* p1 = Parameter(Type::Tagged()); 206 Node* p1 = Parameter(Type::Tagged());
209 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1, 207 Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
210 graph()->start(), graph()->start()); 208 graph()->start(), graph()->start());
211 Reduction r = Reduce(store); 209 Reduction r = Reduce(store);
212 210
213 ASSERT_TRUE(r.Changed()); 211 ASSERT_TRUE(r.Changed());
214 EXPECT_THAT( 212 EXPECT_THAT(
215 r.replacement(), 213 r.replacement(),
216 IsStore(StoreRepresentation(MachineType::AnyTagged(), kFullWriteBarrier), 214 IsStore(StoreRepresentation(MachineType::AnyTagged(), kFullWriteBarrier),
217 p0, IsIntPtrConstant(access.offset - access.tag()), p1, 215 p0, IsIntPtrConstant(access.offset - access.tag()), p1,
218 graph()->start(), graph()->start())); 216 graph()->start(), graph()->start()));
219 } 217 }
220 218
221 219
222 TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) { 220 TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) {
223 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, 221 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr,
224 Handle<Name>::null(), Type::Any(), 222 Type::Any(), MachineType::AnyTagged()};
225 MachineType::AnyTagged()};
226 Node* p0 = Parameter(Type::TaggedPointer()); 223 Node* p0 = Parameter(Type::TaggedPointer());
227 Node* load = graph()->NewNode(simplified()->LoadField(access), p0, 224 Node* load = graph()->NewNode(simplified()->LoadField(access), p0,
228 graph()->start(), graph()->start()); 225 graph()->start(), graph()->start());
229 Reduction r = Reduce(load); 226 Reduction r = Reduce(load);
230 227
231 ASSERT_TRUE(r.Changed()); 228 ASSERT_TRUE(r.Changed());
232 Matcher<Node*> index_match = IsIntPtrConstant(access.offset - access.tag()); 229 Matcher<Node*> index_match = IsIntPtrConstant(access.offset - access.tag());
233 EXPECT_THAT(r.replacement(), 230 EXPECT_THAT(r.replacement(),
234 IsLoad(MachineType::AnyTagged(), p0, 231 IsLoad(MachineType::AnyTagged(), p0,
235 IsIntPtrConstant(access.offset - access.tag()), 232 IsIntPtrConstant(access.offset - access.tag()),
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 CaptureEq(&branch), 614 CaptureEq(&branch),
618 IsBranch(IsUint32LessThanOrEqual( 615 IsBranch(IsUint32LessThanOrEqual(
619 value, IsInt32Constant(Smi::kMaxValue)), 616 value, IsInt32Constant(Smi::kMaxValue)),
620 graph()->start()))), 617 graph()->start()))),
621 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 618 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
622 } 619 }
623 620
624 } // namespace compiler 621 } // namespace compiler
625 } // namespace internal 622 } // namespace internal
626 } // namespace v8 623 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | test/unittests/compiler/escape-analysis-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698