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

Side by Side Diff: test/cctest/compiler/test-branch-combine.cc

Issue 1685183003: [turbofan] Fix a bug in the RawMachineAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 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 "test/cctest/cctest.h" 5 #include "test/cctest/cctest.h"
6 #include "test/cctest/compiler/codegen-tester.h" 6 #include "test/cctest/compiler/codegen-tester.h"
7 #include "test/cctest/compiler/value-helper.h" 7 #include "test/cctest/compiler/value-helper.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 : eq_constant) 450 : eq_constant)
451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant 451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant
452 : ne_constant); 452 : ne_constant);
453 CHECK_EQ(expected, m.Call()); 453 CHECK_EQ(expected, m.Call());
454 } 454 }
455 } 455 }
456 } 456 }
457 } 457 }
458 } 458 }
459 459
460 #if V8_TARGET_ARCH_64_BIT
461 TEST(BranchCombineWord64EqualZeroPhi) {
462 // Test combining a branch with a Word64Equal between a phi node and 0.
463 RawMachineAssemblerTester<int32_t> m(MachineType::AnyTagged());
464 uintptr_t something = 0x100000000;
465 uintptr_t null = 0;
466
467 Node* p0 = m.Parameter(0);
468
469 RawMachineLabel is_null, is_not_null, merge;
470 m.Branch(m.IntPtrEqual(p0, m.IntPtrConstant(0)), &is_null, &is_not_null);
471 m.Bind(&is_not_null);
472 Node* val = m.Load(MachineType::AnyTagged(), p0);
473 m.Goto(&merge);
474 m.Bind(&is_null);
475 Node* fail_val = m.IntPtrConstant(0);
476 m.Goto(&merge);
477
478 m.Bind(&merge);
479 Node* phi = m.Phi(MachineRepresentation::kTagged, val, fail_val);
480
481 RawMachineLabel pass, fail;
482 m.Branch(m.IntPtrEqual(phi, m.IntPtrConstant(0)), &pass, &fail);
483 m.Bind(&pass);
484 m.Return(m.Int32Constant(0));
485 m.Bind(&fail);
486 m.Return(m.Int32Constant(1));
487
488 CHECK_EQ(1, m.Call(reinterpret_cast<v8::internal::Object*>(&something)));
489 CHECK_EQ(0, m.Call(reinterpret_cast<v8::internal::Object*>(&null)));
490 CHECK_EQ(0, m.Call(static_cast<v8::internal::Object*>(nullptr)));
491 }
492
493 #endif
494
460 } // namespace compiler 495 } // namespace compiler
461 } // namespace internal 496 } // namespace internal
462 } // namespace v8 497 } // namespace v8
OLDNEW
« src/compiler/x64/instruction-selector-x64.cc ('K') | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698