Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: test/cctest/test-migrations.cc

Issue 1093783002: Revert of Refactor compilation dependency handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 expectations.SetDataField(detach_property_at_index, 584 expectations.SetDataField(detach_property_at_index,
585 Representation::Tagged(), any_type); 585 Representation::Tagged(), any_type);
586 CHECK(map->is_deprecated()); 586 CHECK(map->is_deprecated());
587 CHECK(expectations.Check(*detach_point_map, 587 CHECK(expectations.Check(*detach_point_map,
588 detach_point_map->NumberOfOwnDescriptors())); 588 detach_point_map->NumberOfOwnDescriptors()));
589 } 589 }
590 590
591 // Create new maps by generalizing representation of propX field. 591 // Create new maps by generalizing representation of propX field.
592 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); 592 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate);
593 CompilationInfo info(&stub, isolate, &zone); 593 CompilationInfo info(&stub, isolate, &zone);
594 CHECK(!info.dependencies()->HasAborted()); 594 CHECK(!info.HasAbortedDueToDependencyChange());
595 595
596 info.dependencies()->AssumeFieldType(field_owner); 596 Map::AddDependentCompilationInfo(field_owner, DependentCode::kFieldTypeGroup,
597 &info);
597 598
598 Handle<Map> new_map = 599 Handle<Map> new_map =
599 Map::ReconfigureProperty(map, property_index, kData, NONE, 600 Map::ReconfigureProperty(map, property_index, kData, NONE,
600 to_representation, to_type, FORCE_FIELD); 601 to_representation, to_type, FORCE_FIELD);
601 602
602 expectations.SetDataField(property_index, expected_representation, 603 expectations.SetDataField(property_index, expected_representation,
603 expected_type); 604 expected_type);
604 605
605 CHECK(!new_map->is_deprecated()); 606 CHECK(!new_map->is_deprecated());
606 CHECK(expectations.Check(*new_map)); 607 CHECK(expectations.Check(*new_map));
607 608
608 if (is_detached_map) { 609 if (is_detached_map) {
609 CHECK(map->is_deprecated()); 610 CHECK(map->is_deprecated());
610 CHECK_NE(*map, *new_map); 611 CHECK_NE(*map, *new_map);
611 CHECK_EQ(expected_field_type_dependency && !field_owner->is_deprecated(), 612 CHECK_EQ(expected_field_type_dependency && !field_owner->is_deprecated(),
612 info.dependencies()->HasAborted()); 613 info.HasAbortedDueToDependencyChange());
613 614
614 } else if (expected_deprecation) { 615 } else if (expected_deprecation) {
615 CHECK(map->is_deprecated()); 616 CHECK(map->is_deprecated());
616 CHECK(field_owner->is_deprecated()); 617 CHECK(field_owner->is_deprecated());
617 CHECK_NE(*map, *new_map); 618 CHECK_NE(*map, *new_map);
618 CHECK(!info.dependencies()->HasAborted()); 619 CHECK(!info.HasAbortedDueToDependencyChange());
619 620
620 } else { 621 } else {
621 CHECK(!field_owner->is_deprecated()); 622 CHECK(!field_owner->is_deprecated());
622 CHECK_EQ(*map, *new_map); 623 CHECK_EQ(*map, *new_map);
623 624
624 CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); 625 CHECK_EQ(expected_field_type_dependency,
626 info.HasAbortedDueToDependencyChange());
625 } 627 }
626 628
627 info.dependencies()->Rollback(); // Properly cleanup compilation info. 629 info.RollbackDependencies(); // Properly cleanup compilation info.
628 630
629 // Update all deprecated maps and check that they are now the same. 631 // Update all deprecated maps and check that they are now the same.
630 Handle<Map> updated_map = Map::Update(map); 632 Handle<Map> updated_map = Map::Update(map);
631 CHECK_EQ(*new_map, *updated_map); 633 CHECK_EQ(*new_map, *updated_map);
632 } 634 }
633 635
634 636
635 static void TestGeneralizeRepresentation( 637 static void TestGeneralizeRepresentation(
636 Representation from_representation, Handle<HeapType> from_type, 638 Representation from_representation, Handle<HeapType> from_type,
637 Representation to_representation, Handle<HeapType> to_type, 639 Representation to_representation, Handle<HeapType> to_type,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); 954 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type);
953 } 955 }
954 CHECK(!map2->is_deprecated()); 956 CHECK(!map2->is_deprecated());
955 CHECK(map2->is_stable()); 957 CHECK(map2->is_stable());
956 CHECK(expectations2.Check(*map2)); 958 CHECK(expectations2.Check(*map2));
957 959
958 Zone zone; 960 Zone zone;
959 FakeStubForTesting stub(isolate); 961 FakeStubForTesting stub(isolate);
960 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); 962 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
961 CompilationInfo info(&stub, isolate, &zone); 963 CompilationInfo info(&stub, isolate, &zone);
962 CHECK(!info.dependencies()->HasAborted()); 964 CHECK(!info.HasAbortedDueToDependencyChange());
963 info.dependencies()->AssumeFieldType(field_owner); 965 Map::AddDependentCompilationInfo(field_owner, DependentCode::kFieldTypeGroup,
966 &info);
964 967
965 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which 968 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which
966 // should generalize representations in |map1|. 969 // should generalize representations in |map1|.
967 Handle<Map> new_map = 970 Handle<Map> new_map =
968 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); 971 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE);
969 972
970 // |map2| should be left unchanged. 973 // |map2| should be left unchanged.
971 CHECK(!map2->is_deprecated()); 974 CHECK(!map2->is_deprecated());
972 CHECK_NE(*map2, *new_map); 975 CHECK_NE(*map2, *new_map);
973 CHECK(expectations2.Check(*map2)); 976 CHECK(expectations2.Check(*map2));
974 977
975 // |map| should be deprecated and |new_map| should match new expectations. 978 // |map| should be deprecated and |new_map| should match new expectations.
976 for (int i = kSplitProp; i < kPropCount; i++) { 979 for (int i = kSplitProp; i < kPropCount; i++) {
977 expectations.SetDataField(i, expected_representation, expected_type); 980 expectations.SetDataField(i, expected_representation, expected_type);
978 } 981 }
979 CHECK(map->is_deprecated()); 982 CHECK(map->is_deprecated());
980 CHECK(!info.dependencies()->HasAborted()); 983 CHECK(!info.HasAbortedDueToDependencyChange());
981 info.dependencies()->Rollback(); // Properly cleanup compilation info. 984 info.RollbackDependencies(); // Properly cleanup compilation info.
982 CHECK_NE(*map, *new_map); 985 CHECK_NE(*map, *new_map);
983 986
984 CHECK(!new_map->is_deprecated()); 987 CHECK(!new_map->is_deprecated());
985 CHECK(expectations.Check(*new_map)); 988 CHECK(expectations.Check(*new_map));
986 989
987 // Update deprecated |map|, it should become |new_map|. 990 // Update deprecated |map|, it should become |new_map|.
988 Handle<Map> updated_map = Map::Update(map); 991 Handle<Map> updated_map = Map::Update(map);
989 CHECK_EQ(*new_map, *updated_map); 992 CHECK_EQ(*new_map, *updated_map);
990 } 993 }
991 994
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); 1040 map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type);
1038 } 1041 }
1039 CHECK(!map2->is_deprecated()); 1042 CHECK(!map2->is_deprecated());
1040 CHECK(map2->is_stable()); 1043 CHECK(map2->is_stable());
1041 CHECK(expectations2.Check(*map2)); 1044 CHECK(expectations2.Check(*map2));
1042 1045
1043 Zone zone; 1046 Zone zone;
1044 FakeStubForTesting stub(isolate); 1047 FakeStubForTesting stub(isolate);
1045 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); 1048 Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
1046 CompilationInfo info(&stub, isolate, &zone); 1049 CompilationInfo info(&stub, isolate, &zone);
1047 CHECK(!info.dependencies()->HasAborted()); 1050 CHECK(!info.HasAbortedDueToDependencyChange());
1048 info.dependencies()->AssumeFieldType(field_owner); 1051 Map::AddDependentCompilationInfo(field_owner, DependentCode::kFieldTypeGroup,
1052 &info);
1049 1053
1050 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which 1054 // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which
1051 // should generalize representations in |map1|. 1055 // should generalize representations in |map1|.
1052 Handle<Map> new_map = 1056 Handle<Map> new_map =
1053 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE); 1057 Map::ReconfigureExistingProperty(map2, kSplitProp, kData, NONE);
1054 1058
1055 // |map2| should be left unchanged. 1059 // |map2| should be left unchanged.
1056 CHECK(!map2->is_deprecated()); 1060 CHECK(!map2->is_deprecated());
1057 CHECK_NE(*map2, *new_map); 1061 CHECK_NE(*map2, *new_map);
1058 CHECK(expectations2.Check(*map2)); 1062 CHECK(expectations2.Check(*map2));
1059 1063
1060 // In trivial case |map| should be returned as a result of the property 1064 // In trivial case |map| should be returned as a result of the property
1061 // reconfiguration, respective field types should be generalized and 1065 // reconfiguration, respective field types should be generalized and
1062 // respective code dependencies should be invalidated. |map| should be NOT 1066 // respective code dependencies should be invalidated. |map| should be NOT
1063 // deprecated and it should match new expectations. 1067 // deprecated and it should match new expectations.
1064 for (int i = kSplitProp; i < kPropCount; i++) { 1068 for (int i = kSplitProp; i < kPropCount; i++) {
1065 expectations.SetDataField(i, expected_representation, expected_type); 1069 expectations.SetDataField(i, expected_representation, expected_type);
1066 } 1070 }
1067 CHECK(!map->is_deprecated()); 1071 CHECK(!map->is_deprecated());
1068 CHECK_EQ(*map, *new_map); 1072 CHECK_EQ(*map, *new_map);
1069 CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); 1073 CHECK_EQ(expected_field_type_dependency,
1070 info.dependencies()->Rollback(); // Properly cleanup compilation info. 1074 info.HasAbortedDueToDependencyChange());
1075 info.RollbackDependencies(); // Properly cleanup compilation info.
1071 1076
1072 CHECK(!new_map->is_deprecated()); 1077 CHECK(!new_map->is_deprecated());
1073 CHECK(expectations.Check(*new_map)); 1078 CHECK(expectations.Check(*new_map));
1074 1079
1075 Handle<Map> updated_map = Map::Update(map); 1080 Handle<Map> updated_map = Map::Update(map);
1076 CHECK_EQ(*new_map, *updated_map); 1081 CHECK_EQ(*new_map, *updated_map);
1077 } 1082 }
1078 1083
1079 1084
1080 TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationSmiToDouble) { 1085 TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationSmiToDouble) {
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 Handle<AccessorPair> pair = CreateAccessorPair(true, true); 2079 Handle<AccessorPair> pair = CreateAccessorPair(true, true);
2075 TransitionToAccessorConstantOperator transition_op(pair); 2080 TransitionToAccessorConstantOperator transition_op(pair);
2076 2081
2077 SameMapChecker checker; 2082 SameMapChecker checker;
2078 TestTransitionTo(transition_op, transition_op, checker); 2083 TestTransitionTo(transition_op, transition_op, checker);
2079 } 2084 }
2080 2085
2081 2086
2082 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. 2087 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
2083 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) 2088 // TEST(TransitionAccessorConstantToAnotherAccessorConstant)
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698