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

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

Issue 1154303002: [turbofan] Optimize strict equality of unique values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 430
431 431
432 // ----------------------------------------------------------------------------- 432 // -----------------------------------------------------------------------------
433 // JSStrictEqual 433 // JSStrictEqual
434 434
435 435
436 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { 436 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) {
437 Node* const the_hole = HeapConstant(factory()->the_hole_value()); 437 Node* const the_hole = HeapConstant(factory()->the_hole_value());
438 Node* const context = UndefinedConstant(); 438 Node* const context = UndefinedConstant();
439 Node* const effect = graph()->start();
440 Node* const control = graph()->start();
441 TRACED_FOREACH(Type*, type, kJSTypes) { 439 TRACED_FOREACH(Type*, type, kJSTypes) {
442 Node* const lhs = Parameter(type); 440 Node* const lhs = Parameter(type);
443 Reduction r = Reduce(graph()->NewNode(javascript()->StrictEqual(), lhs, 441 Reduction r = Reduce(
444 the_hole, context, effect, control)); 442 graph()->NewNode(javascript()->StrictEqual(), lhs, the_hole, context));
445 ASSERT_TRUE(r.Changed()); 443 ASSERT_TRUE(r.Changed());
446 EXPECT_THAT(r.replacement(), IsFalseConstant()); 444 EXPECT_THAT(r.replacement(), IsFalseConstant());
447 } 445 }
448 } 446 }
449 447
450 448
449 TEST_F(JSTypedLoweringTest, JSStrictEqualWithUnique) {
450 Node* const lhs = Parameter(Type::Unique(), 0);
451 Node* const rhs = Parameter(Type::Unique(), 1);
452 Node* const context = Parameter(Type::Any(), 2);
453 Reduction r =
454 Reduce(graph()->NewNode(javascript()->StrictEqual(), lhs, rhs, context));
455 ASSERT_TRUE(r.Changed());
456 EXPECT_THAT(r.replacement(), IsReferenceEqual(Type::Unique(), lhs, rhs));
457 }
458
459
451 // ----------------------------------------------------------------------------- 460 // -----------------------------------------------------------------------------
452 // JSShiftLeft 461 // JSShiftLeft
453 462
454 463
455 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) { 464 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
456 Node* const lhs = Parameter(Type::Signed32()); 465 Node* const lhs = Parameter(Type::Signed32());
457 Node* const context = UndefinedConstant(); 466 Node* const context = UndefinedConstant();
458 Node* const effect = graph()->start(); 467 Node* const effect = graph()->start();
459 Node* const control = graph()->start(); 468 Node* const control = graph()->start();
460 TRACED_FORRANGE(double, rhs, 0, 31) { 469 TRACED_FORRANGE(double, rhs, 0, 31) {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 EXPECT_THAT(r.replacement(), 995 EXPECT_THAT(r.replacement(),
987 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( 996 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor(
988 Context::MIN_CONTEXT_SLOTS)), 997 Context::MIN_CONTEXT_SLOTS)),
989 effect, control), 998 effect, control),
990 _)); 999 _));
991 } 1000 }
992 1001
993 } // namespace compiler 1002 } // namespace compiler
994 } // namespace internal 1003 } // namespace internal
995 } // namespace v8 1004 } // 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