Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: test/cctest/test-strings.cc

Issue 462018: Fix compilation errors on some compilers (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Add the arrays with the short external strings in the global object. 390 // Add the arrays with the short external strings in the global object.
391 v8::Handle<v8::Object> global = env->Global(); 391 v8::Handle<v8::Object> global = env->Global();
392 global->Set(v8_str("external_ascii"), ascii_external_strings); 392 global->Set(v8_str("external_ascii"), ascii_external_strings);
393 global->Set(v8_str("external_non_ascii"), non_ascii_external_strings); 393 global->Set(v8_str("external_non_ascii"), non_ascii_external_strings);
394 global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength)); 394 global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength));
395 395
396 // Add short external ascii and non-ascii strings checking the result. 396 // Add short external ascii and non-ascii strings checking the result.
397 static const char* source = 397 static const char* source =
398 "function test() {" 398 "function test() {"
399 " var ascii_chars = 'aaaaaaaaaaaaaaaaaaaa';" 399 " var ascii_chars = 'aaaaaaaaaaaaaaaaaaaa';"
400 " var non_ascii_chars = '\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u 1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234\u1234';" //NOL INT 400 " var non_ascii_chars = '\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\ \u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1 234\\u1234';" //NOLINT
401 " if (ascii_chars.length != max_length) return 1;" 401 " if (ascii_chars.length != max_length) return 1;"
402 " if (non_ascii_chars.length != max_length) return 2;" 402 " if (non_ascii_chars.length != max_length) return 2;"
403 " var ascii = Array(max_length + 1);" 403 " var ascii = Array(max_length + 1);"
404 " var non_ascii = Array(max_length + 1);" 404 " var non_ascii = Array(max_length + 1);"
405 " for (var i = 0; i <= max_length; i++) {" 405 " for (var i = 0; i <= max_length; i++) {"
406 " ascii[i] = ascii_chars.substring(0, i);" 406 " ascii[i] = ascii_chars.substring(0, i);"
407 " non_ascii[i] = non_ascii_chars.substring(0, i);" 407 " non_ascii[i] = non_ascii_chars.substring(0, i);"
408 " };" 408 " };"
409 " for (var i = 0; i <= max_length; i++) {" 409 " for (var i = 0; i <= max_length; i++) {"
410 " if (ascii[i] != external_ascii[i]) return 3;" 410 " if (ascii[i] != external_ascii[i]) return 3;"
(...skipping 12 matching lines...) Expand all
423 " if (non_ascii[i] !=" 423 " if (non_ascii[i] !="
424 " (non_ascii[j] + external_non_ascii[i - j])) return 12;" 424 " (non_ascii[j] + external_non_ascii[i - j])) return 12;"
425 " }" 425 " }"
426 " }" 426 " }"
427 " return 0;" 427 " return 0;"
428 "};" 428 "};"
429 "test()"; 429 "test()";
430 CHECK_EQ(0, 430 CHECK_EQ(0,
431 v8::Script::Compile(v8::String::New(source))->Run()->Int32Value()); 431 v8::Script::Compile(v8::String::New(source))->Run()->Int32Value());
432 } 432 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698