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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 bool generalizes_representations() const { return false; } | 1767 bool generalizes_representations() const { return false; } |
1768 bool is_non_equevalent_transition() const { return false; } | 1768 bool is_non_equevalent_transition() const { return false; } |
1769 }; | 1769 }; |
1770 TestConfig config; | 1770 TestConfig config; |
1771 TestGeneralizeRepresentationWithSpecialTransition( | 1771 TestGeneralizeRepresentationWithSpecialTransition( |
1772 config, Representation::Smi(), any_type, Representation::HeapObject(), | 1772 config, Representation::Smi(), any_type, Representation::HeapObject(), |
1773 value_type, Representation::Tagged(), any_type); | 1773 value_type, Representation::Tagged(), any_type); |
1774 } | 1774 } |
1775 | 1775 |
1776 | 1776 |
1777 TEST(ForObservedTransitionFromMapOwningDescriptor) { | |
1778 CcTest::InitializeVM(); | |
1779 v8::HandleScope scope(CcTest::isolate()); | |
1780 Isolate* isolate = CcTest::i_isolate(); | |
1781 Handle<FieldType> any_type = FieldType::Any(isolate); | |
1782 Handle<FieldType> value_type = | |
1783 FieldType::Class(Map::Create(isolate, 0), isolate); | |
1784 | |
1785 struct TestConfig { | |
1786 Handle<Map> Transition(Handle<Map> map) { | |
1787 return Map::CopyForObserved(map); | |
1788 } | |
1789 // TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed. | |
1790 bool generalizes_representations() const { return false; } | |
1791 bool is_non_equevalent_transition() const { return true; } | |
1792 }; | |
1793 TestConfig config; | |
1794 TestGeneralizeRepresentationWithSpecialTransition( | |
1795 config, Representation::Smi(), any_type, Representation::HeapObject(), | |
1796 value_type, Representation::Tagged(), any_type); | |
1797 } | |
1798 | |
1799 | |
1800 TEST(ForObservedTransitionFromMapNotOwningDescriptor) { | |
1801 CcTest::InitializeVM(); | |
1802 v8::HandleScope scope(CcTest::isolate()); | |
1803 Isolate* isolate = CcTest::i_isolate(); | |
1804 Handle<FieldType> any_type = FieldType::Any(isolate); | |
1805 Handle<FieldType> value_type = | |
1806 FieldType::Class(Map::Create(isolate, 0), isolate); | |
1807 | |
1808 struct TestConfig { | |
1809 Handle<Map> Transition(Handle<Map> map) { | |
1810 Isolate* isolate = CcTest::i_isolate(); | |
1811 Handle<FieldType> any_type = FieldType::Any(isolate); | |
1812 | |
1813 // Add one more transition to |map| in order to prevent descriptors | |
1814 // ownership. | |
1815 CHECK(map->owns_descriptors()); | |
1816 Map::CopyWithField(map, MakeString("foo"), any_type, NONE, | |
1817 Representation::Smi(), INSERT_TRANSITION) | |
1818 .ToHandleChecked(); | |
1819 CHECK(!map->owns_descriptors()); | |
1820 | |
1821 return Map::CopyForObserved(map); | |
1822 } | |
1823 // TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed. | |
1824 bool generalizes_representations() const { return false; } | |
1825 bool is_non_equevalent_transition() const { return true; } | |
1826 }; | |
1827 TestConfig config; | |
1828 TestGeneralizeRepresentationWithSpecialTransition( | |
1829 config, Representation::Smi(), any_type, Representation::HeapObject(), | |
1830 value_type, Representation::Tagged(), any_type); | |
1831 } | |
1832 | |
1833 | |
1834 TEST(PrototypeTransitionFromMapOwningDescriptor) { | 1777 TEST(PrototypeTransitionFromMapOwningDescriptor) { |
1835 CcTest::InitializeVM(); | 1778 CcTest::InitializeVM(); |
1836 v8::HandleScope scope(CcTest::isolate()); | 1779 v8::HandleScope scope(CcTest::isolate()); |
1837 Isolate* isolate = CcTest::i_isolate(); | 1780 Isolate* isolate = CcTest::i_isolate(); |
1838 | 1781 |
1839 Handle<FieldType> any_type = FieldType::Any(isolate); | 1782 Handle<FieldType> any_type = FieldType::Any(isolate); |
1840 Handle<FieldType> value_type = | 1783 Handle<FieldType> value_type = |
1841 FieldType::Class(Map::Create(isolate, 0), isolate); | 1784 FieldType::Class(Map::Create(isolate, 0), isolate); |
1842 | 1785 |
1843 struct TestConfig { | 1786 struct TestConfig { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 Handle<AccessorPair> pair = CreateAccessorPair(true, true); | 2122 Handle<AccessorPair> pair = CreateAccessorPair(true, true); |
2180 TransitionToAccessorConstantOperator transition_op(pair); | 2123 TransitionToAccessorConstantOperator transition_op(pair); |
2181 | 2124 |
2182 SameMapChecker checker; | 2125 SameMapChecker checker; |
2183 TestTransitionTo(transition_op, transition_op, checker); | 2126 TestTransitionTo(transition_op, transition_op, checker); |
2184 } | 2127 } |
2185 | 2128 |
2186 | 2129 |
2187 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2130 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2188 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2131 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
OLD | NEW |