49 void init(uint32_t seed = 0x5688c73e) {
50 static const uint32_t phi = 0x9e3779b9;
55 Q[2] = seed + phi + phi;
56 for (
unsigned j = 3; j < kQSize; j++) {
57 Q[j] = Q[j - 3] ^ Q[j - 2] ^ phi ^ j;
63 uint32_t r = 0xfffffffe;
64 i = (i + 1) & (kQSize-1);
65 uint64_t t = a * Q[i] + c;
67 uint32_t x =
static_cast<uint32_t
>(t + c);
72 return (Q[i] = r - x);
79 bool next(
double threshold) {
80 ASSERT(threshold >= 0.0 && threshold <= 1.0);
81 if (threshold == 1.0)
return true;
82 if (threshold == 0.0)
return false;
83 uint32_t value =
next() % 100000;
84 return threshold >
static_cast<double>(value)/100000.0;
88 static const uint32_t kQSize = 4096;
95 using namespace v8::internal;
98 static const int DEEP_DEPTH = 8 * 1024;
99 static const int SUPER_DEEP_DEPTH = 80 * 1024;
104 Resource(
const uc16* data,
size_t length): data_(data), length_(length) {}
107 virtual size_t length()
const {
return length_; }
118 : data_(data), length_(length) {}
120 virtual const char*
data()
const {
return data_; }
121 virtual size_t length()
const {
return length_; }
129 static void InitializeBuildingBlocks(
Handle<String>* building_blocks,
137 for (
int i = 0; i < bb_length; i++) {
138 int len = rng->
next(16);
139 int slice_head_chars = 0;
140 int slice_tail_chars = 0;
142 for (
int j = 0; j < 3; j++) {
143 if (rng->
next(0.35)) slice_depth++;
147 while (slice_head_chars == 0 && slice_tail_chars == 0) {
148 slice_head_chars = rng->
next(15);
149 slice_tail_chars = rng->
next(12);
154 }
else if (len > 14) {
158 if (len == 0) slice_depth = 0;
159 int slice_length = slice_depth*(slice_head_chars + slice_tail_chars);
161 switch (rng->
next(4)) {
164 for (
int j = 0; j < len; j++) {
165 buf[j] = rng->
next(0x10000);
169 for (
int j = 0; j < len; j++) {
170 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
176 for (
int j = 0; j < len; j++) {
177 buf[j] = rng->
next(0x80);
181 for (
int j = 0; j < len; j++) {
182 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
187 uc16* buf = NewArray<uc16>(len);
188 for (
int j = 0; j < len; j++) {
189 buf[j] = rng->
next(0x10000);
195 for (
int j = 0; j < len; j++) {
196 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
201 char* buf = NewArray<char>(len);
202 for (
int j = 0; j < len; j++) {
203 buf[j] = rng->
next(0x80);
209 for (
int j = 0; j < len; j++) {
210 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
215 for (
int j = slice_depth; j > 0; j--) {
219 building_blocks[i]->length() - slice_tail_chars);
221 CHECK(len == building_blocks[i]->length() + slice_length);
247 left_traversals_ = 0;
248 right_traversals_ = 0;
263 static const int kNumberOfBuildingBlocks = 256;
288 InitializeBuildingBlocks(
289 building_blocks_, kNumberOfBuildingBlocks, long_blocks, &rng_);
296 return building_blocks_[offset % kNumberOfBuildingBlocks ];
302 return building_blocks_[offset % kNumberOfBuildingBlocks];
307 early_termination_threshold_ = 0.01;
310 empty_leaf_threshold_ = 0.02;
313 early_terminations_ = 0;
321 CHECK(cons_string->
length() == left_length + right_length);
323 bool left_is_cons = cons_string->
first()->IsConsString();
330 stats->
chars_ += left_length;
333 if (cons_string->
second()->IsConsString()) {
337 if (right_length == 0) {
339 CHECK(!left_is_cons);
342 stats->
chars_ += right_length;
349 if (cons_string->IsConsString()) {
353 stats->
chars_ += cons_string->length();
361 unsigned length =
static_cast<unsigned>(cons_string->
length());
363 String*
string = op.
Operate(cons_string, &offset, &type, &length);
366 ASSERT(!string->IsConsString());
369 stats->
chars_ +=
string->length();
371 bool keep_going_fast_check = op.
HasMore();
373 if (
string ==
NULL)
return;
375 CHECK(keep_going_fast_check);
382 CHECK(root->IsConsString());
402 unsigned max_recursion) {
405 bool terminate =
false;
410 terminate |= max_recursion == 0;
416 terminate |= terminate_early;
422 if (terminate_left) {
431 if (terminate_right) {
439 if (!terminate_right) {
441 if (!terminate_left && data->
rng_.
next(0.5)) {
442 left = ConstructRandomString(data, max_recursion - 1);
444 right = ConstructRandomString(data, max_recursion - 1);
446 if (!terminate_left && left.
is_null()) {
447 left = ConstructRandomString(data, max_recursion - 1);
451 CHECK(root->IsConsString() && !root->IsFlat());
456 CHECK(root->IsConsString() && root->IsFlat());
468 for (
int i = 0; i < depth; i++) {
486 for (
int i = depth - 1; i >= 0; i--) {
504 if (to - from == 1) {
506 return data->
block(from);
508 if (to - from == 2) {
514 ConstructBalancedHelper(data, from, from + ((to - from) / 2));
516 ConstructBalancedHelper(data, from + ((to - from) / 2), to);
539 while (character_stream_1.HasMore()) {
540 CHECK(character_stream_2.HasMore());
541 uint16_t c = character_stream_1.GetNext();
542 CHECK_EQ(c, character_stream_2.GetNext());
545 CHECK(!character_stream_1.HasMore());
546 CHECK(!character_stream_2.HasMore());
556 while (character_stream_1.HasMore() && i < chars) {
557 CHECK(character_stream_2.HasMore());
558 uint16_t c = character_stream_1.GetNext();
559 CHECK_EQ(c, character_stream_2.GetNext());
562 s1->Get(s1->length() - 1);
563 s2->Get(s2->length() - 1);
568 printf(
"TestTraverse\n");
574 Handle<String> left_asymmetric = ConstructLeft(&data, DEEP_DEPTH);
575 Handle<String> right_asymmetric = ConstructRight(&data, DEEP_DEPTH);
578 Traverse(flat, symmetric);
580 Traverse(flat, left_asymmetric);
582 Traverse(flat, right_asymmetric);
585 ConstructLeft(&data, SUPER_DEEP_DEPTH);
587 ConstructRight(&data, SUPER_DEEP_DEPTH);
589 TraverseFirst(left_asymmetric, left_deep_asymmetric, 1050);
591 TraverseFirst(left_asymmetric, right_deep_asymmetric, 65536);
595 Traverse(flat, left_asymmetric);
599 Traverse(flat, right_asymmetric);
603 Traverse(flat, symmetric);
610 static void VerifyCharacterStream(
613 CHECK(flat_string->
IsFlat() && !flat_string->IsConsString());
614 CHECK(cons_string->IsConsString());
616 int length = flat_string->
length();
618 int outer_iterations = length > 20 ? 20 : length;
619 for (
int j = 0; j <= outer_iterations; j++) {
620 int offset = length * j / outer_iterations;
621 if (offset < 0) offset = 0;
623 if (offset > length) offset = length;
625 flat_string, &cons_string_iterator_op_1, static_cast<unsigned>(offset));
627 cons_string, &cons_string_iterator_op_2, static_cast<unsigned>(offset));
628 for (
int i = offset; i < length; i++) {
630 CHECK(flat_stream.HasMore());
631 CHECK(cons_stream.HasMore());
635 CHECK(!flat_stream.HasMore());
636 CHECK(!cons_stream.HasMore());
644 "%s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d]\n",
655 template<
typename BuildString>
661 for (
int i = 0; i < test_cases; i++) {
682 flat_string->IsConsString() ?
685 VerifyCharacterStream(flat_string_ptr, *cons_string);
690 static const int kCharacterStreamNonRandomCases = 8;
699 return ConstructBalanced(data, 71);
701 return ConstructLeft(data, 71);
703 return ConstructRight(data, 71);
705 return ConstructLeft(data, 10);
707 return ConstructRight(data, 10);
765 TEST(StringCharacterStreamEdgeCases) {
766 printf(
"TestStringCharacterStreamEdgeCases\n");
768 BuildEdgeCaseConsString, kCharacterStreamNonRandomCases);
772 static const int kBalances = 3;
773 static const int kTreeLengths = 4;
774 static const int kEmptyLeaves = 4;
775 static const int kUniqueRandomParameters =
776 kBalances*kTreeLengths*kEmptyLeaves;
779 static void InitializeGenerationData(
784 static const int kPerTestJump = 501;
785 for (
int j = 0; j < test_case*kPerTestJump; j++) {
789 switch (test_case % kBalances) {
808 test_case /= kBalances;
810 switch (test_case % kTreeLengths) {
832 test_case /= kTreeLengths;
835 0.03 *
static_cast<double>(test_case % kEmptyLeaves);
841 InitializeGenerationData(test_case, data);
842 return ConstructRandomString(data, 200);
846 TEST(StringCharacterStreamRandom) {
847 printf(
"StringCharacterStreamRandom\n");
852 static const int DEEP_ASCII_DEPTH = 100000;
856 printf(
"TestDeepAscii\n");
861 char*
foo = NewArray<char>(DEEP_ASCII_DEPTH);
862 for (
int i = 0; i < DEEP_ASCII_DEPTH; i++) {
863 foo[i] =
"foo "[i % 4];
868 for (
int i = 0; i < DEEP_ASCII_DEPTH; i += 10) {
874 for (
int i = 0; i < 500; i++) {
875 TraverseFirst(flat_string,
string, DEEP_ASCII_DEPTH);
877 DeleteArray<char>(
foo);
886 const char* ascii_string =
"abcdef12345";
897 const uint16_t mixed_string[] = {0x02E4, 0x0064, 0x12E4, 0x0030, 0x3045};
899 const unsigned char as_utf8[11] = {0xCB, 0xA4, 0x64, 0xE1, 0x8B, 0xA4, 0x30,
900 0xE3, 0x81, 0x85, 0x00};
902 const int lengths[12] = {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11};
903 const int char_lengths[12] = {0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5};
909 const char kNoChar =
static_cast<char>(-1);
910 for (
int i = 0; i <= 11; i++) {
912 for (
int j = 0; j < 11; j++)
915 int written = mixed->
WriteUtf8(buffer, i, &chars_written);
917 CHECK_EQ(char_lengths[i], chars_written);
919 for (
int j = 0; j < lengths[i]; j++)
920 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j]));
922 for (
int j = lengths[i]; j < 11; j++)
933 static const int kMaxLength = 20;
943 for (
int i = 0; i <= kMaxLength; i++) {
944 char* ascii = NewArray<char>(i + 1);
945 for (
int j = 0; j < i; j++) {
955 ascii_external_string);
956 uc16* non_ascii = NewArray<uc16>(i + 1);
957 for (
int j = 0; j < i; j++) {
958 non_ascii[j] = 0x1234;
966 non_ascii_external_string);
971 global->
Set(v8_str(
"external_ascii"), ascii_external_strings);
972 global->
Set(v8_str(
"external_non_ascii"), non_ascii_external_strings);
973 global->
Set(v8_str(
"max_length"),
977 static const char* source =
979 " var ascii_chars = 'aaaaaaaaaaaaaaaaaaaa';"
980 " var non_ascii_chars = '\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234';"
981 " if (ascii_chars.length != max_length) return 1;"
982 " if (non_ascii_chars.length != max_length) return 2;"
983 " var ascii = Array(max_length + 1);"
984 " var non_ascii = Array(max_length + 1);"
985 " for (var i = 0; i <= max_length; i++) {"
986 " ascii[i] = ascii_chars.substring(0, i);"
987 " non_ascii[i] = non_ascii_chars.substring(0, i);"
989 " for (var i = 0; i <= max_length; i++) {"
990 " if (ascii[i] != external_ascii[i]) return 3;"
991 " if (non_ascii[i] != external_non_ascii[i]) return 4;"
992 " for (var j = 0; j < i; j++) {"
993 " if (external_ascii[i] !="
994 " (external_ascii[j] + external_ascii[i - j])) return 5;"
995 " if (external_non_ascii[i] !="
996 " (external_non_ascii[j] + external_non_ascii[i - j])) return 6;"
997 " if (non_ascii[i] != (non_ascii[j] + non_ascii[i - j])) return 7;"
998 " if (ascii[i] != (ascii[j] + ascii[i - j])) return 8;"
999 " if (ascii[i] != (external_ascii[j] + ascii[i - j])) return 9;"
1000 " if (ascii[i] != (ascii[j] + external_ascii[i - j])) return 10;"
1001 " if (non_ascii[i] !="
1002 " (external_non_ascii[j] + non_ascii[i - j])) return 11;"
1003 " if (non_ascii[i] !="
1004 " (non_ascii[j] + external_non_ascii[i - j])) return 12;"
1010 CHECK_EQ(0, CompileRun(source)->Int32Value());
1014 TEST(JSONStringifySliceMadeExternal) {
1020 CompileRun(
"var underlying = 'abcdefghijklmnopqrstuvwxyz';"
1023 CompileRun(
"var slice = underlying.slice(1);"
1028 int length = underlying->
Length();
1029 uc16* two_byte = NewArray<uc16>(length + 1);
1030 underlying->
Write(two_byte);
1036 CHECK_EQ(
"\"bcdefghijklmnopqrstuvwxyz\"",
1051 const char* lines[] = {
1054 "var s = \"1073741828\";",
1066 isolate->
factory()->undefined_value(),
1067 isolate->
factory()->undefined_value(),
1074 for (
int i = 0; (line = lines[i]); i++) {
1075 printf(
"%s\n", line);
1078 CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined());
1079 CHECK_EQ(results[i]->IsNumber(), result->IsNumber());
1080 if (result->IsNumber()) {
1082 result->ToInt32()->Value());
1089 FLAG_string_slices =
true;
1096 CHECK(parent->IsConsString());
1097 CHECK(!parent->IsFlat());
1100 CHECK(parent->IsFlat());
1101 CHECK(slice->IsSlicedString());
1107 CHECK(slice->IsFlat());
1116 virtual size_t length()
const {
return data_.length(); }
1117 virtual const char*
data()
const {
return data_.start(); }
1124 FLAG_string_slices =
true;
1131 CHECK(string->IsExternalString());
1133 CHECK(slice->IsSlicedString());
1134 CHECK(string->IsExternalString());
1137 CHECK(slice->IsFlat());
1144 FLAG_string_slices =
true;
1150 const char* init =
"var str = 'abcdefghijklmnopqrstuvwxyz';";
1151 const char*
check =
"str.slice(0,26)";
1152 const char* crosscheck =
"str.slice(1,25)";
1156 result = CompileRun(check);
1157 CHECK(result->IsString());
1159 CHECK(!string->IsSlicedString());
1162 CHECK(!string->IsSlicedString());
1163 result = CompileRun(crosscheck);
1164 CHECK(result->IsString());
1166 CHECK(string->IsSlicedString());
1167 CHECK_EQ(
"bcdefghijklmnopqrstuvwxy", string->ToCString().get());
1174 FLAG_string_slices =
true;
1179 const char* init =
"var str = 'abcdefghijklmnopqrstuvwxyz';";
1180 const char* slice =
"var slice = str.slice(1,-1); slice";
1181 const char* slice_from_slice =
"slice.slice(1,-1);";
1184 result = CompileRun(slice);
1185 CHECK(result->IsString());
1187 CHECK(string->IsSlicedString());
1189 CHECK_EQ(
"bcdefghijklmnopqrstuvwxy", string->ToCString().get());
1191 result = CompileRun(slice_from_slice);
1192 CHECK(result->IsString());
1194 CHECK(string->IsSlicedString());
1196 CHECK_EQ(
"cdefghijklmnopqrstuvwx", string->ToCString().get());
1202 static const int K = 1024;
1216 "var two_14 = Math.pow(2, 14);"
1217 "var two_17 = Math.pow(2, 17);"
1218 "var s = Array(two_17 + 1).join('c');"
1220 "for (var i = 1; i <= two_14; i++) a.push(s);"
1221 "a.join("");").IsEmpty());
1226 static void CheckException(
const char* source) {
1228 CHECK(CompileRun(source).IsEmpty());
1235 FLAG_allow_natives_syntax =
true;
1240 CompileRun(
"var short = 'abcdef';");
1243 CheckException(
"%_SubString(short, 0, 10000);");
1244 CheckException(
"%_SubString(short, -1234, 5);");
1245 CheckException(
"%_SubString(short, 5, 2);");
1247 CheckException(
"%_SubString(short, 1, Infinity);");
1248 CheckException(
"%_SubString(short, NaN, 5);");
1250 CheckException(
"%_SubString(short, '2', '5');");
1252 result = CompileRun(
"%_SubString(short, Math.sqrt(4), 5.1);");
1254 CHECK_EQ(
"cde", string->ToCString().get());
1256 CompileRun(
"var long = 'abcdefghijklmnopqrstuvwxyz';");
1258 CheckException(
"%_SubString(long, 0, 10000);");
1259 CheckException(
"%_SubString(long, -1234, 17);");
1260 CheckException(
"%_SubString(long, 17, 2);");
1262 CheckException(
"%_SubString(long, 1, Infinity);");
1263 CheckException(
"%_SubString(long, NaN, 17);");
1265 CheckException(
"%_SubString(long, '2', '17');");
1267 result = CompileRun(
"%_SubString(long, Math.sqrt(4), 17.1);");
1269 CHECK_EQ(
"cdefghijklmnopq", string->ToCString().get());
1273 CompileRun(
"var slice = long.slice(1, 15);");
1274 CheckException(
"%_SubString(slice, 0, 17);");
1278 TEST(StringReplaceAtomTwoByteResult) {
1283 "var subject = 'ascii~only~string~'; "
1284 "var replace = '\x80'; "
1285 "subject.replace(/~/g, replace); ");
1286 CHECK(result->IsString());
1288 CHECK(string->IsSeqTwoByteString());
1291 CHECK(expected->Equals(result));
1302 template<
typename Op,
bool return_first>
1304 uint32_t result[Op::kMaxWidth];
1306 chars = Op::Convert(c, 0, result,
NULL);
1307 if (chars == 0)
return 0;
1308 CHECK_LE(chars, static_cast<int>(
sizeof(result)));
1309 if (!return_first && chars > 1) {
1317 uint16_t expect = ConvertLatin1<unibrow::Ecma262UnCanonicalize, true>(c);
1324 using namespace unibrow;
1325 for (
uint16_t c = Latin1::kMaxChar + 1; c != 0; c++) {
1326 uint16_t lower = ConvertLatin1<ToLowercase, false>(c);
1327 uint16_t upper = ConvertLatin1<ToUppercase, false>(c);
1328 uint16_t test = Latin1::ConvertNonLatin1ToLatin1(c);
1330 if (lower == 0 && upper == 0) {
1331 CheckCanonicalEquivalence(c, test);
1334 if (lower > Latin1::kMaxChar && upper > Latin1::kMaxChar) {
1335 CheckCanonicalEquivalence(c, test);
1338 if (lower == 0 && upper != 0) {
1339 lower = ConvertLatin1<ToLowercase, false>(upper);
1341 if (upper == 0 && lower != c) {
1342 upper = ConvertLatin1<ToUppercase, false>(lower);
1344 if (lower > Latin1::kMaxChar && upper > Latin1::kMaxChar) {
1345 CheckCanonicalEquivalence(c, test);
1348 if (upper != c && lower != c) {
1349 CheckCanonicalEquivalence(c, test);
1360 virtual size_t length()
const {
return 1 << 30; }
1367 virtual size_t length()
const {
return 1 << 30; }
1391 #define INVALID_STRING_TEST(FUN, TYPE) \
1392 TEST(StringOOM##FUN) { \
1393 CcTest::InitializeVM(); \
1394 LocalContext context; \
1395 Isolate* isolate = CcTest::i_isolate(); \
1396 STATIC_ASSERT(String::kMaxLength < kMaxInt); \
1397 static const int invalid = String::kMaxLength + 1; \
1398 HandleScope scope(isolate); \
1399 Vector<TYPE> dummy = Vector<TYPE>::New(invalid); \
1400 CHECK(isolate->factory()->FUN(Vector<const TYPE>::cast(dummy)).is_null()); \
1401 memset(dummy.start(), 0x20, dummy.length() * sizeof(TYPE)); \
1402 CHECK(isolate->has_pending_exception()); \
1403 isolate->clear_pending_exception(); \
1413 #undef INVALID_STRING_TEST
MyRandomNumberGenerator()
void init(uint32_t seed=0x5688c73e)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
void TestStringCharacterStream(BuildString build, int test_cases)
void FlattenString(Handle< String > string)
int WriteUtf8(char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const
void set_max_young_space_size(int value)
Handle< String > NewExternalStringFromAscii(const ExternalAsciiString::Resource *resource)
#define CHECK_EQ(expected, value)
static const unsigned kMaxChar
virtual size_t length() const
static Smi * FromInt(int value)
Handle< String > NewStringFromAscii(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
String * ContinueOperation(int32_t *type_out, unsigned *length_out)
unsigned right_traversals_
#define ASSERT(condition)
double empty_leaf_threshold_
void clear_pending_exception()
static Local< Integer > New(Isolate *isolate, int32_t value)
Local< String > ToString() const
bool next(double threshold)
virtual const char * data() const
unsigned left_traversals_
static Smi * cast(Object *object)
static bool IsAscii(const char *chars, int length)
virtual size_t length() const
static bool IsOneByte(const uc16 *chars, int length)
static const int kMinLength
bool MakeExternal(ExternalStringResource *resource)
#define INVALID_STRING_TEST(FUN, TYPE)
double early_termination_threshold_
virtual size_t length() const
void set_max_old_space_size(int value)
Handle< String > NewSubString(Handle< String > str, int begin, int end)
static SlicedString * cast(Object *obj)
bool V8_EXPORT SetResourceConstraints(Isolate *isolate, ResourceConstraints *constraints)
void check(i::Vector< const uint8_t > string)
virtual ~AsciiVectorResource()
MyRandomNumberGenerator rng_
AsciiResource(const char *data, size_t length)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *script_data=NULL)
virtual size_t length() const
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Handle< String > NewStringFromTwoByte(Vector< const uc16 > str, PretenureFlag pretenure=NOT_TENURED)
static i::Isolate * i_isolate()
void VerifyEqual(const ConsStringStats &that) const
bool has_pending_exception()
void AccumulateStats(ConsString *cons_string, ConsStringStats *stats)
static V8_INLINE String * Cast(v8::Value *obj)
virtual const uint16_t * data() const
virtual const char * data() const
virtual const char * data() const
static Local< String > NewFromTwoByte(Isolate *isolate, const uint16_t *data, NewStringType type=kNormalString, int length=-1)
static Local< Array > New(Isolate *isolate, int length=0)
void VerifyConsString(Handle< String > root, ConsStringGenerationData *data)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
#define CHECK_NE(unexpected, value)
Vector< const char > CStrVector(const char *data)
int StrLength(const char *string)
void AccumulateStatsWithOperator(ConsString *cons_string, ConsStringStats *stats)
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
static void InitializeVM()
ConsStringGenerationData(bool long_blocks)
unsigned early_terminations_
static Local< String > NewExternal(Isolate *isolate, ExternalStringResource *resource)
AsciiVectorResource(i::Vector< const char > vector)
InstanceType instance_type()
virtual size_t length() const
Handle< String > block(int offset)
Resource(const uc16 *data, size_t length)
Handle< String > NewConsString(Handle< String > left, Handle< String > right)
void DeleteArray(T *array)
static ConsString * cast(Object *obj)
virtual const uint16_t * data() const
String * Operate(String *string, unsigned *offset_out, int32_t *type_out, unsigned *length_out)
int Write(uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
bool Set(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
static v8::Isolate * isolate()
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)