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

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

Issue 10697015: Separating transitions from descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Using WhitenessWitness in TransitionArray code. Created 8 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
« no previous file with comments | « src/objects-inl.h ('k') | src/profile-generator.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 break; 266 break;
267 } 267 }
268 case CONSTANT_FUNCTION: 268 case CONSTANT_FUNCTION:
269 descs->GetConstantFunction(i)->ShortPrint(out); 269 descs->GetConstantFunction(i)->ShortPrint(out);
270 PrintF(out, " (constant function)\n"); 270 PrintF(out, " (constant function)\n");
271 break; 271 break;
272 case CALLBACKS: 272 case CALLBACKS:
273 descs->GetCallbacksObject(i)->ShortPrint(out); 273 descs->GetCallbacksObject(i)->ShortPrint(out);
274 PrintF(out, " (callback)\n"); 274 PrintF(out, " (callback)\n");
275 break; 275 break;
276 case MAP_TRANSITION:
277 PrintF(out, "(map transition)\n");
278 break;
279 case CONSTANT_TRANSITION:
280 PrintF(out, "(constant transition)\n");
281 break;
282 case NORMAL: // only in slow mode 276 case NORMAL: // only in slow mode
283 case HANDLER: // only in lookup results, not in descriptors 277 case HANDLER: // only in lookup results, not in descriptors
284 case INTERCEPTOR: // only in lookup results, not in descriptors 278 case INTERCEPTOR: // only in lookup results, not in descriptors
279 // There are no transitions in the descriptor array.
280 case TRANSITION:
285 case NONEXISTENT: 281 case NONEXISTENT:
286 UNREACHABLE(); 282 UNREACHABLE();
287 break; 283 break;
288 } 284 }
289 } 285 }
290 } else { 286 } else {
291 property_dictionary()->Print(out); 287 property_dictionary()->Print(out);
292 } 288 }
293 } 289 }
294 290
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 PrintF(out, " %d: ", i); 397 PrintF(out, " %d: ", i);
402 p->get(i)->ShortPrint(out); 398 p->get(i)->ShortPrint(out);
403 PrintF(out, "\n"); 399 PrintF(out, "\n");
404 } 400 }
405 break; 401 break;
406 } 402 }
407 } 403 }
408 } 404 }
409 405
410 406
407 void JSObject::PrintTransitions(FILE* out) {
408 if (!map()->HasTransitionArray()) return;
409 TransitionArray* transitions = map()->transitions();
410 for (int i = 0; i < transitions->number_of_transitions(); i++) {
411 PrintF(out, " ");
412 transitions->GetKey(i)->StringPrint(out);
413 PrintF(out, ": ");
414 switch (transitions->GetTargetDetails(i).type()) {
415 case FIELD: {
416 PrintF(out, " (transition to field)\n");
417 break;
418 }
419 case CONSTANT_FUNCTION:
420 PrintF(out, " (transition to constant function)\n");
421 break;
422 case CALLBACKS:
423 PrintF(out, " (transition to callback)\n");
424 break;
425 // Values below are never in the target descriptor array.
426 case NORMAL:
427 case HANDLER:
428 case INTERCEPTOR:
429 case TRANSITION:
430 case NONEXISTENT:
431 UNREACHABLE();
432 break;
433 }
434 }
435 }
436
437
411 void JSObject::JSObjectPrint(FILE* out) { 438 void JSObject::JSObjectPrint(FILE* out) {
412 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); 439 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
413 PrintF(out, " - map = %p [", reinterpret_cast<void*>(map())); 440 PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
414 // Don't call GetElementsKind, its validation code can cause the printer to 441 // Don't call GetElementsKind, its validation code can cause the printer to
415 // fail when debugging. 442 // fail when debugging.
416 PrintElementsKind(out, this->map()->elements_kind()); 443 PrintElementsKind(out, this->map()->elements_kind());
417 PrintF(out, 444 PrintF(out,
418 "]\n - prototype = %p\n", 445 "]\n - prototype = %p\n",
419 reinterpret_cast<void*>(GetPrototype())); 446 reinterpret_cast<void*>(GetPrototype()));
420 PrintF(out,
421 " - elements transition to = %p\n",
422 reinterpret_cast<void*>(map()->elements_transition_map()));
423 PrintF(out, " {\n"); 447 PrintF(out, " {\n");
424 PrintProperties(out); 448 PrintProperties(out);
449 PrintTransitions(out);
425 PrintElements(out); 450 PrintElements(out);
426 PrintF(out, " }\n"); 451 PrintF(out, " }\n");
427 } 452 }
428 453
429 454
430 void JSModule::JSModulePrint(FILE* out) { 455 void JSModule::JSModulePrint(FILE* out) {
431 HeapObject::PrintHeader(out, "JSModule"); 456 HeapObject::PrintHeader(out, "JSModule");
432 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 457 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
433 PrintF(out, " - context = "); 458 PrintF(out, " - context = ");
434 context()->Print(out); 459 context()->Print(out);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 PrintF(out, " - undetectable\n"); 555 PrintF(out, " - undetectable\n");
531 } 556 }
532 if (has_instance_call_handler()) { 557 if (has_instance_call_handler()) {
533 PrintF(out, " - instance_call_handler\n"); 558 PrintF(out, " - instance_call_handler\n");
534 } 559 }
535 if (is_access_check_needed()) { 560 if (is_access_check_needed()) {
536 PrintF(out, " - access_check_needed\n"); 561 PrintF(out, " - access_check_needed\n");
537 } 562 }
538 PrintF(out, " - instance descriptors: "); 563 PrintF(out, " - instance descriptors: ");
539 instance_descriptors()->ShortPrint(out); 564 instance_descriptors()->ShortPrint(out);
565 if (HasTransitionArray()) {
566 PrintF(out, "\n - transitions: ");
567 transitions()->ShortPrint(out);
568 }
540 PrintF(out, "\n - prototype: "); 569 PrintF(out, "\n - prototype: ");
541 prototype()->ShortPrint(out); 570 prototype()->ShortPrint(out);
542 PrintF(out, "\n - constructor: "); 571 PrintF(out, "\n - constructor: ");
543 constructor()->ShortPrint(out); 572 constructor()->ShortPrint(out);
544 PrintF(out, "\n - code cache: "); 573 PrintF(out, "\n - code cache: ");
545 code_cache()->ShortPrint(out); 574 code_cache()->ShortPrint(out);
546 PrintF(out, "\n"); 575 PrintF(out, "\n");
547 } 576 }
548 577
549 578
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 for (int i = 0; i < number_of_descriptors(); i++) { 1046 for (int i = 0; i < number_of_descriptors(); i++) {
1018 PrintF(out, " %d: ", i); 1047 PrintF(out, " %d: ", i);
1019 Descriptor desc; 1048 Descriptor desc;
1020 Get(i, &desc); 1049 Get(i, &desc);
1021 desc.Print(out); 1050 desc.Print(out);
1022 } 1051 }
1023 PrintF(out, "\n"); 1052 PrintF(out, "\n");
1024 } 1053 }
1025 1054
1026 1055
1056 void TransitionArray::PrintTransitions(FILE* out) {
1057 PrintF(out, "Transition array %d\n", number_of_transitions());
1058 for (int i = 0; i < number_of_transitions(); i++) {
1059 PrintF(out, " %d: ", i);
1060 GetKey(i)->StringPrint(out);
1061 PrintF(out, ": ");
1062 switch (GetTargetDetails(i).type()) {
1063 case FIELD: {
1064 PrintF(out, " (transition to field)\n");
1065 break;
1066 }
1067 case CONSTANT_FUNCTION:
1068 PrintF(out, " (transition to constant function)\n");
1069 break;
1070 case CALLBACKS:
1071 PrintF(out, " (transition to callback)\n");
1072 break;
1073 // Values below are never in the target descriptor array.
1074 case NORMAL:
1075 case HANDLER:
1076 case INTERCEPTOR:
1077 case TRANSITION:
1078 case NONEXISTENT:
1079 UNREACHABLE();
1080 break;
1081 }
1082 }
1083 PrintF(out, "\n");
1084 }
1085
1086
1027 #endif // OBJECT_PRINT 1087 #endif // OBJECT_PRINT
1028 1088
1029 1089
1030 } } // namespace v8::internal 1090 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698