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

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

Issue 811653004: [turbofan] Improve typed lowering of JSBitwiseAnd. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « src/compiler/js-typed-lowering.cc ('k') | test/unittests/compiler/node-test-utils.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/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-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 Node* const lhs = Parameter(type); 390 Node* const lhs = Parameter(type);
391 Reduction r = Reduce(graph()->NewNode(javascript()->StrictEqual(), lhs, 391 Reduction r = Reduce(graph()->NewNode(javascript()->StrictEqual(), lhs,
392 the_hole, context, effect, control)); 392 the_hole, context, effect, control));
393 ASSERT_TRUE(r.Changed()); 393 ASSERT_TRUE(r.Changed());
394 EXPECT_THAT(r.replacement(), IsFalseConstant()); 394 EXPECT_THAT(r.replacement(), IsFalseConstant());
395 } 395 }
396 } 396 }
397 397
398 398
399 // ----------------------------------------------------------------------------- 399 // -----------------------------------------------------------------------------
400 // JSBitwiseAnd
401
402
403 TEST_F(JSTypedLoweringTest, JSBitwiseAndWithBitish) {
404 Node* const context = Parameter(Type::Any(), 2);
405 Node* const effect = graph()->start();
406 Node* const control = graph()->start();
407 Handle<Object> zero = factory()->NewNumber(0);
408 Handle<Object> one = factory()->NewNumber(1);
409 {
410 Node* const lhs = Parameter(Type::Range(one, one, zone()), 0);
411 Node* const rhs = Parameter(Type::Range(zero, one, zone()), 1);
412 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
413 context, effect, control));
414 ASSERT_TRUE(r.Changed());
415 EXPECT_EQ(rhs, r.replacement());
416 }
417 {
418 Node* const lhs = Parameter(Type::Range(one, one, zone()), 0);
419 Node* const rhs = Parameter(Type::Boolean(), 1);
420 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
421 context, effect, control));
422 ASSERT_TRUE(r.Changed());
423 EXPECT_THAT(r.replacement(), IsBooleanToNumber(rhs));
424 }
425 {
426 Node* const lhs = Parameter(Type::Range(zero, one, zone()), 0);
427 Node* const rhs = Parameter(Type::Range(one, one, zone()), 1);
428 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
429 context, effect, control));
430 ASSERT_TRUE(r.Changed());
431 EXPECT_EQ(lhs, r.replacement());
432 }
433 {
434 Node* const lhs = Parameter(Type::Boolean(), 0);
435 Node* const rhs = Parameter(Type::Range(one, one, zone()), 1);
436 Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
437 context, effect, control));
438 ASSERT_TRUE(r.Changed());
439 EXPECT_THAT(r.replacement(), IsBooleanToNumber(lhs));
440 }
441 }
442
443
444 // -----------------------------------------------------------------------------
400 // JSShiftLeft 445 // JSShiftLeft
401 446
402 447
403 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) { 448 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
404 Node* const lhs = Parameter(Type::Signed32()); 449 Node* const lhs = Parameter(Type::Signed32());
405 Node* const context = UndefinedConstant(); 450 Node* const context = UndefinedConstant();
406 Node* const effect = graph()->start(); 451 Node* const effect = graph()->start();
407 Node* const control = graph()->start(); 452 Node* const control = graph()->start();
408 TRACED_FORRANGE(double, rhs, 0, 31) { 453 TRACED_FORRANGE(double, rhs, 0, 31) {
409 Reduction r = 454 Reduction r =
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 IsStoreElement( 844 IsStoreElement(
800 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), 845 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])),
801 key, value, effect, control)); 846 key, value, effect, control));
802 } 847 }
803 } 848 }
804 } 849 }
805 850
806 } // namespace compiler 851 } // namespace compiler
807 } // namespace internal 852 } // namespace internal
808 } // namespace v8 853 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698