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

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

Issue 795833006: Revert of [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 // -----------------------------------------------------------------------------
445 // JSShiftLeft 400 // JSShiftLeft
446 401
447 402
448 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) { 403 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
449 Node* const lhs = Parameter(Type::Signed32()); 404 Node* const lhs = Parameter(Type::Signed32());
450 Node* const context = UndefinedConstant(); 405 Node* const context = UndefinedConstant();
451 Node* const effect = graph()->start(); 406 Node* const effect = graph()->start();
452 Node* const control = graph()->start(); 407 Node* const control = graph()->start();
453 TRACED_FORRANGE(double, rhs, 0, 31) { 408 TRACED_FORRANGE(double, rhs, 0, 31) {
454 Reduction r = 409 Reduction r =
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 IsStoreElement( 799 IsStoreElement(
845 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), 800 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])),
846 key, value, effect, control)); 801 key, value, effect, control));
847 } 802 }
848 } 803 }
849 } 804 }
850 805
851 } // namespace compiler 806 } // namespace compiler
852 } // namespace internal 807 } // namespace internal
853 } // namespace v8 808 } // 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