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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 expectations.AddDataField(map, NONE, Representation::Smi(), any_type); | 582 expectations.AddDataField(map, NONE, Representation::Smi(), any_type); |
583 if (i == detach_property_at_index) { | 583 if (i == detach_property_at_index) { |
584 detach_point_map = map; | 584 detach_point_map = map; |
585 } | 585 } |
586 } | 586 } |
587 } | 587 } |
588 CHECK(!map->is_deprecated()); | 588 CHECK(!map->is_deprecated()); |
589 CHECK(map->is_stable()); | 589 CHECK(map->is_stable()); |
590 CHECK(expectations.Check(*map)); | 590 CHECK(expectations.Check(*map)); |
591 | 591 |
592 Zone zone(isolate->allocator()); | 592 Zone zone(isolate->allocator(), ZONE_NAME); |
593 | 593 |
594 if (is_detached_map) { | 594 if (is_detached_map) { |
595 detach_point_map = Map::ReconfigureProperty( | 595 detach_point_map = Map::ReconfigureProperty( |
596 detach_point_map, detach_property_at_index, kData, NONE, | 596 detach_point_map, detach_property_at_index, kData, NONE, |
597 Representation::Tagged(), any_type, FORCE_FIELD); | 597 Representation::Tagged(), any_type, FORCE_FIELD); |
598 expectations.SetDataField(detach_property_at_index, | 598 expectations.SetDataField(detach_property_at_index, |
599 Representation::Tagged(), any_type); | 599 Representation::Tagged(), any_type); |
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())); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 map2 = | 974 map2 = |
975 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); | 975 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); |
976 | 976 |
977 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 977 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
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(), ZONE_NAME); |
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.AssumeFieldOwner(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 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 map2 = | 1059 map2 = |
1060 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); | 1060 expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); |
1061 | 1061 |
1062 for (int i = kSplitProp + 1; i < kPropCount; i++) { | 1062 for (int i = kSplitProp + 1; i < kPropCount; i++) { |
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(), ZONE_NAME); |
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.AssumeFieldOwner(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 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 1590 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
1591 } else { | 1591 } else { |
1592 map2 = expectations2.AddDataField(map2, NONE, from_representation, | 1592 map2 = expectations2.AddDataField(map2, NONE, from_representation, |
1593 from_type); | 1593 from_type); |
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(), ZONE_NAME); |
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.AssumeFieldOwner(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. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); | 1683 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); |
1684 } else { | 1684 } else { |
1685 map2 = expectations2.AddDataField(map2, NONE, from_representation, | 1685 map2 = expectations2.AddDataField(map2, NONE, from_representation, |
1686 from_type); | 1686 from_type); |
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(), ZONE_NAME); |
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.AssumeFieldOwner(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. |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 | 2409 |
2410 SameMapChecker checker; | 2410 SameMapChecker checker; |
2411 TestTransitionTo(transition_op, transition_op, checker); | 2411 TestTransitionTo(transition_op, transition_op, checker); |
2412 } | 2412 } |
2413 | 2413 |
2414 TEST(FieldTypeConvertSimple) { | 2414 TEST(FieldTypeConvertSimple) { |
2415 CcTest::InitializeVM(); | 2415 CcTest::InitializeVM(); |
2416 v8::HandleScope scope(CcTest::isolate()); | 2416 v8::HandleScope scope(CcTest::isolate()); |
2417 Isolate* isolate = CcTest::i_isolate(); | 2417 Isolate* isolate = CcTest::i_isolate(); |
2418 | 2418 |
2419 Zone zone(isolate->allocator()); | 2419 Zone zone(isolate->allocator(), ZONE_NAME); |
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 |