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

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

Issue 2060213002: Revert of Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « test/cctest/test-dictionary.cc ('k') | test/cctest/test-strings.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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 Handle<Map> AddAccessorConstant(Handle<Map> map, 381 Handle<Map> AddAccessorConstant(Handle<Map> map,
382 PropertyAttributes attributes, 382 PropertyAttributes attributes,
383 Handle<Object> getter, 383 Handle<Object> getter,
384 Handle<Object> setter) { 384 Handle<Object> setter) {
385 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); 385 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors());
386 int property_index = number_of_properties_++; 386 int property_index = number_of_properties_++;
387 SetAccessorConstant(property_index, attributes, getter, setter); 387 SetAccessorConstant(property_index, attributes, getter, setter);
388 388
389 Handle<String> name = MakeName("prop", property_index); 389 Handle<String> name = MakeName("prop", property_index);
390 390
391 CHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_)); 391 CHECK(!getter->IsNull() || !setter->IsNull());
392 Factory* factory = isolate_->factory(); 392 Factory* factory = isolate_->factory();
393 393
394 if (!getter->IsNull(isolate_)) { 394 if (!getter->IsNull()) {
395 Handle<AccessorPair> pair = factory->NewAccessorPair(); 395 Handle<AccessorPair> pair = factory->NewAccessorPair();
396 pair->SetComponents(*getter, *factory->null_value()); 396 pair->SetComponents(*getter, *factory->null_value());
397 AccessorConstantDescriptor new_desc(name, pair, attributes); 397 AccessorConstantDescriptor new_desc(name, pair, attributes);
398 map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); 398 map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION);
399 } 399 }
400 if (!setter->IsNull(isolate_)) { 400 if (!setter->IsNull()) {
401 Handle<AccessorPair> pair = factory->NewAccessorPair(); 401 Handle<AccessorPair> pair = factory->NewAccessorPair();
402 pair->SetComponents(*getter, *setter); 402 pair->SetComponents(*getter, *setter);
403 AccessorConstantDescriptor new_desc(name, pair, attributes); 403 AccessorConstantDescriptor new_desc(name, pair, attributes);
404 map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); 404 map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION);
405 } 405 }
406 return map; 406 return map;
407 } 407 }
408 408
409 Handle<Map> TransitionToAccessorConstant(Handle<Map> map, 409 Handle<Map> TransitionToAccessorConstant(Handle<Map> map,
410 PropertyAttributes attributes, 410 PropertyAttributes attributes,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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));
482 482
483 // Now create an object with |map|, migrate it to |prepared_map| and ensure 483 // Now create an object with |map|, migrate it to |prepared_map| and ensure
484 // that the data property is uninitialized. 484 // that the data property is uninitialized.
485 Factory* factory = isolate->factory(); 485 Factory* factory = isolate->factory();
486 Handle<JSObject> obj = factory->NewJSObjectFromMap(map); 486 Handle<JSObject> obj = factory->NewJSObjectFromMap(map);
487 JSObject::MigrateToMap(obj, prepared_map); 487 JSObject::MigrateToMap(obj, prepared_map);
488 FieldIndex index = FieldIndex::ForDescriptor(*prepared_map, 0); 488 FieldIndex index = FieldIndex::ForDescriptor(*prepared_map, 0);
489 CHECK(obj->RawFastPropertyAt(index)->IsUninitialized(isolate)); 489 CHECK(obj->RawFastPropertyAt(index)->IsUninitialized());
490 #ifdef VERIFY_HEAP 490 #ifdef VERIFY_HEAP
491 obj->ObjectVerify(); 491 obj->ObjectVerify();
492 #endif 492 #endif
493 } 493 }
494 494
495 495
496 // This test checks that the LookupIterator machinery involved in 496 // This test checks that the LookupIterator machinery involved in
497 // JSObject::SetOwnPropertyIgnoreAttributes() does not try to migrate object 497 // JSObject::SetOwnPropertyIgnoreAttributes() does not try to migrate object
498 // to a map with a property with None representation. 498 // to a map with a property with None representation.
499 TEST(ReconfigureAccessorToNonExistingDataFieldHeavy) { 499 TEST(ReconfigureAccessorToNonExistingDataFieldHeavy) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 CHECK_EQ(*map, *new_map); 637 CHECK_EQ(*map, *new_map);
638 638
639 CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); 639 CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted());
640 } 640 }
641 641
642 { 642 {
643 // Check that all previous maps are not stable. 643 // Check that all previous maps are not stable.
644 Map* tmp = *new_map; 644 Map* tmp = *new_map;
645 while (true) { 645 while (true) {
646 Object* back = tmp->GetBackPointer(); 646 Object* back = tmp->GetBackPointer();
647 if (back->IsUndefined(isolate)) break; 647 if (back->IsUndefined()) break;
648 tmp = Map::cast(back); 648 tmp = Map::cast(back);
649 CHECK(!tmp->is_stable()); 649 CHECK(!tmp->is_stable());
650 } 650 }
651 } 651 }
652 652
653 info.dependencies()->Rollback(); // Properly cleanup compilation info. 653 info.dependencies()->Rollback(); // Properly cleanup compilation info.
654 654
655 // Update all deprecated maps and check that they are now the same. 655 // Update all deprecated maps and check that they are now the same.
656 Handle<Map> updated_map = Map::Update(map); 656 Handle<Map> updated_map = Map::Update(map);
657 CHECK_EQ(*new_map, *updated_map); 657 CHECK_EQ(*new_map, *updated_map);
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 }; 1235 };
1236 1236
1237 1237
1238 // Checks that given |map| is NOT deprecated, and |new_map| is a result of 1238 // Checks that given |map| is NOT deprecated, and |new_map| is a result of
1239 // copy-generalize-all-representations. 1239 // copy-generalize-all-representations.
1240 struct CheckCopyGeneralizeAllRepresentations { 1240 struct CheckCopyGeneralizeAllRepresentations {
1241 void Check(Handle<Map> map, Handle<Map> new_map, Expectations& expectations) { 1241 void Check(Handle<Map> map, Handle<Map> new_map, Expectations& expectations) {
1242 CHECK(!map->is_deprecated()); 1242 CHECK(!map->is_deprecated());
1243 CHECK_NE(*map, *new_map); 1243 CHECK_NE(*map, *new_map);
1244 1244
1245 CHECK(new_map->GetBackPointer()->IsUndefined(map->GetIsolate())); 1245 CHECK(new_map->GetBackPointer()->IsUndefined());
1246 for (int i = 0; i < kPropCount; i++) { 1246 for (int i = 0; i < kPropCount; i++) {
1247 expectations.GeneralizeRepresentation(i); 1247 expectations.GeneralizeRepresentation(i);
1248 } 1248 }
1249 1249
1250 CHECK(!new_map->is_deprecated()); 1250 CHECK(!new_map->is_deprecated());
1251 CHECK(expectations.Check(*new_map)); 1251 CHECK(expectations.Check(*new_map));
1252 } 1252 }
1253 }; 1253 };
1254 1254
1255 1255
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 Handle<String> name = MakeName("foo", i); 1866 Handle<String> name = MakeName("foo", i);
1867 Map::CopyWithField(map2, name, any_type, NONE, Representation::Smi(), 1867 Map::CopyWithField(map2, name, any_type, NONE, Representation::Smi(),
1868 INSERT_TRANSITION) 1868 INSERT_TRANSITION)
1869 .ToHandleChecked(); 1869 .ToHandleChecked();
1870 } 1870 }
1871 CHECK(!TransitionArray::CanHaveMoreTransitions(map2)); 1871 CHECK(!TransitionArray::CanHaveMoreTransitions(map2));
1872 1872
1873 // Try to update |map|, since there is no place for propX transition at |map2| 1873 // Try to update |map|, since there is no place for propX transition at |map2|
1874 // |map| should become "copy-generalized". 1874 // |map| should become "copy-generalized".
1875 Handle<Map> updated_map = Map::Update(map); 1875 Handle<Map> updated_map = Map::Update(map);
1876 CHECK(updated_map->GetBackPointer()->IsUndefined(isolate)); 1876 CHECK(updated_map->GetBackPointer()->IsUndefined());
1877 1877
1878 for (int i = 0; i < kPropCount; i++) { 1878 for (int i = 0; i < kPropCount; i++) {
1879 expectations.SetDataField(i, Representation::Tagged(), any_type); 1879 expectations.SetDataField(i, Representation::Tagged(), any_type);
1880 } 1880 }
1881 CHECK(expectations.Check(*updated_map)); 1881 CHECK(expectations.Check(*updated_map));
1882 } 1882 }
1883 1883
1884 1884
1885 //////////////////////////////////////////////////////////////////////////////// 1885 ////////////////////////////////////////////////////////////////////////////////
1886 // A set of tests involving special transitions (such as elements kind 1886 // A set of tests involving special transitions (such as elements kind
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 // of Map::Update(). 1966 // of Map::Update().
1967 CHECK_EQ(*new_map2, *tmp_map); 1967 CHECK_EQ(*new_map2, *tmp_map);
1968 } 1968 }
1969 1969
1970 if (config.is_non_equevalent_transition()) { 1970 if (config.is_non_equevalent_transition()) {
1971 // In case of non-equivalent transition currently we generalize all 1971 // In case of non-equivalent transition currently we generalize all
1972 // representations. 1972 // representations.
1973 for (int i = 0; i < kPropCount; i++) { 1973 for (int i = 0; i < kPropCount; i++) {
1974 expectations2.GeneralizeRepresentation(i); 1974 expectations2.GeneralizeRepresentation(i);
1975 } 1975 }
1976 CHECK(new_map2->GetBackPointer()->IsUndefined(isolate)); 1976 CHECK(new_map2->GetBackPointer()->IsUndefined());
1977 CHECK(expectations2.Check(*new_map2)); 1977 CHECK(expectations2.Check(*new_map2));
1978 } else { 1978 } else {
1979 CHECK(!new_map2->GetBackPointer()->IsUndefined(isolate)); 1979 CHECK(!new_map2->GetBackPointer()->IsUndefined());
1980 CHECK(expectations2.Check(*new_map2)); 1980 CHECK(expectations2.Check(*new_map2));
1981 } 1981 }
1982 } 1982 }
1983 1983
1984 Handle<Map> active_map = maps[kPropCount - 1]; 1984 Handle<Map> active_map = maps[kPropCount - 1];
1985 CHECK(!active_map->is_deprecated()); 1985 CHECK(!active_map->is_deprecated());
1986 1986
1987 // Update all deprecated maps and check that they are now the same. 1987 // Update all deprecated maps and check that they are now the same.
1988 Handle<Map> updated_map = Map::Update(map); 1988 Handle<Map> updated_map = Map::Update(map);
1989 CHECK_EQ(*active_map, *updated_map); 1989 CHECK_EQ(*active_map, *updated_map);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 Handle<AccessorPair> pair = CreateAccessorPair(true, true); 2405 Handle<AccessorPair> pair = CreateAccessorPair(true, true);
2406 TransitionToAccessorConstantOperator transition_op(pair); 2406 TransitionToAccessorConstantOperator transition_op(pair);
2407 2407
2408 SameMapChecker checker; 2408 SameMapChecker checker;
2409 TestTransitionTo(transition_op, transition_op, checker); 2409 TestTransitionTo(transition_op, transition_op, checker);
2410 } 2410 }
2411 2411
2412 2412
2413 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. 2413 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
2414 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) 2414 // TEST(TransitionAccessorConstantToAnotherAccessorConstant)
OLDNEW
« no previous file with comments | « test/cctest/test-dictionary.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698