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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/change-lowering.h" | 8 #include "src/compiler/change-lowering.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 } | 654 } |
655 | 655 |
656 | 656 |
657 TEST(RunAccessTests_Smi) { | 657 TEST(RunAccessTests_Smi) { |
658 Smi* data[] = {Smi::FromInt(-1), Smi::FromInt(-9), | 658 Smi* data[] = {Smi::FromInt(-1), Smi::FromInt(-9), |
659 Smi::FromInt(0), Smi::FromInt(666), | 659 Smi::FromInt(0), Smi::FromInt(666), |
660 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; | 660 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; |
661 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); | 661 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); |
662 } | 662 } |
663 | 663 |
664 | 664 #if V8_TURBOFAN_TARGET |
665 TEST(RunAllocate) { | 665 TEST(RunAllocate) { |
666 PretenureFlag flag[] = {NOT_TENURED, TENURED}; | 666 PretenureFlag flag[] = {NOT_TENURED, TENURED}; |
667 | 667 |
668 for (size_t i = 0; i < arraysize(flag); i++) { | 668 for (size_t i = 0; i < arraysize(flag); i++) { |
669 SimplifiedLoweringTester<HeapObject*> t; | 669 SimplifiedLoweringTester<HeapObject*> t; |
670 FieldAccess access = AccessBuilder::ForMap(); | 670 FieldAccess access = AccessBuilder::ForMap(); |
671 Node* size = t.jsgraph.Constant(HeapNumber::kSize); | 671 Node* size = t.jsgraph.Constant(HeapNumber::kSize); |
672 Node* alloc = t.NewNode(t.simplified()->Allocate(flag[i]), size); | 672 Node* alloc = t.NewNode(t.simplified()->Allocate(flag[i]), size); |
673 Node* map = t.jsgraph.Constant(t.factory()->heap_number_map()); | 673 Node* map = t.jsgraph.Constant(t.factory()->heap_number_map()); |
674 t.StoreField(access, alloc, map); | 674 t.StoreField(access, alloc, map); |
675 t.Return(alloc); | 675 t.Return(alloc); |
676 | 676 |
677 t.LowerAllNodes(); | 677 t.LowerAllNodes(); |
678 t.GenerateCode(); | 678 t.GenerateCode(); |
679 | 679 |
680 if (Pipeline::SupportedTarget()) { | 680 if (Pipeline::SupportedTarget()) { |
681 HeapObject* result = t.CallWithPotentialGC<HeapObject>(); | 681 HeapObject* result = t.CallWithPotentialGC<HeapObject>(); |
682 CHECK(t.heap()->new_space()->Contains(result) || flag[i] == TENURED); | 682 CHECK(t.heap()->new_space()->Contains(result) || flag[i] == TENURED); |
683 CHECK(t.heap()->old_space()->Contains(result) || flag[i] == NOT_TENURED); | 683 CHECK(t.heap()->old_space()->Contains(result) || flag[i] == NOT_TENURED); |
684 CHECK(result->IsHeapNumber()); | 684 CHECK(result->IsHeapNumber()); |
685 } | 685 } |
686 } | 686 } |
687 } | 687 } |
688 | 688 #endif |
689 | 689 |
690 // Fills in most of the nodes of the graph in order to make tests shorter. | 690 // Fills in most of the nodes of the graph in order to make tests shorter. |
691 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { | 691 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { |
692 public: | 692 public: |
693 Typer typer; | 693 Typer typer; |
694 JSOperatorBuilder javascript; | 694 JSOperatorBuilder javascript; |
695 JSGraph jsgraph; | 695 JSGraph jsgraph; |
696 Node* p0; | 696 Node* p0; |
697 Node* p1; | 697 Node* p1; |
698 Node* p2; | 698 Node* p2; |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); | 2090 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); |
2091 NodeProperties::SetBounds(phi, phi_bounds); | 2091 NodeProperties::SetBounds(phi, phi_bounds); |
2092 | 2092 |
2093 Node* use = t.Use(phi, d.use); | 2093 Node* use = t.Use(phi, d.use); |
2094 t.Return(use); | 2094 t.Return(use); |
2095 t.Lower(); | 2095 t.Lower(); |
2096 | 2096 |
2097 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); | 2097 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); |
2098 } | 2098 } |
2099 } | 2099 } |
OLD | NEW |