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

Side by Side Diff: src/objects-debug.cc

Issue 391693002: In-object double fields unboxing (for 64-bit only). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/disasm.h" 7 #include "src/disasm.h"
8 #include "src/disassembler.h" 8 #include "src/disassembler.h"
9 #include "src/heap/objects-visiting.h" 9 #include "src/heap/objects-visiting.h"
10 #include "src/jsregexp.h" 10 #include "src/jsregexp.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // the allocation of the MutableHeapNumber triggers GC (in this case map 268 // the allocation of the MutableHeapNumber triggers GC (in this case map
269 // is not updated yet). 269 // is not updated yet).
270 CHECK_EQ(map()->unused_property_fields(), 270 CHECK_EQ(map()->unused_property_fields(),
271 actual_unused_property_fields - JSObject::kFieldsAdded); 271 actual_unused_property_fields - JSObject::kFieldsAdded);
272 } 272 }
273 DescriptorArray* descriptors = map()->instance_descriptors(); 273 DescriptorArray* descriptors = map()->instance_descriptors();
274 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 274 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
275 if (descriptors->GetDetails(i).type() == FIELD) { 275 if (descriptors->GetDetails(i).type() == FIELD) {
276 Representation r = descriptors->GetDetails(i).representation(); 276 Representation r = descriptors->GetDetails(i).representation();
277 FieldIndex index = FieldIndex::ForDescriptor(map(), i); 277 FieldIndex index = FieldIndex::ForDescriptor(map(), i);
278 if (IsUnboxedDoubleField(index)) {
279 DCHECK(r.IsDouble());
280 continue;
281 }
278 Object* value = RawFastPropertyAt(index); 282 Object* value = RawFastPropertyAt(index);
279 if (r.IsDouble()) DCHECK(value->IsMutableHeapNumber()); 283 if (r.IsDouble()) DCHECK(value->IsMutableHeapNumber());
280 if (value->IsUninitialized()) continue; 284 if (value->IsUninitialized()) continue;
281 if (r.IsSmi()) DCHECK(value->IsSmi()); 285 if (r.IsSmi()) DCHECK(value->IsSmi());
282 if (r.IsHeapObject()) DCHECK(value->IsHeapObject()); 286 if (r.IsHeapObject()) DCHECK(value->IsHeapObject());
283 HeapType* field_type = descriptors->GetFieldType(i); 287 HeapType* field_type = descriptors->GetFieldType(i);
284 if (r.IsNone()) { 288 if (r.IsNone()) {
285 CHECK(field_type->Is(HeapType::None())); 289 CHECK(field_type->Is(HeapType::None()));
286 } else if (!HeapType::Any()->Is(field_type)) { 290 } else if (!HeapType::Any()->Is(field_type)) {
287 CHECK(!field_type->NowStable() || field_type->NowContains(value)); 291 CHECK(!field_type->NowStable() || field_type->NowContains(value));
(...skipping 21 matching lines...) Expand all
309 CHECK(instance_size() == kVariableSizeSentinel || 313 CHECK(instance_size() == kVariableSizeSentinel ||
310 (kPointerSize <= instance_size() && 314 (kPointerSize <= instance_size() &&
311 instance_size() < heap->Capacity())); 315 instance_size() < heap->Capacity()));
312 VerifyHeapPointer(prototype()); 316 VerifyHeapPointer(prototype());
313 VerifyHeapPointer(instance_descriptors()); 317 VerifyHeapPointer(instance_descriptors());
314 SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates()); 318 SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates());
315 if (HasTransitionArray()) { 319 if (HasTransitionArray()) {
316 SLOW_DCHECK(transitions()->IsSortedNoDuplicates()); 320 SLOW_DCHECK(transitions()->IsSortedNoDuplicates());
317 SLOW_DCHECK(transitions()->IsConsistentWithBackPointers(this)); 321 SLOW_DCHECK(transitions()->IsConsistentWithBackPointers(this));
318 } 322 }
323 SLOW_DCHECK(!FLAG_unbox_double_fields ||
324 layout_descriptor()->IsConsistentWithMap(this));
319 } 325 }
320 326
321 327
322 void Map::DictionaryMapVerify() { 328 void Map::DictionaryMapVerify() {
323 MapVerify(); 329 MapVerify();
324 CHECK(is_dictionary_map()); 330 CHECK(is_dictionary_map());
325 CHECK(instance_descriptors()->IsEmpty()); 331 CHECK(instance_descriptors()->IsEmpty());
326 CHECK_EQ(0, pre_allocated_property_fields()); 332 CHECK_EQ(0, pre_allocated_property_fields());
327 CHECK_EQ(0, unused_property_fields()); 333 CHECK_EQ(0, unused_property_fields());
328 CHECK_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), 334 CHECK_EQ(StaticVisitorBase::GetVisitorId(this), visitor_id());
329 visitor_id());
330 } 335 }
331 336
332 337
333 void Map::VerifyOmittedMapChecks() { 338 void Map::VerifyOmittedMapChecks() {
334 if (!FLAG_omit_map_checks_for_leaf_maps) return; 339 if (!FLAG_omit_map_checks_for_leaf_maps) return;
335 if (!is_stable() || 340 if (!is_stable() ||
336 is_deprecated() || 341 is_deprecated() ||
337 HasTransitionArray() || 342 HasTransitionArray() ||
338 is_dictionary_map()) { 343 is_dictionary_map()) {
339 CHECK_EQ(0, dependent_code()->number_of_entries( 344 CHECK_EQ(0, dependent_code()->number_of_entries(
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 if (hash < current) { 1177 if (hash < current) {
1173 Print(); 1178 Print();
1174 return false; 1179 return false;
1175 } 1180 }
1176 current = hash; 1181 current = hash;
1177 } 1182 }
1178 return true; 1183 return true;
1179 } 1184 }
1180 1185
1181 1186
1187 bool LayoutDescriptor::IsConsistentWithMap(Map* map) {
1188 if (FLAG_unbox_double_fields) {
1189 DescriptorArray* descriptors = map->instance_descriptors();
1190 int nof_descriptors = map->NumberOfOwnDescriptors();
1191 for (int i = 0; i < nof_descriptors; i++) {
1192 PropertyDetails details = descriptors->GetDetails(i);
1193 if (details.type() != FIELD) continue;
1194 FieldIndex field_index = FieldIndex::ForDescriptor(map, i);
1195 bool tagged_expected =
1196 !field_index.is_inobject() || !details.representation().IsDouble();
1197 for (int bit = 0; bit < details.field_width_in_words(); bit++) {
1198 bool tagged_actual = IsTagged(details.field_index() + bit);
1199 DCHECK_EQ(tagged_expected, tagged_actual);
1200 if (tagged_actual != tagged_expected) return false;
1201 }
1202 }
1203 }
1204 return true;
1205 }
1206
1207
1182 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { 1208 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
1183 DCHECK(valid_entries == -1); 1209 DCHECK(valid_entries == -1);
1184 Name* prev_key = NULL; 1210 Name* prev_key = NULL;
1185 bool prev_is_data_property = false; 1211 bool prev_is_data_property = false;
1186 PropertyAttributes prev_attributes = NONE; 1212 PropertyAttributes prev_attributes = NONE;
1187 uint32_t prev_hash = 0; 1213 uint32_t prev_hash = 0;
1188 for (int i = 0; i < number_of_transitions(); i++) { 1214 for (int i = 0; i < number_of_transitions(); i++) {
1189 Name* key = GetSortedKey(i); 1215 Name* key = GetSortedKey(i);
1190 uint32_t hash = key->Hash(); 1216 uint32_t hash = key->Hash();
1191 bool is_data_property = false; 1217 bool is_data_property = false;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 while (map != heap->roots_array_start()[i++]) { 1269 while (map != heap->roots_array_start()[i++]) {
1244 CHECK_LT(i, Heap::kStrongRootListLength); 1270 CHECK_LT(i, Heap::kStrongRootListLength);
1245 } 1271 }
1246 } 1272 }
1247 } 1273 }
1248 1274
1249 1275
1250 #endif // DEBUG 1276 #endif // DEBUG
1251 1277
1252 } } // namespace v8::internal 1278 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698