OLD | NEW |
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/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
6 #include "src/compiler/simplified-operator.h" | 6 #include "src/compiler/simplified-operator.h" |
7 #include "src/compiler/simplified-operator-reducer.h" | 7 #include "src/compiler/simplified-operator-reducer.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/types.h" | 9 #include "src/types.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 { | 501 { |
502 Node* const key = NumberConstant(-0.0); | 502 Node* const key = NumberConstant(-0.0); |
503 Node* const length = NumberConstant(1.0); | 503 Node* const length = NumberConstant(1.0); |
504 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), | 504 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), |
505 base, key, length, effect, control)); | 505 base, key, length, effect, control)); |
506 ASSERT_TRUE(r.Changed()); | 506 ASSERT_TRUE(r.Changed()); |
507 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, | 507 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, |
508 length, effect, control)); | 508 length, effect, control)); |
509 } | 509 } |
510 { | 510 { |
511 Node* const key = Int32Constant(0); | 511 Node* const key = NumberConstant(0); |
512 Node* const length = Int32Constant(1); | 512 Node* const length = NumberConstant(1); |
513 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), | 513 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), |
514 base, key, length, effect, control)); | 514 base, key, length, effect, control)); |
515 ASSERT_TRUE(r.Changed()); | 515 ASSERT_TRUE(r.Changed()); |
516 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, | 516 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, |
517 length, effect, control)); | 517 length, effect, control)); |
518 } | 518 } |
519 { | 519 { |
520 Node* const key = NumberConstant(42.2); | 520 Node* const key = NumberConstant(42.2); |
521 Node* const length = Int32Constant(128); | 521 Node* const length = NumberConstant(128); |
522 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), | 522 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), |
523 base, key, length, effect, control)); | 523 base, key, length, effect, control)); |
524 ASSERT_TRUE(r.Changed()); | 524 ASSERT_TRUE(r.Changed()); |
525 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, | 525 EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key, |
526 length, effect, control)); | 526 length, effect, control)); |
527 } | 527 } |
528 { | 528 { |
529 Node* const key = NumberConstant(39.2); | 529 Node* const key = NumberConstant(39.2); |
530 Node* const length = NumberConstant(32.0); | 530 Node* const length = NumberConstant(32.0); |
531 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), | 531 Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access), |
(...skipping 19 matching lines...) Expand all Loading... |
551 { | 551 { |
552 Node* const key = NumberConstant(-72.1); | 552 Node* const key = NumberConstant(-72.1); |
553 Node* const length = NumberConstant(0.0); | 553 Node* const length = NumberConstant(0.0); |
554 Reduction r = | 554 Reduction r = |
555 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, | 555 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, |
556 length, value, effect, control)); | 556 length, value, effect, control)); |
557 ASSERT_FALSE(r.Changed()); | 557 ASSERT_FALSE(r.Changed()); |
558 } | 558 } |
559 { | 559 { |
560 Node* const key = NumberConstant(-0.0); | 560 Node* const key = NumberConstant(-0.0); |
561 Node* const length = Int32Constant(999); | 561 Node* const length = NumberConstant(999); |
562 Reduction r = | 562 Reduction r = |
563 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, | 563 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, |
564 length, value, effect, control)); | 564 length, value, effect, control)); |
565 ASSERT_TRUE(r.Changed()); | 565 ASSERT_TRUE(r.Changed()); |
566 EXPECT_THAT(r.replacement(), | 566 EXPECT_THAT(r.replacement(), |
567 IsStoreElement(access_nocheck, base, key, length, value, effect, | 567 IsStoreElement(access_nocheck, base, key, length, value, effect, |
568 control)); | 568 control)); |
569 } | 569 } |
570 { | 570 { |
571 Node* const key = Int32Constant(0); | 571 Node* const key = NumberConstant(0); |
572 Node* const length = Int32Constant(1); | 572 Node* const length = NumberConstant(1); |
573 Reduction r = | 573 Reduction r = |
574 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, | 574 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, |
575 length, value, effect, control)); | 575 length, value, effect, control)); |
576 ASSERT_TRUE(r.Changed()); | 576 ASSERT_TRUE(r.Changed()); |
577 EXPECT_THAT(r.replacement(), | 577 EXPECT_THAT(r.replacement(), |
578 IsStoreElement(access_nocheck, base, key, length, value, effect, | 578 IsStoreElement(access_nocheck, base, key, length, value, effect, |
579 control)); | 579 control)); |
580 } | 580 } |
581 { | 581 { |
582 Node* const key = NumberConstant(42.2); | 582 Node* const key = NumberConstant(42.2); |
583 Node* const length = Int32Constant(128); | 583 Node* const length = NumberConstant(128); |
584 Reduction r = | 584 Reduction r = |
585 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, | 585 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, |
586 length, value, effect, control)); | 586 length, value, effect, control)); |
587 ASSERT_TRUE(r.Changed()); | 587 ASSERT_TRUE(r.Changed()); |
588 EXPECT_THAT(r.replacement(), | 588 EXPECT_THAT(r.replacement(), |
589 IsStoreElement(access_nocheck, base, key, length, value, effect, | 589 IsStoreElement(access_nocheck, base, key, length, value, effect, |
590 control)); | 590 control)); |
591 } | 591 } |
592 { | 592 { |
593 Node* const key = NumberConstant(39.2); | 593 Node* const key = NumberConstant(39.2); |
594 Node* const length = NumberConstant(32.0); | 594 Node* const length = NumberConstant(32.0); |
595 Reduction r = | 595 Reduction r = |
596 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, | 596 Reduce(graph()->NewNode(simplified()->StoreElement(access), base, key, |
597 length, value, effect, control)); | 597 length, value, effect, control)); |
598 ASSERT_FALSE(r.Changed()); | 598 ASSERT_FALSE(r.Changed()); |
599 } | 599 } |
600 } | 600 } |
601 | 601 |
602 } // namespace compiler | 602 } // namespace compiler |
603 } // namespace internal | 603 } // namespace internal |
604 } // namespace v8 | 604 } // namespace v8 |
OLD | NEW |