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

Unified Diff: test/cctest/test-unboxed-doubles.cc

Issue 1520613006: During property reconfiguring ensure that the first map that gets new descriptors is the one that o… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-unboxed-doubles.cc
diff --git a/test/cctest/test-unboxed-doubles.cc b/test/cctest/test-unboxed-doubles.cc
index 65e4b6e34efa4322828f8190b3a39bfccebb30a6..7125f632d971cc3319c9146ac1a7a62a7a28ada0 100644
--- a/test/cctest/test-unboxed-doubles.cc
+++ b/test/cctest/test-unboxed-doubles.cc
@@ -741,22 +741,39 @@ TEST(LayoutDescriptorAppendAllDoubles) {
static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull(
Isolate* isolate, int inobject_properties,
Handle<DescriptorArray> descriptors, int number_of_descriptors) {
- Handle<Map> map = Map::Create(isolate, inobject_properties);
+ Handle<Map> initial_map = Map::Create(isolate, inobject_properties);
Handle<LayoutDescriptor> full_layout_descriptor = LayoutDescriptor::New(
- map, descriptors, descriptors->number_of_descriptors());
+ initial_map, descriptors, descriptors->number_of_descriptors());
int nof = 0;
bool switched_to_slow_mode = false;
- for (int i = 0; i < number_of_descriptors; i++) {
- PropertyDetails details = descriptors->GetDetails(i);
+ // This method calls LayoutDescriptor::AppendIfFastOrUseFull() internally
+ // and does all the required map-descriptors related book keeping.
+ Handle<Map> last_map = Map::AddMissingTransitionsForTesting(
+ initial_map, descriptors, full_layout_descriptor);
- // This method calls LayoutDescriptor::AppendIfFastOrUseFull() internally
- // and does all the required map-descriptors related book keeping.
- map = Map::CopyInstallDescriptorsForTesting(map, i, descriptors,
- full_layout_descriptor);
+ // Follow back pointers to construct a sequence of maps from |map|
+ // to |last_map|.
+ int descriptors_length = descriptors->number_of_descriptors();
+ std::vector<Handle<Map>> maps(descriptors_length);
+ {
+ Map* map = *last_map;
+ for (int i = 0; i < descriptors_length; i++) {
+ maps[descriptors_length - 1 - i] = handle(map, isolate);
+ Object* maybe_map = map->GetBackPointer();
+ CHECK(maybe_map->IsMap());
+ map = Map::cast(maybe_map);
+ }
+ CHECK_EQ(1, maps[0]->NumberOfOwnDescriptors());
+ }
+ Handle<Map> map;
+ // Now check layout descriptors of all intermediate maps.
+ for (int i = 0; i < number_of_descriptors; i++) {
+ PropertyDetails details = descriptors->GetDetails(i);
+ map = maps[i];
LayoutDescriptor* layout_desc = map->layout_descriptor();
if (layout_desc->IsSlowLayout()) {
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698