OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "test/cctest/test-api.h" | 8 #include "test/cctest/test-api.h" |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 CHECK(map->is_deprecated()); | 600 CHECK(map->is_deprecated()); |
601 CHECK(expectations.Check(*detach_point_map, | 601 CHECK(expectations.Check(*detach_point_map, |
602 detach_point_map->NumberOfOwnDescriptors())); | 602 detach_point_map->NumberOfOwnDescriptors())); |
603 } | 603 } |
604 | 604 |
605 // Create new maps by generalizing representation of propX field. | 605 // Create new maps by generalizing representation of propX field. |
606 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); | 606 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); |
607 CompilationDependencies dependencies(isolate, &zone); | 607 CompilationDependencies dependencies(isolate, &zone); |
608 CHECK(!dependencies.HasAborted()); | 608 CHECK(!dependencies.HasAborted()); |
609 | 609 |
610 dependencies.AssumeFieldType(field_owner); | 610 dependencies.AssumeFieldOwner(field_owner); |
611 | 611 |
612 Handle<Map> new_map = | 612 Handle<Map> new_map = |
613 Map::ReconfigureProperty(map, property_index, kData, NONE, | 613 Map::ReconfigureProperty(map, property_index, kData, NONE, |
614 to_representation, to_type, FORCE_FIELD); | 614 to_representation, to_type, FORCE_FIELD); |
615 | 615 |
616 expectations.SetDataField(property_index, expected_representation, | 616 expectations.SetDataField(property_index, expected_representation, |
617 expected_type); | 617 expected_type); |
618 | 618 |
619 CHECK(!new_map->is_deprecated()); | 619 CHECK(!new_map->is_deprecated()); |
620 CHECK(expectations.Check(*new_map)); | 620 CHECK(expectations.Check(*new_map)); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 978 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
979 } | 979 } |
980 CHECK(!map2->is_deprecated()); | 980 CHECK(!map2->is_deprecated()); |
981 CHECK(map2->is_stable()); | 981 CHECK(map2->is_stable()); |
982 CHECK(expectations2.Check(*map2)); | 982 CHECK(expectations2.Check(*map2)); |
983 | 983 |
984 Zone zone(isolate->allocator()); | 984 Zone zone(isolate->allocator()); |
985 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 985 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
986 CompilationDependencies dependencies(isolate, &zone); | 986 CompilationDependencies dependencies(isolate, &zone); |
987 CHECK(!dependencies.HasAborted()); | 987 CHECK(!dependencies.HasAborted()); |
988 dependencies.AssumeFieldType(field_owner); | 988 dependencies.AssumeFieldOwner(field_owner); |
989 | 989 |
990 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 990 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
991 // should generalize representations in |map1|. | 991 // should generalize representations in |map1|. |
992 Handle<Map> new_map = | 992 Handle<Map> new_map = |
993 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 993 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
994 | 994 |
995 // |map2| should be left unchanged but marked unstable. | 995 // |map2| should be left unchanged but marked unstable. |
996 CHECK(!map2->is_stable()); | 996 CHECK(!map2->is_stable()); |
997 CHECK(!map2->is_deprecated()); | 997 CHECK(!map2->is_deprecated()); |
998 CHECK_NE(*map2, *new_map); | 998 CHECK_NE(*map2, *new_map); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 1063 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
1064 } | 1064 } |
1065 CHECK(!map2->is_deprecated()); | 1065 CHECK(!map2->is_deprecated()); |
1066 CHECK(map2->is_stable()); | 1066 CHECK(map2->is_stable()); |
1067 CHECK(expectations2.Check(*map2)); | 1067 CHECK(expectations2.Check(*map2)); |
1068 | 1068 |
1069 Zone zone(isolate->allocator()); | 1069 Zone zone(isolate->allocator()); |
1070 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 1070 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
1071 CompilationDependencies dependencies(isolate, &zone); | 1071 CompilationDependencies dependencies(isolate, &zone); |
1072 CHECK(!dependencies.HasAborted()); | 1072 CHECK(!dependencies.HasAborted()); |
1073 dependencies.AssumeFieldType(field_owner); | 1073 dependencies.AssumeFieldOwner(field_owner); |
1074 | 1074 |
1075 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 1075 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
1076 // should generalize representations in |map1|. | 1076 // should generalize representations in |map1|. |
1077 Handle<Map> new_map = | 1077 Handle<Map> new_map = |
1078 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 1078 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
1079 | 1079 |
1080 // |map2| should be left unchanged but marked unstable. | 1080 // |map2| should be left unchanged but marked unstable. |
1081 CHECK(!map2->is_stable()); | 1081 CHECK(!map2->is_stable()); |
1082 CHECK(!map2->is_deprecated()); | 1082 CHECK(!map2->is_deprecated()); |
1083 CHECK_NE(*map2, *new_map); | 1083 CHECK_NE(*map2, *new_map); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 } | 1594 } |
1595 } | 1595 } |
1596 CHECK(!map2->is_deprecated()); | 1596 CHECK(!map2->is_deprecated()); |
1597 CHECK(map2->is_stable()); | 1597 CHECK(map2->is_stable()); |
1598 CHECK(expectations2.Check(*map2)); | 1598 CHECK(expectations2.Check(*map2)); |
1599 | 1599 |
1600 Zone zone(isolate->allocator()); | 1600 Zone zone(isolate->allocator()); |
1601 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); | 1601 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); |
1602 CompilationDependencies dependencies(isolate, &zone); | 1602 CompilationDependencies dependencies(isolate, &zone); |
1603 CHECK(!dependencies.HasAborted()); | 1603 CHECK(!dependencies.HasAborted()); |
1604 dependencies.AssumeFieldType(field_owner); | 1604 dependencies.AssumeFieldOwner(field_owner); |
1605 | 1605 |
1606 // Reconfigure elements kinds of |map2|, which should generalize | 1606 // Reconfigure elements kinds of |map2|, which should generalize |
1607 // representations in |map|. | 1607 // representations in |map|. |
1608 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); | 1608 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); |
1609 | 1609 |
1610 // |map2| should be left unchanged but marked unstable. | 1610 // |map2| should be left unchanged but marked unstable. |
1611 CHECK(!map2->is_stable()); | 1611 CHECK(!map2->is_stable()); |
1612 CHECK(!map2->is_deprecated()); | 1612 CHECK(!map2->is_deprecated()); |
1613 CHECK_NE(*map2, *new_map); | 1613 CHECK_NE(*map2, *new_map); |
1614 CHECK(expectations2.Check(*map2)); | 1614 CHECK(expectations2.Check(*map2)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 } | 1687 } |
1688 } | 1688 } |
1689 CHECK(!map2->is_deprecated()); | 1689 CHECK(!map2->is_deprecated()); |
1690 CHECK(map2->is_stable()); | 1690 CHECK(map2->is_stable()); |
1691 CHECK(expectations2.Check(*map2)); | 1691 CHECK(expectations2.Check(*map2)); |
1692 | 1692 |
1693 Zone zone(isolate->allocator()); | 1693 Zone zone(isolate->allocator()); |
1694 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); | 1694 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); |
1695 CompilationDependencies dependencies(isolate, &zone); | 1695 CompilationDependencies dependencies(isolate, &zone); |
1696 CHECK(!dependencies.HasAborted()); | 1696 CHECK(!dependencies.HasAborted()); |
1697 dependencies.AssumeFieldType(field_owner); | 1697 dependencies.AssumeFieldOwner(field_owner); |
1698 | 1698 |
1699 // Reconfigure elements kinds of |map2|, which should generalize | 1699 // Reconfigure elements kinds of |map2|, which should generalize |
1700 // representations in |map|. | 1700 // representations in |map|. |
1701 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); | 1701 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); |
1702 | 1702 |
1703 // |map2| should be left unchanged but marked unstable. | 1703 // |map2| should be left unchanged but marked unstable. |
1704 CHECK(!map2->is_stable()); | 1704 CHECK(!map2->is_stable()); |
1705 CHECK(!map2->is_deprecated()); | 1705 CHECK(!map2->is_deprecated()); |
1706 CHECK_NE(*map2, *new_map); | 1706 CHECK_NE(*map2, *new_map); |
1707 CHECK(expectations2.Check(*map2)); | 1707 CHECK(expectations2.Check(*map2)); |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 Isolate* isolate = CcTest::i_isolate(); | 2417 Isolate* isolate = CcTest::i_isolate(); |
2418 | 2418 |
2419 Zone zone(isolate->allocator()); | 2419 Zone zone(isolate->allocator()); |
2420 | 2420 |
2421 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); | 2421 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); |
2422 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); | 2422 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); |
2423 } | 2423 } |
2424 | 2424 |
2425 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2425 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2426 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2426 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
OLD | NEW |