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

Side by Side Diff: test/unittests/compiler/simplified-operator-reducer-unittest.cc

Issue 1919513002: [turbofan] Introduce TruncateTaggedToWord32 simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 "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/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/simplified-operator-reducer.h" 9 #include "src/compiler/simplified-operator-reducer.h"
10 #include "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 TEST_F(SimplifiedOperatorReducerTest, ChangeUint32ToTagged) { 394 TEST_F(SimplifiedOperatorReducerTest, ChangeUint32ToTagged) {
395 TRACED_FOREACH(uint32_t, n, kUint32Values) { 395 TRACED_FOREACH(uint32_t, n, kUint32Values) {
396 Reduction reduction = 396 Reduction reduction =
397 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), 397 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(),
398 Int32Constant(bit_cast<int32_t>(n)))); 398 Int32Constant(bit_cast<int32_t>(n))));
399 ASSERT_TRUE(reduction.Changed()); 399 ASSERT_TRUE(reduction.Changed());
400 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(FastUI2D(n)))); 400 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(FastUI2D(n))));
401 } 401 }
402 } 402 }
403 403
404 // -----------------------------------------------------------------------------
405 // TruncateTaggedToWord32
406
407 TEST_F(SimplifiedOperatorReducerTest,
408 TruncateTaggedToWord3WithChangeFloat64ToTagged) {
409 Node* param0 = Parameter(0);
410 Reduction reduction = Reduce(graph()->NewNode(
411 simplified()->TruncateTaggedToWord32(),
412 graph()->NewNode(simplified()->ChangeFloat64ToTagged(), param0)));
413 ASSERT_TRUE(reduction.Changed());
414 EXPECT_THAT(reduction.replacement(), IsTruncateFloat64ToWord32(param0));
415 }
416
417 TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) {
418 TRACED_FOREACH(double, n, kFloat64Values) {
419 Reduction reduction = Reduce(graph()->NewNode(
420 simplified()->TruncateTaggedToWord32(), NumberConstant(n)));
421 ASSERT_TRUE(reduction.Changed());
422 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n)));
423 }
424 }
425
404 } // namespace compiler 426 } // namespace compiler
405 } // namespace internal 427 } // namespace internal
406 } // namespace v8 428 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698