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" | |
11 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
12 #include "src/execution.h" | 11 #include "src/execution.h" |
13 #include "src/factory.h" | 12 #include "src/factory.h" |
14 #include "src/global-handles.h" | 13 #include "src/global-handles.h" |
15 #include "src/ic/stub-cache.h" | 14 #include "src/ic/stub-cache.h" |
16 #include "src/macro-assembler.h" | 15 #include "src/macro-assembler.h" |
17 #include "test/cctest/cctest.h" | 16 #include "test/cctest/cctest.h" |
18 | 17 |
19 using namespace v8::internal; | 18 using namespace v8::internal; |
20 | 19 |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 if (i == detach_property_at_index) { | 560 if (i == detach_property_at_index) { |
562 detach_point_map = map; | 561 detach_point_map = map; |
563 } | 562 } |
564 } | 563 } |
565 } | 564 } |
566 CHECK(!map->is_deprecated()); | 565 CHECK(!map->is_deprecated()); |
567 CHECK(map->is_stable()); | 566 CHECK(map->is_stable()); |
568 CHECK(expectations.Check(*map)); | 567 CHECK(expectations.Check(*map)); |
569 | 568 |
570 Zone zone; | 569 Zone zone; |
571 FakeStubForTesting stub(isolate); | |
572 | 570 |
573 if (is_detached_map) { | 571 if (is_detached_map) { |
574 detach_point_map = Map::ReconfigureProperty( | 572 detach_point_map = Map::ReconfigureProperty( |
575 detach_point_map, detach_property_at_index, kData, NONE, | 573 detach_point_map, detach_property_at_index, kData, NONE, |
576 Representation::Tagged(), any_type, FORCE_FIELD); | 574 Representation::Tagged(), any_type, FORCE_FIELD); |
577 expectations.SetDataField(detach_property_at_index, | 575 expectations.SetDataField(detach_property_at_index, |
578 Representation::Tagged(), any_type); | 576 Representation::Tagged(), any_type); |
579 CHECK(map->is_deprecated()); | 577 CHECK(map->is_deprecated()); |
580 CHECK(expectations.Check(*detach_point_map, | 578 CHECK(expectations.Check(*detach_point_map, |
581 detach_point_map->NumberOfOwnDescriptors())); | 579 detach_point_map->NumberOfOwnDescriptors())); |
582 } | 580 } |
583 | 581 |
584 // Create new maps by generalizing representation of propX field. | 582 // Create new maps by generalizing representation of propX field. |
585 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); | 583 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); |
586 CompilationInfo info(&stub, isolate, &zone); | 584 CompilationInfo info("testing", isolate, &zone); |
587 CHECK(!info.dependencies()->HasAborted()); | 585 CHECK(!info.dependencies()->HasAborted()); |
588 | 586 |
589 info.dependencies()->AssumeFieldType(field_owner); | 587 info.dependencies()->AssumeFieldType(field_owner); |
590 | 588 |
591 Handle<Map> new_map = | 589 Handle<Map> new_map = |
592 Map::ReconfigureProperty(map, property_index, kData, NONE, | 590 Map::ReconfigureProperty(map, property_index, kData, NONE, |
593 to_representation, to_type, FORCE_FIELD); | 591 to_representation, to_type, FORCE_FIELD); |
594 | 592 |
595 expectations.SetDataField(property_index, expected_representation, | 593 expectations.SetDataField(property_index, expected_representation, |
596 expected_type); | 594 expected_type); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); | 950 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); |
953 | 951 |
954 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 952 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
955 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 953 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
956 } | 954 } |
957 CHECK(!map2->is_deprecated()); | 955 CHECK(!map2->is_deprecated()); |
958 CHECK(map2->is_stable()); | 956 CHECK(map2->is_stable()); |
959 CHECK(expectations2.Check(*map2)); | 957 CHECK(expectations2.Check(*map2)); |
960 | 958 |
961 Zone zone; | 959 Zone zone; |
962 FakeStubForTesting stub(isolate); | |
963 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 960 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
964 CompilationInfo info(&stub, isolate, &zone); | 961 CompilationInfo info("testing", isolate, &zone); |
965 CHECK(!info.dependencies()->HasAborted()); | 962 CHECK(!info.dependencies()->HasAborted()); |
966 info.dependencies()->AssumeFieldType(field_owner); | 963 info.dependencies()->AssumeFieldType(field_owner); |
967 | 964 |
968 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 965 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
969 // should generalize representations in |map1|. | 966 // should generalize representations in |map1|. |
970 Handle<Map> new_map = | 967 Handle<Map> new_map = |
971 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 968 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
972 | 969 |
973 // |map2| should be left unchanged but marked unstable. | 970 // |map2| should be left unchanged but marked unstable. |
974 CHECK(!map2->is_stable()); | 971 CHECK(!map2->is_stable()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); | 1035 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); |
1039 | 1036 |
1040 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 1037 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
1041 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 1038 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
1042 } | 1039 } |
1043 CHECK(!map2->is_deprecated()); | 1040 CHECK(!map2->is_deprecated()); |
1044 CHECK(map2->is_stable()); | 1041 CHECK(map2->is_stable()); |
1045 CHECK(expectations2.Check(*map2)); | 1042 CHECK(expectations2.Check(*map2)); |
1046 | 1043 |
1047 Zone zone; | 1044 Zone zone; |
1048 FakeStubForTesting stub(isolate); | |
1049 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); | 1045 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); |
1050 CompilationInfo info(&stub, isolate, &zone); | 1046 CompilationInfo info("testing", isolate, &zone); |
1051 CHECK(!info.dependencies()->HasAborted()); | 1047 CHECK(!info.dependencies()->HasAborted()); |
1052 info.dependencies()->AssumeFieldType(field_owner); | 1048 info.dependencies()->AssumeFieldType(field_owner); |
1053 | 1049 |
1054 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which | 1050 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which |
1055 // should generalize representations in |map1|. | 1051 // should generalize representations in |map1|. |
1056 Handle<Map> new_map = | 1052 Handle<Map> new_map = |
1057 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); | 1053 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); |
1058 | 1054 |
1059 // |map2| should be left unchanged but marked unstable. | 1055 // |map2| should be left unchanged but marked unstable. |
1060 CHECK(!map2->is_stable()); | 1056 CHECK(!map2->is_stable()); |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 Handle<AccessorPair> pair = CreateAccessorPair(true, true); | 2173 Handle<AccessorPair> pair = CreateAccessorPair(true, true); |
2178 TransitionToAccessorConstantOperator transition_op(pair); | 2174 TransitionToAccessorConstantOperator transition_op(pair); |
2179 | 2175 |
2180 SameMapChecker checker; | 2176 SameMapChecker checker; |
2181 TestTransitionTo(transition_op, transition_op, checker); | 2177 TestTransitionTo(transition_op, transition_op, checker); |
2182 } | 2178 } |
2183 | 2179 |
2184 | 2180 |
2185 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2181 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2186 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2182 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
OLD | NEW |