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

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

Issue 642033002: [turbofan] Eliminate redundant masking operations for word8/word16 stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/graph-unittest.h » ('j') | 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/compiler/change-lowering.h" 5 #include "src/compiler/change-lowering.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "test/unittests/compiler/compiler-test-utils.h" 10 #include "test/unittests/compiler/compiler-test-utils.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 Reduction reduction = Reduce(node); 153 Reduction reduction = Reduce(node);
154 ASSERT_TRUE(reduction.Changed()); 154 ASSERT_TRUE(reduction.Changed());
155 155
156 Node* finish = reduction.replacement(); 156 Node* finish = reduction.replacement();
157 Capture<Node*> heap_number; 157 Capture<Node*> heap_number;
158 EXPECT_THAT( 158 EXPECT_THAT(
159 finish, 159 finish,
160 IsFinish( 160 IsFinish(
161 AllOf(CaptureEq(&heap_number), 161 AllOf(CaptureEq(&heap_number),
162 IsAllocateHeapNumber(IsValueEffect(val), graph()->start())), 162 IsAllocateHeapNumber(IsValueEffect(val), graph()->start())),
163 IsStore(kMachFloat64, kNoWriteBarrier, CaptureEq(&heap_number), 163 IsStore(StoreRepresentation(kMachFloat64, kNoWriteBarrier),
164 CaptureEq(&heap_number),
164 IsInt32Constant(HeapNumberValueOffset()), val, 165 IsInt32Constant(HeapNumberValueOffset()), val,
165 CaptureEq(&heap_number), graph()->start()))); 166 CaptureEq(&heap_number), graph()->start())));
166 } 167 }
167 168
168 169
169 TARGET_TEST_P(ChangeLoweringCommonTest, StringAdd) { 170 TARGET_TEST_P(ChangeLoweringCommonTest, StringAdd) {
170 Node* node = 171 Node* node =
171 graph()->NewNode(simplified()->StringAdd(), Parameter(0), Parameter(1)); 172 graph()->NewNode(simplified()->StringAdd(), Parameter(0), Parameter(1));
172 Reduction reduction = Reduce(node); 173 Reduction reduction = Reduce(node);
173 EXPECT_FALSE(reduction.Changed()); 174 EXPECT_FALSE(reduction.Changed());
(...skipping 21 matching lines...) Expand all
195 Node* val = Parameter(0); 196 Node* val = Parameter(0);
196 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); 197 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val);
197 Reduction reduction = Reduce(node); 198 Reduction reduction = Reduce(node);
198 ASSERT_TRUE(reduction.Changed()); 199 ASSERT_TRUE(reduction.Changed());
199 200
200 Node* phi = reduction.replacement(); 201 Node* phi = reduction.replacement();
201 Capture<Node*> add, branch, heap_number, if_true; 202 Capture<Node*> add, branch, heap_number, if_true;
202 EXPECT_THAT( 203 EXPECT_THAT(
203 phi, 204 phi,
204 IsPhi(kMachAnyTagged, 205 IsPhi(kMachAnyTagged,
205 IsFinish( 206 IsFinish(AllOf(CaptureEq(&heap_number),
206 AllOf(CaptureEq(&heap_number), 207 IsAllocateHeapNumber(_, CaptureEq(&if_true))),
207 IsAllocateHeapNumber(_, CaptureEq(&if_true))), 208 IsStore(StoreRepresentation(kMachFloat64, kNoWriteBarrier),
208 IsStore(kMachFloat64, kNoWriteBarrier, CaptureEq(&heap_number), 209 CaptureEq(&heap_number),
209 IsInt32Constant(HeapNumberValueOffset()), 210 IsInt32Constant(HeapNumberValueOffset()),
210 IsChangeInt32ToFloat64(val), CaptureEq(&heap_number), 211 IsChangeInt32ToFloat64(val),
211 CaptureEq(&if_true))), 212 CaptureEq(&heap_number), CaptureEq(&if_true))),
212 IsProjection( 213 IsProjection(
213 0, AllOf(CaptureEq(&add), IsInt32AddWithOverflow(val, val))), 214 0, AllOf(CaptureEq(&add), IsInt32AddWithOverflow(val, val))),
214 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))), 215 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
215 IsIfFalse(AllOf(CaptureEq(&branch), 216 IsIfFalse(AllOf(CaptureEq(&branch),
216 IsBranch(IsProjection(1, CaptureEq(&add)), 217 IsBranch(IsProjection(1, CaptureEq(&add)),
217 graph()->start())))))); 218 graph()->start()))))));
218 } 219 }
219 220
220 221
221 TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) { 222 TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 Node* node = graph()->NewNode(simplified()->ChangeUint32ToTagged(), val); 302 Node* node = graph()->NewNode(simplified()->ChangeUint32ToTagged(), val);
302 Reduction reduction = Reduce(node); 303 Reduction reduction = Reduce(node);
303 ASSERT_TRUE(reduction.Changed()); 304 ASSERT_TRUE(reduction.Changed());
304 305
305 Node* phi = reduction.replacement(); 306 Node* phi = reduction.replacement();
306 Capture<Node*> branch, heap_number, if_false; 307 Capture<Node*> branch, heap_number, if_false;
307 EXPECT_THAT( 308 EXPECT_THAT(
308 phi, 309 phi,
309 IsPhi( 310 IsPhi(
310 kMachAnyTagged, IsWord32Shl(val, IsInt32Constant(SmiShiftAmount())), 311 kMachAnyTagged, IsWord32Shl(val, IsInt32Constant(SmiShiftAmount())),
311 IsFinish( 312 IsFinish(AllOf(CaptureEq(&heap_number),
312 AllOf(CaptureEq(&heap_number), 313 IsAllocateHeapNumber(_, CaptureEq(&if_false))),
313 IsAllocateHeapNumber(_, CaptureEq(&if_false))), 314 IsStore(StoreRepresentation(kMachFloat64, kNoWriteBarrier),
314 IsStore(kMachFloat64, kNoWriteBarrier, CaptureEq(&heap_number), 315 CaptureEq(&heap_number),
315 IsInt32Constant(HeapNumberValueOffset()), 316 IsInt32Constant(HeapNumberValueOffset()),
316 IsChangeUint32ToFloat64(val), CaptureEq(&heap_number), 317 IsChangeUint32ToFloat64(val),
317 CaptureEq(&if_false))), 318 CaptureEq(&heap_number), CaptureEq(&if_false))),
318 IsMerge( 319 IsMerge(
319 IsIfTrue(AllOf(CaptureEq(&branch), 320 IsIfTrue(AllOf(CaptureEq(&branch),
320 IsBranch(IsUint32LessThanOrEqual( 321 IsBranch(IsUint32LessThanOrEqual(
321 val, IsInt32Constant(SmiMaxValue())), 322 val, IsInt32Constant(SmiMaxValue())),
322 graph()->start()))), 323 graph()->start()))),
323 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 324 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
324 } 325 }
325 326
326 327
327 // ----------------------------------------------------------------------------- 328 // -----------------------------------------------------------------------------
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Reduction reduction = Reduce(node); 436 Reduction reduction = Reduce(node);
436 ASSERT_TRUE(reduction.Changed()); 437 ASSERT_TRUE(reduction.Changed());
437 438
438 Node* phi = reduction.replacement(); 439 Node* phi = reduction.replacement();
439 Capture<Node*> branch, heap_number, if_false; 440 Capture<Node*> branch, heap_number, if_false;
440 EXPECT_THAT( 441 EXPECT_THAT(
441 phi, 442 phi,
442 IsPhi( 443 IsPhi(
443 kMachAnyTagged, IsWord64Shl(IsChangeUint32ToUint64(val), 444 kMachAnyTagged, IsWord64Shl(IsChangeUint32ToUint64(val),
444 IsInt32Constant(SmiShiftAmount())), 445 IsInt32Constant(SmiShiftAmount())),
445 IsFinish( 446 IsFinish(AllOf(CaptureEq(&heap_number),
446 AllOf(CaptureEq(&heap_number), 447 IsAllocateHeapNumber(_, CaptureEq(&if_false))),
447 IsAllocateHeapNumber(_, CaptureEq(&if_false))), 448 IsStore(StoreRepresentation(kMachFloat64, kNoWriteBarrier),
448 IsStore(kMachFloat64, kNoWriteBarrier, CaptureEq(&heap_number), 449 CaptureEq(&heap_number),
449 IsInt32Constant(HeapNumberValueOffset()), 450 IsInt32Constant(HeapNumberValueOffset()),
450 IsChangeUint32ToFloat64(val), CaptureEq(&heap_number), 451 IsChangeUint32ToFloat64(val),
451 CaptureEq(&if_false))), 452 CaptureEq(&heap_number), CaptureEq(&if_false))),
452 IsMerge( 453 IsMerge(
453 IsIfTrue(AllOf(CaptureEq(&branch), 454 IsIfTrue(AllOf(CaptureEq(&branch),
454 IsBranch(IsUint32LessThanOrEqual( 455 IsBranch(IsUint32LessThanOrEqual(
455 val, IsInt32Constant(SmiMaxValue())), 456 val, IsInt32Constant(SmiMaxValue())),
456 graph()->start()))), 457 graph()->start()))),
457 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 458 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
458 } 459 }
459 460
460 } // namespace compiler 461 } // namespace compiler
461 } // namespace internal 462 } // namespace internal
462 } // namespace v8 463 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/graph-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698