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

Side by Side Diff: test/cctest/test-field-type-tracking.cc

Issue 2639583002: [runtime] Remove redundant StoreMode enum. (Closed)
Patch Set: Created 3 years, 11 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') | test/cctest/test-unboxed-doubles.cc » ('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 "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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // Create a map, add required properties to it and initialize expectations. 448 // Create a map, add required properties to it and initialize expectations.
449 Handle<Map> initial_map = Map::Create(isolate, 0); 449 Handle<Map> initial_map = Map::Create(isolate, 0);
450 Handle<Map> map = initial_map; 450 Handle<Map> map = initial_map;
451 map = expectations.AddAccessorConstant(map, NONE, pair); 451 map = expectations.AddAccessorConstant(map, NONE, pair);
452 452
453 CHECK(!map->is_deprecated()); 453 CHECK(!map->is_deprecated());
454 CHECK(map->is_stable()); 454 CHECK(map->is_stable());
455 CHECK(expectations.Check(*map)); 455 CHECK(expectations.Check(*map));
456 456
457 Handle<Map> new_map = Map::ReconfigureProperty( 457 Handle<Map> new_map = Map::ReconfigureProperty(
458 map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD); 458 map, 0, kData, NONE, Representation::None(), none_type);
459 // |map| did not change except marked unstable. 459 // |map| did not change except marked unstable.
460 CHECK(!map->is_deprecated()); 460 CHECK(!map->is_deprecated());
461 CHECK(!map->is_stable()); 461 CHECK(!map->is_stable());
462 CHECK(expectations.Check(*map)); 462 CHECK(expectations.Check(*map));
463 463
464 expectations.SetDataField(0, NONE, Representation::None(), none_type); 464 expectations.SetDataField(0, NONE, Representation::None(), none_type);
465 465
466 CHECK(!new_map->is_deprecated()); 466 CHECK(!new_map->is_deprecated());
467 CHECK(new_map->is_stable()); 467 CHECK(new_map->is_stable());
468 CHECK(expectations.Check(*new_map)); 468 CHECK(expectations.Check(*new_map));
469 469
470 Handle<Map> new_map2 = Map::ReconfigureProperty( 470 Handle<Map> new_map2 = Map::ReconfigureProperty(
471 map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD); 471 map, 0, kData, NONE, Representation::None(), none_type);
472 CHECK_EQ(*new_map, *new_map2); 472 CHECK_EQ(*new_map, *new_map2);
473 473
474 Handle<Object> value(Smi::kZero, isolate); 474 Handle<Object> value(Smi::kZero, isolate);
475 Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value); 475 Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value);
476 // None to Smi generalization is trivial, map does not change. 476 // None to Smi generalization is trivial, map does not change.
477 CHECK_EQ(*new_map, *prepared_map); 477 CHECK_EQ(*new_map, *prepared_map);
478 478
479 expectations.SetDataField(0, NONE, Representation::Smi(), any_type); 479 expectations.SetDataField(0, NONE, Representation::Smi(), any_type);
480 CHECK(prepared_map->is_stable()); 480 CHECK(prepared_map->is_stable());
481 CHECK(expectations.Check(*prepared_map)); 481 CHECK(expectations.Check(*prepared_map));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 585 }
586 CHECK(!map->is_deprecated()); 586 CHECK(!map->is_deprecated());
587 CHECK(map->is_stable()); 587 CHECK(map->is_stable());
588 CHECK(expectations.Check(*map)); 588 CHECK(expectations.Check(*map));
589 589
590 Zone zone(isolate->allocator(), ZONE_NAME); 590 Zone zone(isolate->allocator(), ZONE_NAME);
591 591
592 if (is_detached_map) { 592 if (is_detached_map) {
593 detach_point_map = Map::ReconfigureProperty( 593 detach_point_map = Map::ReconfigureProperty(
594 detach_point_map, detach_property_at_index, kData, NONE, 594 detach_point_map, detach_property_at_index, kData, NONE,
595 Representation::Tagged(), any_type, FORCE_FIELD); 595 Representation::Tagged(), any_type);
596 expectations.SetDataField(detach_property_at_index, 596 expectations.SetDataField(detach_property_at_index,
597 Representation::Tagged(), any_type); 597 Representation::Tagged(), any_type);
598 CHECK(map->is_deprecated()); 598 CHECK(map->is_deprecated());
599 CHECK(expectations.Check(*detach_point_map, 599 CHECK(expectations.Check(*detach_point_map,
600 detach_point_map->NumberOfOwnDescriptors())); 600 detach_point_map->NumberOfOwnDescriptors()));
601 } 601 }
602 602
603 // Create new maps by generalizing representation of propX field. 603 // Create new maps by generalizing representation of propX field.
604 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); 604 Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate);
605 CompilationDependencies dependencies(isolate, &zone); 605 CompilationDependencies dependencies(isolate, &zone);
606 CHECK(!dependencies.HasAborted()); 606 CHECK(!dependencies.HasAborted());
607 607
608 dependencies.AssumeFieldOwner(field_owner); 608 dependencies.AssumeFieldOwner(field_owner);
609 609
610 Handle<Map> new_map = 610 Handle<Map> new_map = Map::ReconfigureProperty(
611 Map::ReconfigureProperty(map, property_index, kData, NONE, 611 map, property_index, kData, NONE, to_representation, to_type);
612 to_representation, to_type, FORCE_FIELD);
613 612
614 expectations.SetDataField(property_index, expected_representation, 613 expectations.SetDataField(property_index, expected_representation,
615 expected_type); 614 expected_type);
616 615
617 CHECK(!new_map->is_deprecated()); 616 CHECK(!new_map->is_deprecated());
618 CHECK(expectations.Check(*new_map)); 617 CHECK(expectations.Check(*new_map));
619 618
620 if (is_detached_map) { 619 if (is_detached_map) {
621 CHECK(!map->is_stable()); 620 CHECK(!map->is_stable());
622 CHECK(map->is_deprecated()); 621 CHECK(map->is_deprecated());
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 892
894 // Create new maps by generalizing representation of propX field. 893 // Create new maps by generalizing representation of propX field.
895 Handle<Map> maps[kPropCount]; 894 Handle<Map> maps[kPropCount];
896 for (int i = 0; i < kPropCount; i++) { 895 for (int i = 0; i < kPropCount; i++) {
897 if (i == kAccessorProp) { 896 if (i == kAccessorProp) {
898 // Skip accessor property reconfiguration. 897 // Skip accessor property reconfiguration.
899 maps[i] = maps[i - 1]; 898 maps[i] = maps[i - 1];
900 continue; 899 continue;
901 } 900 }
902 Handle<Map> new_map = Map::ReconfigureProperty( 901 Handle<Map> new_map = Map::ReconfigureProperty(
903 map, i, kData, NONE, Representation::Double(), any_type, FORCE_FIELD); 902 map, i, kData, NONE, Representation::Double(), any_type);
904 maps[i] = new_map; 903 maps[i] = new_map;
905 904
906 expectations.SetDataField(i, Representation::Double(), any_type); 905 expectations.SetDataField(i, Representation::Double(), any_type);
907 906
908 CHECK(!map->is_stable()); 907 CHECK(!map->is_stable());
909 CHECK(map->is_deprecated()); 908 CHECK(map->is_deprecated());
910 CHECK_NE(*map, *new_map); 909 CHECK_NE(*map, *new_map);
911 CHECK(i == 0 || maps[i - 1]->is_deprecated()); 910 CHECK(i == 0 || maps[i - 1]->is_deprecated());
912 911
913 CHECK(!new_map->is_deprecated()); 912 CHECK(!new_map->is_deprecated());
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 } 1846 }
1848 1847
1849 Handle<String> name = MakeName("prop", i); 1848 Handle<String> name = MakeName("prop", i);
1850 Map* target = 1849 Map* target =
1851 TransitionArray::SearchTransition(*map2, kData, *name, NONE); 1850 TransitionArray::SearchTransition(*map2, kData, *name, NONE);
1852 CHECK(target != NULL); 1851 CHECK(target != NULL);
1853 map2 = handle(target); 1852 map2 = handle(target);
1854 } 1853 }
1855 1854
1856 map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE, 1855 map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE,
1857 Representation::Double(), any_type, 1856 Representation::Double(), any_type);
1858 FORCE_FIELD);
1859 expectations.SetDataField(kSplitProp, Representation::Double(), any_type); 1857 expectations.SetDataField(kSplitProp, Representation::Double(), any_type);
1860 1858
1861 CHECK(expectations.Check(*split_map, kSplitProp)); 1859 CHECK(expectations.Check(*split_map, kSplitProp));
1862 CHECK(expectations.Check(*map2, kSplitProp + 1)); 1860 CHECK(expectations.Check(*map2, kSplitProp + 1));
1863 } 1861 }
1864 1862
1865 // At this point |map| should be deprecated and disconnected from the 1863 // At this point |map| should be deprecated and disconnected from the
1866 // transition tree. 1864 // transition tree.
1867 CHECK(map->is_deprecated()); 1865 CHECK(map->is_deprecated());
1868 CHECK(!split_map->is_deprecated()); 1866 CHECK(!split_map->is_deprecated());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 } 1945 }
1948 } 1946 }
1949 1947
1950 CHECK(!map2->is_deprecated()); 1948 CHECK(!map2->is_deprecated());
1951 CHECK(map2->is_stable()); 1949 CHECK(map2->is_stable());
1952 CHECK(expectations2.Check(*map2)); 1950 CHECK(expectations2.Check(*map2));
1953 1951
1954 // Create new maps by generalizing representation of propX field. 1952 // Create new maps by generalizing representation of propX field.
1955 Handle<Map> maps[kPropCount]; 1953 Handle<Map> maps[kPropCount];
1956 for (int i = 0; i < kPropCount; i++) { 1954 for (int i = 0; i < kPropCount; i++) {
1957 Handle<Map> new_map = Map::ReconfigureProperty( 1955 Handle<Map> new_map = Map::ReconfigureProperty(map, i, kData, NONE,
1958 map, i, kData, NONE, to_representation, to_type, FORCE_FIELD); 1956 to_representation, to_type);
1959 maps[i] = new_map; 1957 maps[i] = new_map;
1960 1958
1961 expectations.SetDataField(i, expected_representation, expected_type); 1959 expectations.SetDataField(i, expected_representation, expected_type);
1962 1960
1963 CHECK(map->is_deprecated()); 1961 CHECK(map->is_deprecated());
1964 CHECK_NE(*map, *new_map); 1962 CHECK_NE(*map, *new_map);
1965 CHECK(i == 0 || maps[i - 1]->is_deprecated()); 1963 CHECK(i == 0 || maps[i - 1]->is_deprecated());
1966 CHECK(expectations.Check(*new_map)); 1964 CHECK(expectations.Check(*new_map));
1967 1965
1968 Handle<Map> new_map2 = Map::Update(map2); 1966 Handle<Map> new_map2 = Map::Update(map2);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 Isolate* isolate = CcTest::i_isolate(); 2429 Isolate* isolate = CcTest::i_isolate();
2432 2430
2433 Zone zone(isolate->allocator(), ZONE_NAME); 2431 Zone zone(isolate->allocator(), ZONE_NAME);
2434 2432
2435 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); 2433 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal());
2436 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); 2434 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None());
2437 } 2435 }
2438 2436
2439 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. 2437 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
2440 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) 2438 // TEST(TransitionAccessorConstantToAnotherAccessorConstant)
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698