OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 | 2 |
3 // Check that we can traverse very deep stacks of ConsStrings using | 3 // Check that we can traverse very deep stacks of ConsStrings using |
4 // StringInputBuffer. Check that Get(int) works on very deep stacks | 4 // StringInputBuffer. Check that Get(int) works on very deep stacks |
5 // of ConsStrings. These operations may not be very fast, but they | 5 // of ConsStrings. These operations may not be very fast, but they |
6 // should be possible without getting errors due to too deep recursion. | 6 // should be possible without getting errors due to too deep recursion. |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "v8.h" | 10 #include "v8.h" |
11 | 11 |
12 #include "api.h" | 12 #include "api.h" |
13 #include "factory.h" | 13 #include "factory.h" |
14 #include "objects.h" | |
15 #include "cctest.h" | 14 #include "cctest.h" |
16 #include "zone-inl.h" | 15 #include "zone-inl.h" |
17 | 16 |
18 unsigned int seed = 123; | 17 unsigned int seed = 123; |
19 | 18 |
20 static uint32_t gen() { | 19 static uint32_t gen() { |
21 uint64_t z; | 20 uint64_t z; |
22 z = seed; | 21 z = seed; |
23 z *= 279470273; | 22 z *= 279470273; |
24 z %= 4294967291U; | 23 z %= 4294967291U; |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 "var subject = 'ascii~only~string~'; " | 701 "var subject = 'ascii~only~string~'; " |
703 "var replace = '\x80'; " | 702 "var replace = '\x80'; " |
704 "subject.replace(/~/g, replace); "); | 703 "subject.replace(/~/g, replace); "); |
705 CHECK(result->IsString()); | 704 CHECK(result->IsString()); |
706 Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result)); | 705 Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result)); |
707 CHECK(string->IsSeqTwoByteString()); | 706 CHECK(string->IsSeqTwoByteString()); |
708 | 707 |
709 v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80"); | 708 v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80"); |
710 CHECK(expected->Equals(result)); | 709 CHECK(expected->Equals(result)); |
711 } | 710 } |
712 | |
713 | |
714 TEST(IsAscii) { | |
715 CHECK(String::IsAscii(static_cast<char*>(NULL), 0)); | |
716 CHECK(String::IsAscii(static_cast<uc16*>(NULL), 0)); | |
717 } | |
OLD | NEW |