OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 | 456 |
457 // Minimizes the white space in a string. Tabs and newlines are replaced | 457 // Minimizes the white space in a string. Tabs and newlines are replaced |
458 // with a space where appropriate. | 458 // with a space where appropriate. |
459 static int CompactString(char* str) { | 459 static int CompactString(char* str) { |
460 char* src = str; | 460 char* src = str; |
461 char* dst = str; | 461 char* dst = str; |
462 char prev_ch = 0; | 462 char prev_ch = 0; |
463 while (*dst != '\0') { | 463 while (*dst != '\0') { |
464 char ch = *src++; | 464 char ch = *src++; |
465 // We will treat non-ascii chars as '?'. | 465 // We will treat non-ASCII chars as '?'. |
466 if ((ch & 0x80) != 0) { | 466 if ((ch & 0x80) != 0) { |
467 ch = '?'; | 467 ch = '?'; |
468 } | 468 } |
469 // Compact contiguous whitespace chars into a single ' '. | 469 // Compact contiguous whitespace chars into a single ' '. |
470 if (isspace(ch)) { | 470 if (isspace(ch)) { |
471 if (prev_ch != ' ') *dst++ = ' '; | 471 if (prev_ch != ' ') *dst++ = ' '; |
472 prev_ch = ' '; | 472 prev_ch = ' '; |
473 continue; | 473 continue; |
474 } | 474 } |
475 *dst++ = ch; | 475 *dst++ = ch; |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 i++, heap_obj, Heap::new_space()->FromSpaceStart()); | 2622 i++, heap_obj, Heap::new_space()->FromSpaceStart()); |
2623 } | 2623 } |
2624 } | 2624 } |
2625 } | 2625 } |
2626 #endif // VERIFY_LOL | 2626 #endif // VERIFY_LOL |
2627 | 2627 |
2628 | 2628 |
2629 } } // namespace v8::internal | 2629 } } // namespace v8::internal |
2630 | 2630 |
2631 #endif // LIVE_OBJECT_LIST | 2631 #endif // LIVE_OBJECT_LIST |
OLD | NEW |