| 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 "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 } | 837 } |
| 838 | 838 |
| 839 | 839 |
| 840 //////////////////////////////////////////////////////////////////////////////// | 840 //////////////////////////////////////////////////////////////////////////////// |
| 841 // A set of tests for attribute reconfiguration case. | 841 // A set of tests for attribute reconfiguration case. |
| 842 // | 842 // |
| 843 | 843 |
| 844 // This test ensures that representation/field type generalization is correctly | 844 // This test ensures that representation/field type generalization is correctly |
| 845 // propagated from one branch of transition tree (|map2|) to another (|map|). | 845 // propagated from one branch of transition tree (|map2|) to another (|map|). |
| 846 // | 846 // |
| 847 // - p2B - p3 - p4: |map2| | 847 // + - p2B - p3 - p4: |map2| |
| 848 // / | 848 // | |
| 849 // {} - p0 - p1 - p2A - p3 - p4: |map| | 849 // {} - p0 - p1 - p2A - p3 - p4: |map| |
| 850 // | 850 // |
| 851 // where "p2A" and "p2B" differ only in the attributes. | 851 // where "p2A" and "p2B" differ only in the attributes. |
| 852 // | 852 // |
| 853 static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( | 853 static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( |
| 854 Representation from_representation, Handle<HeapType> from_type, | 854 Representation from_representation, Handle<HeapType> from_type, |
| 855 Representation to_representation, Handle<HeapType> to_type, | 855 Representation to_representation, Handle<HeapType> to_type, |
| 856 Representation expected_representation, Handle<HeapType> expected_type) { | 856 Representation expected_representation, Handle<HeapType> expected_type) { |
| 857 Isolate* isolate = CcTest::i_isolate(); | 857 Isolate* isolate = CcTest::i_isolate(); |
| 858 | 858 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 922 |
| 923 // Update deprecated |map|, it should become |new_map|. | 923 // Update deprecated |map|, it should become |new_map|. |
| 924 CHECK_EQ(*new_map, *Map::Update(map)); | 924 CHECK_EQ(*new_map, *Map::Update(map)); |
| 925 } | 925 } |
| 926 | 926 |
| 927 | 927 |
| 928 // This test ensures that trivial representation/field type generalization | 928 // This test ensures that trivial representation/field type generalization |
| 929 // (from HeapObject to HeapObject) is correctly propagated from one branch of | 929 // (from HeapObject to HeapObject) is correctly propagated from one branch of |
| 930 // transition tree (|map2|) to another (|map|). | 930 // transition tree (|map2|) to another (|map|). |
| 931 // | 931 // |
| 932 // - p2B - p3 - p4: |map2| | 932 // + - p2B - p3 - p4: |map2| |
| 933 // / | 933 // | |
| 934 // {} - p0 - p1 - p2A - p3 - p4: |map| | 934 // {} - p0 - p1 - p2A - p3 - p4: |map| |
| 935 // | 935 // |
| 936 // where "p2A" and "p2B" differ only in the attributes. | 936 // where "p2A" and "p2B" differ only in the attributes. |
| 937 // | 937 // |
| 938 static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( | 938 static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( |
| 939 Representation from_representation, Handle<HeapType> from_type, | 939 Representation from_representation, Handle<HeapType> from_type, |
| 940 Representation to_representation, Handle<HeapType> to_type, | 940 Representation to_representation, Handle<HeapType> to_type, |
| 941 Representation expected_representation, Handle<HeapType> expected_type, | 941 Representation expected_representation, Handle<HeapType> expected_type, |
| 942 bool expected_field_type_dependency = true) { | 942 bool expected_field_type_dependency = true) { |
| 943 Isolate* isolate = CcTest::i_isolate(); | 943 Isolate* isolate = CcTest::i_isolate(); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 CHECK(!new_map->is_deprecated()); | 1153 CHECK(!new_map->is_deprecated()); |
| 1154 CHECK(!new_map->is_dictionary_map()); | 1154 CHECK(!new_map->is_dictionary_map()); |
| 1155 CHECK(expectations.Check(*new_map)); | 1155 CHECK(expectations.Check(*new_map)); |
| 1156 } | 1156 } |
| 1157 }; | 1157 }; |
| 1158 | 1158 |
| 1159 | 1159 |
| 1160 // This test ensures that representation/field type generalization is correctly | 1160 // This test ensures that representation/field type generalization is correctly |
| 1161 // propagated from one branch of transition tree (|map2|) to another (|map1|). | 1161 // propagated from one branch of transition tree (|map2|) to another (|map1|). |
| 1162 // | 1162 // |
| 1163 // - p2B - p3 - p4: |map2| | 1163 // + - p2B - p3 - p4: |map2| |
| 1164 // / | 1164 // | |
| 1165 // {} - p0 - p1: |map| | 1165 // {} - p0 - p1: |map| |
| 1166 // \ | 1166 // | |
| 1167 // - p2A - p3 - p4: |map1| | 1167 // + - p2A - p3 - p4: |map1| |
| 1168 // \ | 1168 // | |
| 1169 // - the property customized by the TestConfig provided | 1169 // + - the property customized by the TestConfig provided |
| 1170 // | 1170 // |
| 1171 // where "p2A" and "p2B" differ only in the attributes. | 1171 // where "p2A" and "p2B" differ only in the attributes. |
| 1172 // | 1172 // |
| 1173 template <typename TestConfig, typename Checker> | 1173 template <typename TestConfig, typename Checker> |
| 1174 static void TestReconfigureProperty_CustomPropertyAfterTargetMap( | 1174 static void TestReconfigureProperty_CustomPropertyAfterTargetMap( |
| 1175 TestConfig& config, Checker& checker) { | 1175 TestConfig& config, Checker& checker) { |
| 1176 Isolate* isolate = CcTest::i_isolate(); | 1176 Isolate* isolate = CcTest::i_isolate(); |
| 1177 Handle<HeapType> any_type = HeapType::Any(isolate); | 1177 Handle<HeapType> any_type = HeapType::Any(isolate); |
| 1178 | 1178 |
| 1179 const int kCustomPropIndex = kPropCount - 2; | 1179 const int kCustomPropIndex = kPropCount - 2; |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 }; | 1885 }; |
| 1886 | 1886 |
| 1887 | 1887 |
| 1888 // This test transitions to various property types under different | 1888 // This test transitions to various property types under different |
| 1889 // circumstances. | 1889 // circumstances. |
| 1890 // Plan: | 1890 // Plan: |
| 1891 // 1) create a |map| with p0..p3 properties. | 1891 // 1) create a |map| with p0..p3 properties. |
| 1892 // 2) create |map1| by adding "p4" to |map0|. | 1892 // 2) create |map1| by adding "p4" to |map0|. |
| 1893 // 3) create |map2| by transition to "p4" from |map0|. | 1893 // 3) create |map2| by transition to "p4" from |map0|. |
| 1894 // | 1894 // |
| 1895 // - p4B: |map2| | 1895 // + - p4B: |map2| |
| 1896 // / | 1896 // | |
| 1897 // {} - p0 - p1 - pA - p3: |map| | 1897 // {} - p0 - p1 - pA - p3: |map| |
| 1898 // \ | 1898 // | |
| 1899 // - p4A: |map1| | 1899 // + - p4A: |map1| |
| 1900 // | 1900 // |
| 1901 // where "p4A" and "p4B" differ only in the attributes. | 1901 // where "p4A" and "p4B" differ only in the attributes. |
| 1902 // | 1902 // |
| 1903 template <typename TransitionOp1, typename TransitionOp2, typename Checker> | 1903 template <typename TransitionOp1, typename TransitionOp2, typename Checker> |
| 1904 static void TestTransitionTo(TransitionOp1& transition_op1, | 1904 static void TestTransitionTo(TransitionOp1& transition_op1, |
| 1905 TransitionOp2& transition_op2, Checker& checker) { | 1905 TransitionOp2& transition_op2, Checker& checker) { |
| 1906 Isolate* isolate = CcTest::i_isolate(); | 1906 Isolate* isolate = CcTest::i_isolate(); |
| 1907 Handle<HeapType> any_type = HeapType::Any(isolate); | 1907 Handle<HeapType> any_type = HeapType::Any(isolate); |
| 1908 | 1908 |
| 1909 Expectations expectations(isolate); | 1909 Expectations expectations(isolate); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 Handle<AccessorPair> pair = CreateAccessorPair(true, true); | 2008 Handle<AccessorPair> pair = CreateAccessorPair(true, true); |
| 2009 TransitionToAccessorConstantOperator transition_op(pair); | 2009 TransitionToAccessorConstantOperator transition_op(pair); |
| 2010 | 2010 |
| 2011 SameMapChecker checker; | 2011 SameMapChecker checker; |
| 2012 TestTransitionTo(transition_op, transition_op, checker); | 2012 TestTransitionTo(transition_op, transition_op, checker); |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 | 2015 |
| 2016 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2016 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
| 2017 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2017 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
| OLD | NEW |