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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 i::Isolate::Current()->compilation_cache()->Clear(); | 710 i::Isolate::Current()->compilation_cache()->Clear(); |
711 HEAP->CollectAllAvailableGarbage(); | 711 HEAP->CollectAllAvailableGarbage(); |
712 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); | 712 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); |
713 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_count); | 713 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_count); |
714 } | 714 } |
715 | 715 |
716 | 716 |
717 static void TestNewLatin1String(int encoding1, int encoding2) { | 717 static void TestNewLatin1String(int encoding1, int encoding2) { |
718 const char* chars1 = "ASCII 123"; | 718 const char* chars1 = "ASCII 123"; |
719 const char* chars1js = "'ASCII 123'"; | 719 const char* chars1js = "'ASCII 123'"; |
720 int str1_len = strlen(chars1); | 720 int str1_len = static_cast<int>(strlen(chars1)); |
721 const char* chars2 = "Non-ASCII \xAB\xCD\xEF"; | 721 const char* chars2 = "Non-ASCII \xAB\xCD\xEF"; |
722 const char* chars2js = "'Non-ASCII \\u00ab\\u00cd\\u00ef'"; | 722 const char* chars2js = "'Non-ASCII \\u00ab\\u00cd\\u00ef'"; |
723 int str2_len = strlen(chars2); | 723 int str2_len = static_cast<int>(strlen(chars2)); |
724 | 724 |
725 Local<String> str1 = String::New(chars1, str1_len, encoding1); | 725 Local<String> str1 = String::New(chars1, str1_len, encoding1); |
726 Local<String> str2 = String::New(chars2, str2_len, encoding2); | 726 Local<String> str2 = String::New(chars2, str2_len, encoding2); |
727 Local<String> str1_compare = CompileRun(chars1js)->ToString(); | 727 Local<String> str1_compare = CompileRun(chars1js)->ToString(); |
728 Local<String> str2_compare = CompileRun(chars2js)->ToString(); | 728 Local<String> str2_compare = CompileRun(chars2js)->ToString(); |
729 | 729 |
730 if (encoding1 & String::NOT_ASCII_HINT) { | 730 if (encoding1 & String::NOT_ASCII_HINT) { |
731 CHECK(v8::Utils::OpenHandle(*str1)->IsSeqTwoByteString()); | 731 CHECK(v8::Utils::OpenHandle(*str1)->IsSeqTwoByteString()); |
732 } else { | 732 } else { |
733 CHECK(v8::Utils::OpenHandle(*str1)->IsSeqAsciiString()); | 733 CHECK(v8::Utils::OpenHandle(*str1)->IsSeqAsciiString()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 Local<String> sub_string = v8::Utils::ToLocal( | 819 Local<String> sub_string = v8::Utils::ToLocal( |
820 FACTORY->NewSubString( | 820 FACTORY->NewSubString( |
821 v8::Utils::OpenHandle(*latin1_string), 2, latin1_string->Length())); | 821 v8::Utils::OpenHandle(*latin1_string), 2, latin1_string->Length())); |
822 | 822 |
823 CHECK(v8::Utils::OpenHandle(*latin1_ascii_string)->IsSeqAsciiString()); | 823 CHECK(v8::Utils::OpenHandle(*latin1_ascii_string)->IsSeqAsciiString()); |
824 CHECK(v8::Utils::OpenHandle(*latin1_string)->IsSeqTwoByteString()); | 824 CHECK(v8::Utils::OpenHandle(*latin1_string)->IsSeqTwoByteString()); |
825 CHECK(v8::Utils::OpenHandle(*concat_string)->IsConsString()); | 825 CHECK(v8::Utils::OpenHandle(*concat_string)->IsConsString()); |
826 CHECK(v8::Utils::OpenHandle(*sub_string)->IsSlicedString()); | 826 CHECK(v8::Utils::OpenHandle(*sub_string)->IsSlicedString()); |
827 | 827 |
828 char buffer[64]; | 828 char buffer[64]; |
829 CHECK_EQ(strlen(latin1_ascii), latin1_ascii_string->WriteLatin1(buffer)); | 829 CHECK_EQ(static_cast<int>(strlen(latin1_ascii)), |
| 830 latin1_ascii_string->WriteLatin1(buffer)); |
830 CHECK_EQ(0, strcmp(latin1_ascii, buffer)); | 831 CHECK_EQ(0, strcmp(latin1_ascii, buffer)); |
831 CHECK_EQ(strlen(latin1), latin1_string->WriteLatin1(buffer)); | 832 CHECK_EQ(static_cast<int>(strlen(latin1)), |
| 833 latin1_string->WriteLatin1(buffer)); |
832 CHECK_EQ(0, strcmp(latin1, buffer)); | 834 CHECK_EQ(0, strcmp(latin1, buffer)); |
833 CHECK_EQ(strlen(concat), concat_string->WriteLatin1(buffer)); | 835 CHECK_EQ(static_cast<int>(strlen(concat)), |
| 836 concat_string->WriteLatin1(buffer)); |
834 CHECK_EQ(0, strcmp(concat, buffer)); | 837 CHECK_EQ(0, strcmp(concat, buffer)); |
835 CHECK_EQ(strlen(sub), sub_string->WriteLatin1(buffer)); | 838 CHECK_EQ(static_cast<int>(strlen(sub)), |
| 839 sub_string->WriteLatin1(buffer)); |
836 CHECK_EQ(0, strcmp(sub, buffer)); | 840 CHECK_EQ(0, strcmp(sub, buffer)); |
837 | 841 |
838 memset(buffer, 0x1, sizeof(buffer)); | 842 memset(buffer, 0x1, sizeof(buffer)); |
839 CHECK_EQ(strlen(latin1), | 843 CHECK_EQ(static_cast<int>(strlen(latin1)), |
840 latin1_string->WriteLatin1(buffer, | 844 latin1_string->WriteLatin1(buffer, |
841 0, | 845 0, |
842 String::kUndefinedLength, | 846 String::kUndefinedLength, |
843 String::NO_NULL_TERMINATION)); | 847 String::NO_NULL_TERMINATION)); |
844 CHECK_EQ(0, strncmp(latin1, buffer, strlen(latin1))); | 848 CHECK_EQ(0, strncmp(latin1, buffer, strlen(latin1))); |
845 CHECK_NE(0, strcmp(latin1, buffer)); | 849 CHECK_NE(0, strcmp(latin1, buffer)); |
846 buffer[strlen(latin1)] = '\0'; | 850 buffer[strlen(latin1)] = '\0'; |
847 CHECK_EQ(0, strcmp(latin1, buffer)); | 851 CHECK_EQ(0, strcmp(latin1, buffer)); |
848 | 852 |
849 CHECK_EQ(strlen(latin1) - 2, | 853 CHECK_EQ(static_cast<int>(strlen(latin1)) - 2, |
850 latin1_string->WriteLatin1(buffer, 2)); | 854 latin1_string->WriteLatin1(buffer, 2)); |
851 CHECK_EQ(0, strncmp(latin1 + 2, buffer, strlen(latin1))); | 855 CHECK_EQ(0, strncmp(latin1 + 2, buffer, strlen(latin1))); |
852 } | 856 } |
853 | 857 |
854 | 858 |
855 class TestLatin1Resource: public String::ExternalLatin1StringResource { | 859 class TestLatin1Resource: public String::ExternalLatin1StringResource { |
856 public: | 860 public: |
857 explicit TestLatin1Resource(const char* data, int* counter = NULL) | 861 explicit TestLatin1Resource(const char* data, int* counter = NULL) |
858 : data_(data), length_(strlen(data)), counter_(counter) { } | 862 : data_(data), length_(strlen(data)), counter_(counter) { } |
859 | 863 |
(...skipping 16862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17722 | 17726 |
17723 i::Semaphore* sem_; | 17727 i::Semaphore* sem_; |
17724 volatile int sem_value_; | 17728 volatile int sem_value_; |
17725 }; | 17729 }; |
17726 | 17730 |
17727 | 17731 |
17728 THREADED_TEST(SemaphoreInterruption) { | 17732 THREADED_TEST(SemaphoreInterruption) { |
17729 ThreadInterruptTest().RunTest(); | 17733 ThreadInterruptTest().RunTest(); |
17730 } | 17734 } |
17731 #endif // WIN32 | 17735 #endif // WIN32 |
OLD | NEW |