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

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

Issue 149458: Remove the descriptor stream abstractions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 264 }
265 265
266 266
267 void ByteArray::ByteArrayVerify() { 267 void ByteArray::ByteArrayVerify() {
268 ASSERT(IsByteArray()); 268 ASSERT(IsByteArray());
269 } 269 }
270 270
271 271
272 void JSObject::PrintProperties() { 272 void JSObject::PrintProperties() {
273 if (HasFastProperties()) { 273 if (HasFastProperties()) {
274 for (DescriptorReader r(map()->instance_descriptors()); 274 DescriptorArray* descs = map()->instance_descriptors();
275 !r.eos(); 275 for (int i = 0; i < descs->number_of_descriptors(); i++) {
276 r.advance()) {
277 PrintF(" "); 276 PrintF(" ");
278 r.GetKey()->StringPrint(); 277 descs->GetKey(i)->StringPrint();
279 PrintF(": "); 278 PrintF(": ");
280 if (r.type() == FIELD) { 279 switch (descs->GetType(i)) {
281 FastPropertyAt(r.GetFieldIndex())->ShortPrint(); 280 case FIELD: {
282 PrintF(" (field at offset %d)\n", r.GetFieldIndex()); 281 int index = descs->GetFieldIndex(i);
283 } else if (r.type() == CONSTANT_FUNCTION) { 282 FastPropertyAt(index)->ShortPrint();
284 r.GetConstantFunction()->ShortPrint(); 283 PrintF(" (field at offset %d)\n", index);
285 PrintF(" (constant function)\n"); 284 break;
286 } else if (r.type() == CALLBACKS) { 285 }
287 r.GetCallbacksObject()->ShortPrint(); 286 case CONSTANT_FUNCTION:
288 PrintF(" (callback)\n"); 287 descs->GetConstantFunction(i)->ShortPrint();
289 } else if (r.type() == MAP_TRANSITION) { 288 PrintF(" (constant function)\n");
290 PrintF(" (map transition)\n"); 289 break;
291 } else if (r.type() == CONSTANT_TRANSITION) { 290 case CALLBACKS:
292 PrintF(" (constant transition)\n"); 291 descs->GetCallbacksObject(i)->ShortPrint();
293 } else if (r.type() == NULL_DESCRIPTOR) { 292 PrintF(" (callback)\n");
294 PrintF(" (null descriptor)\n"); 293 break;
295 } else { 294 case MAP_TRANSITION:
296 UNREACHABLE(); 295 PrintF(" (map transition)\n");
296 break;
297 case CONSTANT_TRANSITION:
298 PrintF(" (constant transition)\n");
299 break;
300 case NULL_DESCRIPTOR:
301 PrintF(" (null descriptor)\n");
302 break;
303 default:
304 UNREACHABLE();
305 break;
297 } 306 }
298 } 307 }
299 } else { 308 } else {
300 property_dictionary()->Print(); 309 property_dictionary()->Print();
301 } 310 }
302 } 311 }
303 312
304 313
305 void JSObject::PrintElements() { 314 void JSObject::PrintElements() {
306 if (HasFastElements()) { 315 if (HasFastElements()) {
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", 1064 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n",
1056 number_of_objects_ - number_of_objects_with_fast_elements_, 1065 number_of_objects_ - number_of_objects_with_fast_elements_,
1057 number_of_slow_used_elements_, number_of_slow_unused_elements_); 1066 number_of_slow_used_elements_, number_of_slow_unused_elements_);
1058 1067
1059 PrintF("\n"); 1068 PrintF("\n");
1060 } 1069 }
1061 1070
1062 1071
1063 void DescriptorArray::PrintDescriptors() { 1072 void DescriptorArray::PrintDescriptors() {
1064 PrintF("Descriptor array %d\n", number_of_descriptors()); 1073 PrintF("Descriptor array %d\n", number_of_descriptors());
1065 int number = 0; 1074 for (int i = 0; i < number_of_descriptors(); i++) {
1066 for (DescriptorReader r(this); !r.eos(); r.advance()) { 1075 PrintF(" %d: ", i);
1067 Descriptor desc; 1076 Descriptor desc;
1068 r.Get(&desc); 1077 Get(i, &desc);
1069 PrintF(" %d: ", number++);
1070 desc.Print(); 1078 desc.Print();
1071 } 1079 }
1072 PrintF("\n"); 1080 PrintF("\n");
1073 } 1081 }
1074 1082
1075 1083
1076 bool DescriptorArray::IsSortedNoDuplicates() { 1084 bool DescriptorArray::IsSortedNoDuplicates() {
1077 String* current_key = NULL; 1085 String* current_key = NULL;
1078 uint32_t current = 0; 1086 uint32_t current = 0;
1079 for (DescriptorReader r(this); !r.eos(); r.advance()) { 1087 for (int i = 0; i < number_of_descriptors(); i++) {
1080 String* key = r.GetKey(); 1088 String* key = GetKey(i);
1081 if (key == current_key) { 1089 if (key == current_key) {
1082 PrintDescriptors(); 1090 PrintDescriptors();
1083 return false; 1091 return false;
1084 } 1092 }
1085 current_key = key; 1093 current_key = key;
1086 uint32_t hash = r.GetKey()->Hash(); 1094 uint32_t hash = GetKey(i)->Hash();
1087 if (hash < current) { 1095 if (hash < current) {
1088 PrintDescriptors(); 1096 PrintDescriptors();
1089 return false; 1097 return false;
1090 } 1098 }
1091 current = hash; 1099 current = hash;
1092 } 1100 }
1093 return true; 1101 return true;
1094 } 1102 }
1095 1103
1096 1104
1097 #endif // DEBUG 1105 #endif // DEBUG
1098 1106
1099 } } // namespace v8::internal 1107 } } // namespace v8::internal
OLDNEW
« src/factory.cc ('K') | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698