OLD | NEW |
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 stats->empty_leaves_++; | 338 stats->empty_leaves_++; |
339 CHECK(!left_is_cons); | 339 CHECK(!left_is_cons); |
340 } | 340 } |
341 stats->leaves_++; | 341 stats->leaves_++; |
342 stats->chars_ += right_length; | 342 stats->chars_ += right_length; |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
346 | 346 |
347 void AccumulateStats(Handle<String> cons_string, ConsStringStats* stats) { | 347 void AccumulateStats(Handle<String> cons_string, ConsStringStats* stats) { |
348 AssertNoAllocation no_alloc; | 348 DisallowHeapAllocation no_allocation; |
349 if (cons_string->IsConsString()) { | 349 if (cons_string->IsConsString()) { |
350 return AccumulateStats(ConsString::cast(*cons_string), stats); | 350 return AccumulateStats(ConsString::cast(*cons_string), stats); |
351 } | 351 } |
352 // This string got flattened by gc. | 352 // This string got flattened by gc. |
353 stats->chars_ += cons_string->length(); | 353 stats->chars_ += cons_string->length(); |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 void AccumulateStatsWithOperator( | 357 void AccumulateStatsWithOperator( |
358 ConsString* cons_string, ConsStringStats* stats) { | 358 ConsString* cons_string, ConsStringStats* stats) { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // Build flat version of cons string. | 663 // Build flat version of cons string. |
664 Handle<String> flat_string = build(i, &data); | 664 Handle<String> flat_string = build(i, &data); |
665 ConsStringStats flat_string_stats; | 665 ConsStringStats flat_string_stats; |
666 AccumulateStats(flat_string, &flat_string_stats); | 666 AccumulateStats(flat_string, &flat_string_stats); |
667 // Flatten string. | 667 // Flatten string. |
668 FlattenString(flat_string); | 668 FlattenString(flat_string); |
669 // Build unflattened version of cons string to test. | 669 // Build unflattened version of cons string to test. |
670 Handle<String> cons_string = build(i, &data); | 670 Handle<String> cons_string = build(i, &data); |
671 ConsStringStats cons_string_stats; | 671 ConsStringStats cons_string_stats; |
672 AccumulateStats(cons_string, &cons_string_stats); | 672 AccumulateStats(cons_string, &cons_string_stats); |
673 AssertNoAllocation no_alloc; | 673 DisallowHeapAllocation no_allocation; |
674 PrintStats(data); | 674 PrintStats(data); |
675 // Full verify of cons string. | 675 // Full verify of cons string. |
676 cons_string_stats.VerifyEqual(flat_string_stats); | 676 cons_string_stats.VerifyEqual(flat_string_stats); |
677 cons_string_stats.VerifyEqual(data.stats_); | 677 cons_string_stats.VerifyEqual(data.stats_); |
678 VerifyConsString(cons_string, &data); | 678 VerifyConsString(cons_string, &data); |
679 String* flat_string_ptr = | 679 String* flat_string_ptr = |
680 flat_string->IsConsString() ? | 680 flat_string->IsConsString() ? |
681 ConsString::cast(*flat_string)->first() : | 681 ConsString::cast(*flat_string)->first() : |
682 *flat_string; | 682 *flat_string; |
683 VerifyCharacterStream(flat_string_ptr, *cons_string); | 683 VerifyCharacterStream(flat_string_ptr, *cons_string); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 CheckCanonicalEquivalence(c, test); | 1337 CheckCanonicalEquivalence(c, test); |
1338 continue; | 1338 continue; |
1339 } | 1339 } |
1340 if (upper != c && lower != c) { | 1340 if (upper != c && lower != c) { |
1341 CheckCanonicalEquivalence(c, test); | 1341 CheckCanonicalEquivalence(c, test); |
1342 continue; | 1342 continue; |
1343 } | 1343 } |
1344 CHECK_EQ(Min(upper, lower), test); | 1344 CHECK_EQ(Min(upper, lower), test); |
1345 } | 1345 } |
1346 } | 1346 } |
OLD | NEW |