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

Side by Side Diff: test/cctest/test-unboxed-doubles.cc

Issue 856503002: Massive renaming of PropertyType values and other implied stuff. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Spurious file addition fixed Created 5 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 | « test/cctest/test-transitions.cc ('k') | test/mjsunit/mirror-object.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 int next_field_offset = 0; 61 int next_field_offset = 0;
62 for (int i = 0; i < kPropsCount; i++) { 62 for (int i = 0; i < kPropsCount; i++) {
63 EmbeddedVector<char, 64> buffer; 63 EmbeddedVector<char, 64> buffer;
64 SNPrintF(buffer, "prop%d", i); 64 SNPrintF(buffer, "prop%d", i);
65 Handle<String> name = factory->InternalizeUtf8String(buffer.start()); 65 Handle<String> name = factory->InternalizeUtf8String(buffer.start());
66 66
67 TestPropertyKind kind = props[i]; 67 TestPropertyKind kind = props[i];
68 68
69 if (kind == PROP_CONSTANT) { 69 if (kind == PROP_CONSTANT) {
70 ConstantDescriptor d(name, func, NONE); 70 DataConstantDescriptor d(name, func, NONE);
71 descriptors->Append(&d); 71 descriptors->Append(&d);
72 72
73 } else { 73 } else {
74 FieldDescriptor f(name, next_field_offset, NONE, representations[kind]); 74 DataDescriptor f(name, next_field_offset, NONE, representations[kind]);
75 next_field_offset += f.GetDetails().field_width_in_words(); 75 next_field_offset += f.GetDetails().field_width_in_words();
76 descriptors->Append(&f); 76 descriptors->Append(&f);
77 } 77 }
78 } 78 }
79 return descriptors; 79 return descriptors;
80 } 80 }
81 81
82 82
83 TEST(LayoutDescriptorBasicFast) { 83 TEST(LayoutDescriptorBasicFast) {
84 CcTest::InitializeVM(); 84 CcTest::InitializeVM();
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 DCHECK(layout_descriptor->IsConsistentWithMap(*map)); 534 DCHECK(layout_descriptor->IsConsistentWithMap(*map));
535 } 535 }
536 536
537 { 537 {
538 int inobject_properties = kPropsCount / 2; 538 int inobject_properties = kPropsCount / 2;
539 Handle<Map> map = Map::Create(isolate, inobject_properties); 539 Handle<Map> map = Map::Create(isolate, inobject_properties);
540 layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount); 540 layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount);
541 CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor); 541 CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor);
542 CHECK(layout_descriptor->IsSlowLayout()); 542 CHECK(layout_descriptor->IsSlowLayout());
543 for (int i = 0; i < inobject_properties; i++) { 543 for (int i = 0; i < inobject_properties; i++) {
544 // PROP_DOUBLE has index 1 among FIELD properties. 544 // PROP_DOUBLE has index 1 among DATA properties.
545 const bool tagged = (i % (PROP_KIND_NUMBER - 1)) != 1; 545 const bool tagged = (i % (PROP_KIND_NUMBER - 1)) != 1;
546 CHECK_EQ(tagged, layout_descriptor->IsTagged(i)); 546 CHECK_EQ(tagged, layout_descriptor->IsTagged(i));
547 } 547 }
548 // Every property after inobject_properties must be tagged. 548 // Every property after inobject_properties must be tagged.
549 for (int i = inobject_properties; i < kPropsCount; i++) { 549 for (int i = inobject_properties; i < kPropsCount; i++) {
550 CHECK_EQ(true, layout_descriptor->IsTagged(i)); 550 CHECK_EQ(true, layout_descriptor->IsTagged(i));
551 } 551 }
552 map->InitializeDescriptors(*descriptors, *layout_descriptor); 552 map->InitializeDescriptors(*descriptors, *layout_descriptor);
553 DCHECK(layout_descriptor->IsConsistentWithMap(*map)); 553 DCHECK(layout_descriptor->IsConsistentWithMap(*map));
554 554
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 int next_field_offset = 0; 594 int next_field_offset = 0;
595 for (int i = 0; i < kPropsCount; i++) { 595 for (int i = 0; i < kPropsCount; i++) {
596 EmbeddedVector<char, 64> buffer; 596 EmbeddedVector<char, 64> buffer;
597 SNPrintF(buffer, "prop%d", i); 597 SNPrintF(buffer, "prop%d", i);
598 Handle<String> name = factory->InternalizeUtf8String(buffer.start()); 598 Handle<String> name = factory->InternalizeUtf8String(buffer.start());
599 599
600 Handle<LayoutDescriptor> layout_descriptor; 600 Handle<LayoutDescriptor> layout_descriptor;
601 TestPropertyKind kind = props[i]; 601 TestPropertyKind kind = props[i];
602 if (kind == PROP_CONSTANT) { 602 if (kind == PROP_CONSTANT) {
603 ConstantDescriptor d(name, func, NONE); 603 DataConstantDescriptor d(name, func, NONE);
604 layout_descriptor = LayoutDescriptor::Append(map, d.GetDetails()); 604 layout_descriptor = LayoutDescriptor::Append(map, d.GetDetails());
605 descriptors->Append(&d); 605 descriptors->Append(&d);
606 606
607 } else { 607 } else {
608 FieldDescriptor f(name, next_field_offset, NONE, representations[kind]); 608 DataDescriptor f(name, next_field_offset, NONE, representations[kind]);
609 int field_width_in_words = f.GetDetails().field_width_in_words(); 609 int field_width_in_words = f.GetDetails().field_width_in_words();
610 next_field_offset += field_width_in_words; 610 next_field_offset += field_width_in_words;
611 layout_descriptor = LayoutDescriptor::Append(map, f.GetDetails()); 611 layout_descriptor = LayoutDescriptor::Append(map, f.GetDetails());
612 descriptors->Append(&f); 612 descriptors->Append(&f);
613 613
614 int field_index = f.GetDetails().field_index(); 614 int field_index = f.GetDetails().field_index();
615 bool is_inobject = field_index < map->inobject_properties(); 615 bool is_inobject = field_index < map->inobject_properties();
616 for (int bit = 0; bit < field_width_in_words; bit++) { 616 for (int bit = 0; bit < field_width_in_words; bit++) {
617 CHECK_EQ(is_inobject && (kind == PROP_DOUBLE), 617 CHECK_EQ(is_inobject && (kind == PROP_DOUBLE),
618 !layout_descriptor->IsTagged(field_index + bit)); 618 !layout_descriptor->IsTagged(field_index + bit));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 map = Map::CopyInstallDescriptorsForTesting(map, i, descriptors, 729 map = Map::CopyInstallDescriptorsForTesting(map, i, descriptors,
730 full_layout_descriptor); 730 full_layout_descriptor);
731 731
732 LayoutDescriptor* layout_desc = map->layout_descriptor(); 732 LayoutDescriptor* layout_desc = map->layout_descriptor();
733 733
734 if (layout_desc->IsSlowLayout()) { 734 if (layout_desc->IsSlowLayout()) {
735 switched_to_slow_mode = true; 735 switched_to_slow_mode = true;
736 CHECK_EQ(*full_layout_descriptor, layout_desc); 736 CHECK_EQ(*full_layout_descriptor, layout_desc);
737 } else { 737 } else {
738 CHECK(!switched_to_slow_mode); 738 CHECK(!switched_to_slow_mode);
739 if (details.type() == FIELD) { 739 if (details.type() == DATA) {
740 nof++; 740 nof++;
741 int field_index = details.field_index(); 741 int field_index = details.field_index();
742 int field_width_in_words = details.field_width_in_words(); 742 int field_width_in_words = details.field_width_in_words();
743 743
744 bool is_inobject = field_index < map->inobject_properties(); 744 bool is_inobject = field_index < map->inobject_properties();
745 for (int bit = 0; bit < field_width_in_words; bit++) { 745 for (int bit = 0; bit < field_width_in_words; bit++) {
746 CHECK_EQ(is_inobject && details.representation().IsDouble(), 746 CHECK_EQ(is_inobject && details.representation().IsDouble(),
747 !layout_desc->IsTagged(field_index + bit)); 747 !layout_desc->IsTagged(field_index + bit));
748 } 748 }
749 CHECK(layout_desc->IsTagged(field_index + field_width_in_words)); 749 CHECK(layout_desc->IsTagged(field_index + field_width_in_words));
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 964
965 LayoutDescriptorHelper helper(*map); 965 LayoutDescriptorHelper helper(*map);
966 bool all_fields_tagged = true; 966 bool all_fields_tagged = true;
967 967
968 int instance_size = map->instance_size(); 968 int instance_size = map->instance_size();
969 969
970 int end_offset = instance_size * 2; 970 int end_offset = instance_size * 2;
971 int first_non_tagged_field_offset = end_offset; 971 int first_non_tagged_field_offset = end_offset;
972 for (int i = 0; i < number_of_descriptors; i++) { 972 for (int i = 0; i < number_of_descriptors; i++) {
973 PropertyDetails details = descriptors->GetDetails(i); 973 PropertyDetails details = descriptors->GetDetails(i);
974 if (details.type() != FIELD) continue; 974 if (details.type() != DATA) continue;
975 FieldIndex index = FieldIndex::ForDescriptor(*map, i); 975 FieldIndex index = FieldIndex::ForDescriptor(*map, i);
976 if (!index.is_inobject()) continue; 976 if (!index.is_inobject()) continue;
977 all_fields_tagged &= !details.representation().IsDouble(); 977 all_fields_tagged &= !details.representation().IsDouble();
978 bool expected_tagged = !index.is_double(); 978 bool expected_tagged = !index.is_double();
979 if (!expected_tagged) { 979 if (!expected_tagged) {
980 first_non_tagged_field_offset = 980 first_non_tagged_field_offset =
981 Min(first_non_tagged_field_offset, index.offset()); 981 Min(first_non_tagged_field_offset, index.offset());
982 } 982 }
983 983
984 int end_of_region_offset; 984 int end_of_region_offset;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 1153 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
1154 chunk->set_scan_on_scavenge(true); 1154 chunk->set_scan_on_scavenge(true);
1155 1155
1156 // Trigger GCs and force evacuation. Should not crash there. 1156 // Trigger GCs and force evacuation. Should not crash there.
1157 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 1157 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
1158 1158
1159 CHECK_EQ(boom_value, GetDoubleFieldValue(*obj, field_index)); 1159 CHECK_EQ(boom_value, GetDoubleFieldValue(*obj, field_index));
1160 } 1160 }
1161 1161
1162 #endif 1162 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-transitions.cc ('k') | test/mjsunit/mirror-object.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698