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

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

Issue 840953003: [turbofan] Correctify representation changes to bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: std::isnan 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
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-inl.h" 7 #include "src/compiler/node-properties-inl.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.h" 10 #include "src/conversions.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Node* param0 = Parameter(0); 291 Node* param0 = Parameter(0);
292 Reduction reduction = Reduce(graph()->NewNode( 292 Reduction reduction = Reduce(graph()->NewNode(
293 simplified()->ChangeBoolToBit(), 293 simplified()->ChangeBoolToBit(),
294 graph()->NewNode(simplified()->ChangeBitToBool(), param0))); 294 graph()->NewNode(simplified()->ChangeBitToBool(), param0)));
295 ASSERT_TRUE(reduction.Changed()); 295 ASSERT_TRUE(reduction.Changed());
296 EXPECT_EQ(param0, reduction.replacement()); 296 EXPECT_EQ(param0, reduction.replacement());
297 } 297 }
298 298
299 299
300 // ----------------------------------------------------------------------------- 300 // -----------------------------------------------------------------------------
301 // ChangeWord32ToBit
302
303
304 TEST_F(SimplifiedOperatorReducerTest, ChangeWord32ToBitWithBitType) {
305 Handle<Object> zero = factory()->NewNumber(0);
306 Handle<Object> one = factory()->NewNumber(1);
307 Type* const kBitTypes[] = {
308 Type::Constant(zero, zone()), Type::Constant(one, zone()),
309 Type::Range(zero, zero, zone()), Type::Range(one, one, zone()),
310 Type::Range(zero, one, zone())};
311 TRACED_FOREACH(Type*, type, kBitTypes) {
312 Node* param0 = Parameter(type, 0);
313 Reduction reduction =
314 Reduce(graph()->NewNode(simplified()->ChangeWord32ToBit(), param0));
315 ASSERT_TRUE(reduction.Changed());
316 EXPECT_EQ(param0, reduction.replacement());
317 }
318 }
319
320
321 // -----------------------------------------------------------------------------
301 // ChangeFloat64ToTagged 322 // ChangeFloat64ToTagged
302 323
303 324
304 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) { 325 TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) {
305 TRACED_FOREACH(double, n, kFloat64Values) { 326 TRACED_FOREACH(double, n, kFloat64Values) {
306 Reduction reduction = Reduce(graph()->NewNode( 327 Reduction reduction = Reduce(graph()->NewNode(
307 simplified()->ChangeFloat64ToTagged(), Float64Constant(n))); 328 simplified()->ChangeFloat64ToTagged(), Float64Constant(n)));
308 ASSERT_TRUE(reduction.Changed()); 329 ASSERT_TRUE(reduction.Changed());
309 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(n))); 330 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(n)));
310 } 331 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), 532 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(),
512 Int32Constant(bit_cast<int32_t>(n)))); 533 Int32Constant(bit_cast<int32_t>(n))));
513 ASSERT_TRUE(reduction.Changed()); 534 ASSERT_TRUE(reduction.Changed());
514 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(FastUI2D(n)))); 535 EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(FastUI2D(n))));
515 } 536 }
516 } 537 }
517 538
518 } // namespace compiler 539 } // namespace compiler
519 } // namespace internal 540 } // namespace internal
520 } // namespace v8 541 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/change-lowering-unittest.cc ('k') | test/unittests/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698