| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 Representation::Tagged(), any_type, FORCE_FIELD); | 596 Representation::Tagged(), any_type, FORCE_FIELD); |
| 597 expectations.SetDataField(detach_property_at_index, | 597 expectations.SetDataField(detach_property_at_index, |
| 598 Representation::Tagged(), any_type); | 598 Representation::Tagged(), any_type); |
| 599 CHECK(map->is_deprecated()); | 599 CHECK(map->is_deprecated()); |
| 600 CHECK(expectations.Check(*detach_point_map, | 600 CHECK(expectations.Check(*detach_point_map, |
| 601 detach_point_map->NumberOfOwnDescriptors())); | 601 detach_point_map->NumberOfOwnDescriptors())); |
| 602 } | 602 } |
| 603 | 603 |
| 604 // Create new maps by generalizing representation of propX field. | 604 // Create new maps by generalizing representation of propX field. |
| 605 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); | 605 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); |
| 606 CompilationInfo info(ArrayVector("testing"), isolate, &zone); | 606 CompilationInfo info(ArrayVector("testing"), isolate, &zone, |
| 607 Code::ComputeFlags(Code::STUB)); |
| 607 CHECK(!info.dependencies()->HasAborted()); | 608 CHECK(!info.dependencies()->HasAborted()); |
| 608 | 609 |
| 609 info.dependencies()->AssumeFieldType(field_owner); | 610 info.dependencies()->AssumeFieldType(field_owner); |
| 610 | 611 |
| 611 Handle<Map> new_map = | 612 Handle<Map> new_map = |
| 612 Map::ReconfigureProperty(map, property_index, kData, NONE, | 613 Map::ReconfigureProperty(map, property_index, kData, NONE, |
| 613 to_representation, to_type, FORCE_FIELD); | 614 to_representation, to_type, FORCE_FIELD); |
| 614 | 615 |
| 615 expectations.SetDataField(property_index, expected_representation, | 616 expectations.SetDataField(property_index, expected_representation, |
| 616 expected_type); | 617 expected_type); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 | 976 |
| 976 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 977 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
| 977 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 978 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
| 978 } | 979 } |
| 979 CHECK(!map2->is_deprecated()); | 980 CHECK(!map2->is_deprecated()); |
| 980 CHECK(map2->is_stable()); | 981 CHECK(map2->is_stable()); |
| 981 CHECK(expectations2.Check(*map2)); | 982 CHECK(expectations2.Check(*map2)); |
| 982 | 983 |
| 983 Zone zone(isolate->allocator()); | 984 Zone zone(isolate->allocator()); |
| 984 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 985 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
| 985 CompilationInfo info(ArrayVector("testing"), isolate, &zone); | 986 CompilationInfo info(ArrayVector("testing"), isolate, &zone, |
| 987 Code::ComputeFlags(Code::STUB)); |
| 986 CHECK(!info.dependencies()->HasAborted()); | 988 CHECK(!info.dependencies()->HasAborted()); |
| 987 info.dependencies()->AssumeFieldType(field_owner); | 989 info.dependencies()->AssumeFieldType(field_owner); |
| 988 | 990 |
| 989 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 991 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
| 990 // should generalize representations in |map1|. | 992 // should generalize representations in |map1|. |
| 991 Handle<Map> new_map = | 993 Handle<Map> new_map = |
| 992 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 994 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
| 993 | 995 |
| 994 // |map2| should be left unchanged but marked unstable. | 996 // |map2| should be left unchanged but marked unstable. |
| 995 CHECK(!map2->is_stable()); | 997 CHECK(!map2->is_stable()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1062 |
| 1061 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 1063 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
| 1062 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 1064 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
| 1063 } | 1065 } |
| 1064 CHECK(!map2->is_deprecated()); | 1066 CHECK(!map2->is_deprecated()); |
| 1065 CHECK(map2->is_stable()); | 1067 CHECK(map2->is_stable()); |
| 1066 CHECK(expectations2.Check(*map2)); | 1068 CHECK(expectations2.Check(*map2)); |
| 1067 | 1069 |
| 1068 Zone zone(isolate->allocator()); | 1070 Zone zone(isolate->allocator()); |
| 1069 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 1071 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
| 1070 CompilationInfo info(ArrayVector("testing"), isolate, &zone); | 1072 CompilationInfo info(ArrayVector("testing"), isolate, &zone, |
| 1073 Code::ComputeFlags(Code::STUB)); |
| 1071 CHECK(!info.dependencies()->HasAborted()); | 1074 CHECK(!info.dependencies()->HasAborted()); |
| 1072 info.dependencies()->AssumeFieldType(field_owner); | 1075 info.dependencies()->AssumeFieldType(field_owner); |
| 1073 | 1076 |
| 1074 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 1077 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
| 1075 // should generalize representations in |map1|. | 1078 // should generalize representations in |map1|. |
| 1076 Handle<Map> new_map = | 1079 Handle<Map> new_map = |
| 1077 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 1080 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
| 1078 | 1081 |
| 1079 // |map2| should be left unchanged but marked unstable. | 1082 // |map2| should be left unchanged but marked unstable. |
| 1080 CHECK(!map2->is_stable()); | 1083 CHECK(!map2->is_stable()); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 map2 = expectations2.AddDataField(map2, NONE, from_representation, | 1594 map2 = expectations2.AddDataField(map2, NONE, from_representation, |
| 1592 from_type); | 1595 from_type); |
| 1593 } | 1596 } |
| 1594 } | 1597 } |
| 1595 CHECK(!map2->is_deprecated()); | 1598 CHECK(!map2->is_deprecated()); |
| 1596 CHECK(map2->is_stable()); | 1599 CHECK(map2->is_stable()); |
| 1597 CHECK(expectations2.Check(*map2)); | 1600 CHECK(expectations2.Check(*map2)); |
| 1598 | 1601 |
| 1599 Zone zone(isolate->allocator()); | 1602 Zone zone(isolate->allocator()); |
| 1600 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); | 1603 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); |
| 1601 CompilationInfo info(ArrayVector("testing"), isolate, &zone); | 1604 CompilationInfo info(ArrayVector("testing"), isolate, &zone, |
| 1605 Code::ComputeFlags(Code::STUB)); |
| 1602 CHECK(!info.dependencies()->HasAborted()); | 1606 CHECK(!info.dependencies()->HasAborted()); |
| 1603 info.dependencies()->AssumeFieldType(field_owner); | 1607 info.dependencies()->AssumeFieldType(field_owner); |
| 1604 | 1608 |
| 1605 // Reconfigure elements kinds of |map2|, which should generalize | 1609 // Reconfigure elements kinds of |map2|, which should generalize |
| 1606 // representations in |map|. | 1610 // representations in |map|. |
| 1607 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); | 1611 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); |
| 1608 | 1612 |
| 1609 // |map2| should be left unchanged but marked unstable. | 1613 // |map2| should be left unchanged but marked unstable. |
| 1610 CHECK(!map2->is_stable()); | 1614 CHECK(!map2->is_stable()); |
| 1611 CHECK(!map2->is_deprecated()); | 1615 CHECK(!map2->is_deprecated()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 map2 = expectations2.AddDataField(map2, NONE, from_representation, | 1688 map2 = expectations2.AddDataField(map2, NONE, from_representation, |
| 1685 from_type); | 1689 from_type); |
| 1686 } | 1690 } |
| 1687 } | 1691 } |
| 1688 CHECK(!map2->is_deprecated()); | 1692 CHECK(!map2->is_deprecated()); |
| 1689 CHECK(map2->is_stable()); | 1693 CHECK(map2->is_stable()); |
| 1690 CHECK(expectations2.Check(*map2)); | 1694 CHECK(expectations2.Check(*map2)); |
| 1691 | 1695 |
| 1692 Zone zone(isolate->allocator()); | 1696 Zone zone(isolate->allocator()); |
| 1693 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); | 1697 Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); |
| 1694 CompilationInfo info(ArrayVector("testing"), isolate, &zone); | 1698 CompilationInfo info(ArrayVector("testing"), isolate, &zone, |
| 1699 Code::ComputeFlags(Code::STUB)); |
| 1695 CHECK(!info.dependencies()->HasAborted()); | 1700 CHECK(!info.dependencies()->HasAborted()); |
| 1696 info.dependencies()->AssumeFieldType(field_owner); | 1701 info.dependencies()->AssumeFieldType(field_owner); |
| 1697 | 1702 |
| 1698 // Reconfigure elements kinds of |map2|, which should generalize | 1703 // Reconfigure elements kinds of |map2|, which should generalize |
| 1699 // representations in |map|. | 1704 // representations in |map|. |
| 1700 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); | 1705 Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS); |
| 1701 | 1706 |
| 1702 // |map2| should be left unchanged but marked unstable. | 1707 // |map2| should be left unchanged but marked unstable. |
| 1703 CHECK(!map2->is_stable()); | 1708 CHECK(!map2->is_stable()); |
| 1704 CHECK(!map2->is_deprecated()); | 1709 CHECK(!map2->is_deprecated()); |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 Handle<AccessorPair> pair = CreateAccessorPair(true, true); | 2411 Handle<AccessorPair> pair = CreateAccessorPair(true, true); |
| 2407 TransitionToAccessorConstantOperator transition_op(pair); | 2412 TransitionToAccessorConstantOperator transition_op(pair); |
| 2408 | 2413 |
| 2409 SameMapChecker checker; | 2414 SameMapChecker checker; |
| 2410 TestTransitionTo(transition_op, transition_op, checker); | 2415 TestTransitionTo(transition_op, transition_op, checker); |
| 2411 } | 2416 } |
| 2412 | 2417 |
| 2413 | 2418 |
| 2414 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2419 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
| 2415 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2420 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
| OLD | NEW |