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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 CHECK_EQ(c, cons_stream.GetNext()); | 623 CHECK_EQ(c, cons_stream.GetNext()); |
624 } | 624 } |
625 CHECK(!flat_stream.HasMore()); | 625 CHECK(!flat_stream.HasMore()); |
626 CHECK(!cons_stream.HasMore()); | 626 CHECK(!cons_stream.HasMore()); |
627 } | 627 } |
628 } | 628 } |
629 | 629 |
630 | 630 |
631 static inline void PrintStats(const ConsStringGenerationData& data) { | 631 static inline void PrintStats(const ConsStringGenerationData& data) { |
632 #ifdef DEBUG | 632 #ifdef DEBUG |
633 printf( | 633 printf("%s: [%u], %s: [%u], %s: [%u], %s: [%u], %s: [%u], %s: [%u]\n", |
634 "%s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d]\n", | 634 "leaves", data.stats_.leaves_, "empty", data.stats_.empty_leaves_, |
635 "leaves", data.stats_.leaves_, | 635 "chars", data.stats_.chars_, "lefts", data.stats_.left_traversals_, |
636 "empty", data.stats_.empty_leaves_, | 636 "rights", data.stats_.right_traversals_, "early_terminations", |
637 "chars", data.stats_.chars_, | 637 data.early_terminations_); |
638 "lefts", data.stats_.left_traversals_, | |
639 "rights", data.stats_.right_traversals_, | |
640 "early_terminations", data.early_terminations_); | |
641 #endif | 638 #endif |
642 } | 639 } |
643 | 640 |
644 | 641 |
645 template<typename BuildString> | 642 template<typename BuildString> |
646 void TestStringCharacterStream(BuildString build, int test_cases) { | 643 void TestStringCharacterStream(BuildString build, int test_cases) { |
647 CcTest::InitializeVM(); | 644 CcTest::InitializeVM(); |
648 Isolate* isolate = CcTest::i_isolate(); | 645 Isolate* isolate = CcTest::i_isolate(); |
649 HandleScope outer_scope(isolate); | 646 HandleScope outer_scope(isolate); |
650 ConsStringGenerationData data(true); | 647 ConsStringGenerationData data(true); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 CHECK(isolate->has_pending_exception()); \ | 1448 CHECK(isolate->has_pending_exception()); \ |
1452 isolate->clear_pending_exception(); \ | 1449 isolate->clear_pending_exception(); \ |
1453 dummy.Dispose(); \ | 1450 dummy.Dispose(); \ |
1454 } | 1451 } |
1455 | 1452 |
1456 INVALID_STRING_TEST(NewStringFromAscii, char) | 1453 INVALID_STRING_TEST(NewStringFromAscii, char) |
1457 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1454 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1458 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1455 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1459 | 1456 |
1460 #undef INVALID_STRING_TEST | 1457 #undef INVALID_STRING_TEST |
OLD | NEW |