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

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

Issue 12700008: remove latin-1 flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: removed SeqOneByteStringVerify Created 7 years, 9 months 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 | « src/x64/regexp-macro-assembler-x64.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6241 matching lines...) Expand 10 before | Expand all | Expand 10 after
6252 int len) { 6252 int len) {
6253 Local<v8::Array> a = 6253 Local<v8::Array> a =
6254 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); 6254 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name)));
6255 Local<v8::Array> alens = 6255 Local<v8::Array> alens =
6256 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); 6256 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name)));
6257 for (int i = 0; i < len; i++) { 6257 for (int i = 0; i < len; i++) {
6258 Local<v8::String> string = 6258 Local<v8::String> string =
6259 Local<v8::String>::Cast(a->Get(i)); 6259 Local<v8::String>::Cast(a->Get(i));
6260 Local<v8::Number> expected_len = 6260 Local<v8::Number> expected_len =
6261 Local<v8::Number>::Cast(alens->Get(i)); 6261 Local<v8::Number>::Cast(alens->Get(i));
6262 #ifndef ENABLE_LATIN_1
6263 CHECK_EQ(expected_len->Value() != string->Length(),
6264 string->MayContainNonAscii());
6265 #endif
6266 int length = GetUtf8Length(string); 6262 int length = GetUtf8Length(string);
6267 CHECK_EQ(static_cast<int>(expected_len->Value()), length); 6263 CHECK_EQ(static_cast<int>(expected_len->Value()), length);
6268 } 6264 }
6269 } 6265 }
6270 6266
6271 6267
6272 static uint16_t StringGet(Handle<String> str, int index) { 6268 static uint16_t StringGet(Handle<String> str, int index) {
6273 i::Handle<i::String> istring = 6269 i::Handle<i::String> istring =
6274 v8::Utils::OpenHandle(String::Cast(*str)); 6270 v8::Utils::OpenHandle(String::Cast(*str));
6275 return istring->Get(index); 6271 return istring->Get(index);
(...skipping 6648 matching lines...) Expand 10 before | Expand all | Expand 10 after
12924 FACTORY->NewExternalStringFromAscii(&ascii_resource))); 12920 FACTORY->NewExternalStringFromAscii(&ascii_resource)));
12925 12921
12926 env->Global()->Set(v8_str("lhs"), lhs); 12922 env->Global()->Set(v8_str("lhs"), lhs);
12927 env->Global()->Set(v8_str("rhs"), rhs); 12923 env->Global()->Set(v8_str("rhs"), rhs);
12928 12924
12929 CompileRun( 12925 CompileRun(
12930 "var cons = lhs + rhs;" 12926 "var cons = lhs + rhs;"
12931 "var slice = lhs.substring(1, lhs.length - 1);" 12927 "var slice = lhs.substring(1, lhs.length - 1);"
12932 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); 12928 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);");
12933 12929
12934 #ifndef ENABLE_LATIN_1 12930 CHECK(lhs->IsOneByte());
12935 CHECK(!lhs->MayContainNonAscii()); 12931 CHECK(rhs->IsOneByte());
12936 CHECK(!rhs->MayContainNonAscii());
12937 #endif
12938 12932
12939 MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource); 12933 MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource);
12940 MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource); 12934 MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource);
12941 12935
12942 // This should UTF-8 without flattening, since everything is ASCII. 12936 // This should UTF-8 without flattening, since everything is ASCII.
12943 Handle<String> cons = v8_compile("cons")->Run().As<String>(); 12937 Handle<String> cons = v8_compile("cons")->Run().As<String>();
12944 CHECK_EQ(128, cons->Utf8Length()); 12938 CHECK_EQ(128, cons->Utf8Length());
12945 int nchars = -1; 12939 int nchars = -1;
12946 CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars)); 12940 CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars));
12947 CHECK_EQ(128, nchars); 12941 CHECK_EQ(128, nchars);
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after
18327 i::Semaphore* sem_; 18321 i::Semaphore* sem_;
18328 volatile int sem_value_; 18322 volatile int sem_value_;
18329 }; 18323 };
18330 18324
18331 18325
18332 THREADED_TEST(SemaphoreInterruption) { 18326 THREADED_TEST(SemaphoreInterruption) {
18333 ThreadInterruptTest().RunTest(); 18327 ThreadInterruptTest().RunTest();
18334 } 18328 }
18335 18329
18336 #endif // WIN32 18330 #endif // WIN32
OLDNEW
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698