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

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

Issue 982143002: Revert of Simplify and compact transitions storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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-heap.cc ('k') | test/cctest/test-transitions.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 "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 Handle<Map> FollowDataTransition(Handle<Map> map, 336 Handle<Map> FollowDataTransition(Handle<Map> map,
337 PropertyAttributes attributes, 337 PropertyAttributes attributes,
338 Representation representation, 338 Representation representation,
339 Handle<HeapType> heap_type) { 339 Handle<HeapType> heap_type) {
340 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); 340 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors());
341 int property_index = number_of_properties_++; 341 int property_index = number_of_properties_++;
342 SetDataField(property_index, attributes, representation, heap_type); 342 SetDataField(property_index, attributes, representation, heap_type);
343 343
344 Handle<String> name = MakeName("prop", property_index); 344 Handle<String> name = MakeName("prop", property_index);
345 Map* target = 345 int t = map->SearchTransition(kData, *name, attributes);
346 TransitionArray::SearchTransition(*map, kData, *name, attributes); 346 CHECK_NE(TransitionArray::kNotFound, t);
347 CHECK(target != NULL); 347 return handle(map->GetTransition(t));
348 return handle(target);
349 } 348 }
350 349
351 Handle<Map> AddAccessorConstant(Handle<Map> map, 350 Handle<Map> AddAccessorConstant(Handle<Map> map,
352 PropertyAttributes attributes, 351 PropertyAttributes attributes,
353 Handle<AccessorPair> pair) { 352 Handle<AccessorPair> pair) {
354 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); 353 CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors());
355 int property_index = number_of_properties_++; 354 int property_index = number_of_properties_++;
356 SetAccessorConstant(property_index, attributes, pair); 355 SetAccessorConstant(property_index, attributes, pair);
357 356
358 Handle<String> name = MakeName("prop", property_index); 357 Handle<String> name = MakeName("prop", property_index);
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 const int kSplitProp = kPropCount / 2; 1470 const int kSplitProp = kPropCount / 2;
1472 Handle<Map> split_map; 1471 Handle<Map> split_map;
1473 Handle<Map> map2 = initial_map; 1472 Handle<Map> map2 = initial_map;
1474 { 1473 {
1475 for (int i = 0; i < kSplitProp + 1; i++) { 1474 for (int i = 0; i < kSplitProp + 1; i++) {
1476 if (i == kSplitProp) { 1475 if (i == kSplitProp) {
1477 split_map = map2; 1476 split_map = map2;
1478 } 1477 }
1479 1478
1480 Handle<String> name = MakeName("prop", i); 1479 Handle<String> name = MakeName("prop", i);
1481 Map* target = 1480 int t = map2->SearchTransition(kData, *name, NONE);
1482 TransitionArray::SearchTransition(*map2, kData, *name, NONE); 1481 CHECK_NE(TransitionArray::kNotFound, t);
1483 CHECK(target != NULL); 1482 map2 = handle(map2->GetTransition(t));
1484 map2 = handle(target);
1485 } 1483 }
1486 1484
1487 map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE, 1485 map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE,
1488 Representation::Double(), any_type, 1486 Representation::Double(), any_type,
1489 FORCE_FIELD); 1487 FORCE_FIELD);
1490 expectations.SetDataField(kSplitProp, Representation::Double(), any_type); 1488 expectations.SetDataField(kSplitProp, Representation::Double(), any_type);
1491 1489
1492 CHECK(expectations.Check(*split_map, kSplitProp)); 1490 CHECK(expectations.Check(*split_map, kSplitProp));
1493 CHECK(expectations.Check(*map2, kSplitProp + 1)); 1491 CHECK(expectations.Check(*map2, kSplitProp + 1));
1494 } 1492 }
1495 1493
1496 // At this point |map| should be deprecated and disconnected from the 1494 // At this point |map| should be deprecated and disconnected from the
1497 // transition tree. 1495 // transition tree.
1498 CHECK(map->is_deprecated()); 1496 CHECK(map->is_deprecated());
1499 CHECK(!split_map->is_deprecated()); 1497 CHECK(!split_map->is_deprecated());
1500 CHECK(!map2->is_deprecated()); 1498 CHECK(!map2->is_deprecated());
1501 1499
1502 // Fill in transition tree of |map2| so that it can't have more transitions. 1500 // Fill in transition tree of |map2| so that it can't have more transitions.
1503 for (int i = 0; i < TransitionArray::kMaxNumberOfTransitions; i++) { 1501 for (int i = 0; i < TransitionArray::kMaxNumberOfTransitions; i++) {
1504 CHECK(TransitionArray::CanHaveMoreTransitions(map2)); 1502 CHECK(map2->CanHaveMoreTransitions());
1505 Handle<String> name = MakeName("foo", i); 1503 Handle<String> name = MakeName("foo", i);
1506 Map::CopyWithField(map2, name, any_type, NONE, Representation::Smi(), 1504 Map::CopyWithField(map2, name, any_type, NONE, Representation::Smi(),
1507 INSERT_TRANSITION).ToHandleChecked(); 1505 INSERT_TRANSITION).ToHandleChecked();
1508 } 1506 }
1509 CHECK(!TransitionArray::CanHaveMoreTransitions(map2)); 1507 CHECK(!map2->CanHaveMoreTransitions());
1510 1508
1511 // Try to update |map|, since there is no place for propX transition at |map2| 1509 // Try to update |map|, since there is no place for propX transition at |map2|
1512 // |map| should become "copy-generalized". 1510 // |map| should become "copy-generalized".
1513 Handle<Map> updated_map = Map::Update(map); 1511 Handle<Map> updated_map = Map::Update(map);
1514 CHECK(updated_map->GetBackPointer()->IsUndefined()); 1512 CHECK(updated_map->GetBackPointer()->IsUndefined());
1515 1513
1516 for (int i = 0; i < kPropCount; i++) { 1514 for (int i = 0; i < kPropCount; i++) {
1517 expectations.SetDataField(i, Representation::Tagged(), any_type); 1515 expectations.SetDataField(i, Representation::Tagged(), any_type);
1518 } 1516 }
1519 CHECK(expectations.Check(*updated_map)); 1517 CHECK(expectations.Check(*updated_map));
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 Handle<AccessorPair> pair = CreateAccessorPair(true, true); 2077 Handle<AccessorPair> pair = CreateAccessorPair(true, true);
2080 TransitionToAccessorConstantOperator transition_op(pair); 2078 TransitionToAccessorConstantOperator transition_op(pair);
2081 2079
2082 SameMapChecker checker; 2080 SameMapChecker checker;
2083 TestTransitionTo(transition_op, transition_op, checker); 2081 TestTransitionTo(transition_op, transition_op, checker);
2084 } 2082 }
2085 2083
2086 2084
2087 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. 2085 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
2088 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) 2086 // TEST(TransitionAccessorConstantToAnotherAccessorConstant)
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698