| 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 6275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6286 int len) { | 6286 int len) { |
| 6287 Local<v8::Array> a = | 6287 Local<v8::Array> a = |
| 6288 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); | 6288 Local<v8::Array>::Cast(context->Global()->Get(v8_str(name))); |
| 6289 Local<v8::Array> alens = | 6289 Local<v8::Array> alens = |
| 6290 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); | 6290 Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name))); |
| 6291 for (int i = 0; i < len; i++) { | 6291 for (int i = 0; i < len; i++) { |
| 6292 Local<v8::String> string = | 6292 Local<v8::String> string = |
| 6293 Local<v8::String>::Cast(a->Get(i)); | 6293 Local<v8::String>::Cast(a->Get(i)); |
| 6294 Local<v8::Number> expected_len = | 6294 Local<v8::Number> expected_len = |
| 6295 Local<v8::Number>::Cast(alens->Get(i)); | 6295 Local<v8::Number>::Cast(alens->Get(i)); |
| 6296 #ifndef ENABLE_LATIN_1 |
| 6296 CHECK_EQ(expected_len->Value() != string->Length(), | 6297 CHECK_EQ(expected_len->Value() != string->Length(), |
| 6297 string->MayContainNonAscii()); | 6298 string->MayContainNonAscii()); |
| 6299 #endif |
| 6298 int length = GetUtf8Length(string); | 6300 int length = GetUtf8Length(string); |
| 6299 CHECK_EQ(static_cast<int>(expected_len->Value()), length); | 6301 CHECK_EQ(static_cast<int>(expected_len->Value()), length); |
| 6300 } | 6302 } |
| 6301 } | 6303 } |
| 6302 | 6304 |
| 6303 | 6305 |
| 6304 static uint16_t StringGet(Handle<String> str, int index) { | 6306 static uint16_t StringGet(Handle<String> str, int index) { |
| 6305 i::Handle<i::String> istring = | 6307 i::Handle<i::String> istring = |
| 6306 v8::Utils::OpenHandle(String::Cast(*str)); | 6308 v8::Utils::OpenHandle(String::Cast(*str)); |
| 6307 return istring->Get(index); | 6309 return istring->Get(index); |
| (...skipping 6558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12866 FACTORY->NewExternalStringFromAscii(&ascii_resource))); | 12868 FACTORY->NewExternalStringFromAscii(&ascii_resource))); |
| 12867 | 12869 |
| 12868 env->Global()->Set(v8_str("lhs"), lhs); | 12870 env->Global()->Set(v8_str("lhs"), lhs); |
| 12869 env->Global()->Set(v8_str("rhs"), rhs); | 12871 env->Global()->Set(v8_str("rhs"), rhs); |
| 12870 | 12872 |
| 12871 CompileRun( | 12873 CompileRun( |
| 12872 "var cons = lhs + rhs;" | 12874 "var cons = lhs + rhs;" |
| 12873 "var slice = lhs.substring(1, lhs.length - 1);" | 12875 "var slice = lhs.substring(1, lhs.length - 1);" |
| 12874 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); | 12876 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); |
| 12875 | 12877 |
| 12878 #ifndef ENABLE_LATIN_1 |
| 12876 CHECK(!lhs->MayContainNonAscii()); | 12879 CHECK(!lhs->MayContainNonAscii()); |
| 12877 CHECK(!rhs->MayContainNonAscii()); | 12880 CHECK(!rhs->MayContainNonAscii()); |
| 12881 #endif |
| 12878 | 12882 |
| 12879 MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource); | 12883 MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource); |
| 12880 MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource); | 12884 MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource); |
| 12881 | 12885 |
| 12882 // This should UTF-8 without flattening, since everything is ASCII. | 12886 // This should UTF-8 without flattening, since everything is ASCII. |
| 12883 Handle<String> cons = v8_compile("cons")->Run().As<String>(); | 12887 Handle<String> cons = v8_compile("cons")->Run().As<String>(); |
| 12884 CHECK_EQ(128, cons->Utf8Length()); | 12888 CHECK_EQ(128, cons->Utf8Length()); |
| 12885 int nchars = -1; | 12889 int nchars = -1; |
| 12886 CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars)); | 12890 CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars)); |
| 12887 CHECK_EQ(128, nchars); | 12891 CHECK_EQ(128, nchars); |
| (...skipping 5301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18189 | 18193 |
| 18190 i::Semaphore* sem_; | 18194 i::Semaphore* sem_; |
| 18191 volatile int sem_value_; | 18195 volatile int sem_value_; |
| 18192 }; | 18196 }; |
| 18193 | 18197 |
| 18194 | 18198 |
| 18195 THREADED_TEST(SemaphoreInterruption) { | 18199 THREADED_TEST(SemaphoreInterruption) { |
| 18196 ThreadInterruptTest().RunTest(); | 18200 ThreadInterruptTest().RunTest(); |
| 18197 } | 18201 } |
| 18198 #endif // WIN32 | 18202 #endif // WIN32 |
| OLD | NEW |