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

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

Issue 2222993003: [turbofan] Consume number type hints for strict equality. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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') | no next file » | 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 385
386 // ----------------------------------------------------------------------------- 386 // -----------------------------------------------------------------------------
387 // JSStrictEqual 387 // JSStrictEqual
388 388
389 389
390 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { 390 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) {
391 Node* const the_hole = HeapConstant(factory()->the_hole_value()); 391 Node* const the_hole = HeapConstant(factory()->the_hole_value());
392 Node* const context = UndefinedConstant(); 392 Node* const context = UndefinedConstant();
393 Node* const effect = graph()->start();
394 Node* const control = graph()->start();
393 TRACED_FOREACH(Type*, type, kJSTypes) { 395 TRACED_FOREACH(Type*, type, kJSTypes) {
394 Node* const lhs = Parameter(type); 396 Node* const lhs = Parameter(type);
395 Reduction r = Reduce(graph()->NewNode( 397 Reduction r = Reduce(graph()->NewNode(
396 javascript()->StrictEqual(CompareOperationHints::Any()), lhs, the_hole, 398 javascript()->StrictEqual(CompareOperationHints::Any()), lhs, the_hole,
397 context)); 399 context, effect, control));
398 ASSERT_TRUE(r.Changed()); 400 ASSERT_TRUE(r.Changed());
399 EXPECT_THAT(r.replacement(), IsFalseConstant()); 401 EXPECT_THAT(r.replacement(), IsFalseConstant());
400 } 402 }
401 } 403 }
402 404
403 405
404 TEST_F(JSTypedLoweringTest, JSStrictEqualWithUnique) { 406 TEST_F(JSTypedLoweringTest, JSStrictEqualWithUnique) {
405 Node* const lhs = Parameter(Type::Unique(), 0); 407 Node* const lhs = Parameter(Type::Unique(), 0);
406 Node* const rhs = Parameter(Type::Unique(), 1); 408 Node* const rhs = Parameter(Type::Unique(), 1);
407 Node* const context = Parameter(Type::Any(), 2); 409 Node* const context = Parameter(Type::Any(), 2);
410 Node* const effect = graph()->start();
411 Node* const control = graph()->start();
408 Reduction r = Reduce( 412 Reduction r = Reduce(
409 graph()->NewNode(javascript()->StrictEqual(CompareOperationHints::Any()), 413 graph()->NewNode(javascript()->StrictEqual(CompareOperationHints::Any()),
410 lhs, rhs, context)); 414 lhs, rhs, context, effect, control));
411 ASSERT_TRUE(r.Changed()); 415 ASSERT_TRUE(r.Changed());
412 EXPECT_THAT(r.replacement(), IsReferenceEqual(Type::Unique(), lhs, rhs)); 416 EXPECT_THAT(r.replacement(), IsReferenceEqual(Type::Unique(), lhs, rhs));
413 } 417 }
414 418
415 419
416 // ----------------------------------------------------------------------------- 420 // -----------------------------------------------------------------------------
417 // JSShiftLeft 421 // JSShiftLeft
418 422
419 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) { 423 TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
420 BinaryOperationHints const hints = BinaryOperationHints::Any(); 424 BinaryOperationHints const hints = BinaryOperationHints::Any();
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 EmptyFrameState(), effect, control)); 1262 EmptyFrameState(), effect, control));
1259 ASSERT_TRUE(r.Changed()); 1263 ASSERT_TRUE(r.Changed());
1260 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( 1264 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
1261 NumberOperationHint::kNumberOrOddball, lhs, 1265 NumberOperationHint::kNumberOrOddball, lhs,
1262 rhs, effect, control)); 1266 rhs, effect, control));
1263 } 1267 }
1264 1268
1265 } // namespace compiler 1269 } // namespace compiler
1266 } // namespace internal 1270 } // namespace internal
1267 } // namespace v8 1271 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698