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

Side by Side Diff: src/hydrogen-gvn.cc

Issue 142253003: Fix printing of GVN flags. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « no previous file | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 loop_side_effects_[parent_block->block_id()].Add(side_effects); 432 loop_side_effects_[parent_block->block_id()].Add(side_effects);
433 with_parent = parent_block; 433 with_parent = parent_block;
434 } while (with_parent->HasParentLoopHeader()); 434 } while (with_parent->HasParentLoopHeader());
435 } 435 }
436 } 436 }
437 } 437 }
438 } 438 }
439 439
440 440
441 SmartArrayPointer<char> GetGVNFlagsString(GVNFlagSet flags) { 441 SmartArrayPointer<char> GetGVNFlagsString(GVNFlagSet flags) {
442 char underlying_buffer[kLastFlag * 128]; 442 char underlying_buffer[kNumberOfFlags * 128];
443 Vector<char> buffer(underlying_buffer, sizeof(underlying_buffer)); 443 Vector<char> buffer(underlying_buffer, sizeof(underlying_buffer));
444 #if DEBUG 444 #if DEBUG
445 int offset = 0; 445 int offset = 0;
446 const char* separator = ""; 446 const char* separator = "";
447 const char* comma = ", "; 447 const char* comma = ", ";
448 buffer[0] = 0; 448 buffer[0] = 0;
449 uint32_t set_depends_on = 0; 449 uint32_t set_depends_on = 0;
450 uint32_t set_changes = 0; 450 uint32_t set_changes = 0;
451 for (int bit = 0; bit < kLastFlag; ++bit) { 451 for (int bit = 0; bit < kNumberOfFlags; ++bit) {
452 if (flags.Contains(static_cast<GVNFlag>(bit))) { 452 if (flags.Contains(static_cast<GVNFlag>(bit))) {
453 if (bit % 2 == 0) { 453 if (bit % 2 == 0) {
454 set_changes++; 454 set_changes++;
455 } else { 455 } else {
456 set_depends_on++; 456 set_depends_on++;
457 } 457 }
458 } 458 }
459 } 459 }
460 bool positive_changes = set_changes < (kLastFlag / 2); 460 bool positive_changes = set_changes < (kNumberOfFlags / 2);
461 bool positive_depends_on = set_depends_on < (kLastFlag / 2); 461 bool positive_depends_on = set_depends_on < (kNumberOfFlags / 2);
462 if (set_changes > 0) { 462 if (set_changes > 0) {
463 if (positive_changes) { 463 if (positive_changes) {
464 offset += OS::SNPrintF(buffer + offset, "changes ["); 464 offset += OS::SNPrintF(buffer + offset, "changes [");
465 } else { 465 } else {
466 offset += OS::SNPrintF(buffer + offset, "changes all except ["); 466 offset += OS::SNPrintF(buffer + offset, "changes all except [");
467 } 467 }
468 for (int bit = 0; bit < kLastFlag; ++bit) { 468 for (int bit = 0; bit < kNumberOfFlags; ++bit) {
469 if (flags.Contains(static_cast<GVNFlag>(bit)) == positive_changes) { 469 if (flags.Contains(static_cast<GVNFlag>(bit)) == positive_changes) {
470 switch (static_cast<GVNFlag>(bit)) { 470 switch (static_cast<GVNFlag>(bit)) {
471 #define DECLARE_FLAG(type) \ 471 #define DECLARE_FLAG(type) \
472 case kChanges##type: \ 472 case kChanges##type: \
473 offset += OS::SNPrintF(buffer + offset, separator); \ 473 offset += OS::SNPrintF(buffer + offset, separator); \
474 offset += OS::SNPrintF(buffer + offset, #type); \ 474 offset += OS::SNPrintF(buffer + offset, #type); \
475 separator = comma; \ 475 separator = comma; \
476 break; 476 break;
477 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG) 477 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG)
478 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) 478 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG)
479 #undef DECLARE_FLAG 479 #undef DECLARE_FLAG
480 default: 480 default:
481 break; 481 break;
482 } 482 }
483 } 483 }
484 } 484 }
485 offset += OS::SNPrintF(buffer + offset, "]"); 485 offset += OS::SNPrintF(buffer + offset, "]");
486 } 486 }
487 if (set_depends_on > 0) { 487 if (set_depends_on > 0) {
488 separator = ""; 488 separator = "";
489 if (set_changes > 0) { 489 if (set_changes > 0) {
490 offset += OS::SNPrintF(buffer + offset, ", "); 490 offset += OS::SNPrintF(buffer + offset, ", ");
491 } 491 }
492 if (positive_depends_on) { 492 if (positive_depends_on) {
493 offset += OS::SNPrintF(buffer + offset, "depends on ["); 493 offset += OS::SNPrintF(buffer + offset, "depends on [");
494 } else { 494 } else {
495 offset += OS::SNPrintF(buffer + offset, "depends on all except ["); 495 offset += OS::SNPrintF(buffer + offset, "depends on all except [");
496 } 496 }
497 for (int bit = 0; bit < kLastFlag; ++bit) { 497 for (int bit = 0; bit < kNumberOfFlags; ++bit) {
498 if (flags.Contains(static_cast<GVNFlag>(bit)) == positive_depends_on) { 498 if (flags.Contains(static_cast<GVNFlag>(bit)) == positive_depends_on) {
499 switch (static_cast<GVNFlag>(bit)) { 499 switch (static_cast<GVNFlag>(bit)) {
500 #define DECLARE_FLAG(type) \ 500 #define DECLARE_FLAG(type) \
501 case kDependsOn##type: \ 501 case kDependsOn##type: \
502 offset += OS::SNPrintF(buffer + offset, separator); \ 502 offset += OS::SNPrintF(buffer + offset, separator); \
503 offset += OS::SNPrintF(buffer + offset, #type); \ 503 offset += OS::SNPrintF(buffer + offset, #type); \
504 separator = comma; \ 504 separator = comma; \
505 break; 505 break;
506 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG) 506 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG)
507 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) 507 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG)
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 dominated); 863 dominated);
864 successor_map->Kill(side_effects_on_all_paths); 864 successor_map->Kill(side_effects_on_all_paths);
865 successor_dominators->Kill(side_effects_on_all_paths); 865 successor_dominators->Kill(side_effects_on_all_paths);
866 } 866 }
867 } 867 }
868 current = next; 868 current = next;
869 } 869 }
870 } 870 }
871 871
872 } } // namespace v8::internal 872 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698