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 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 String* str = global.ClearAndLeak(); | 2876 String* str = global.ClearAndLeak(); |
2877 CHECK(global.IsEmpty()); | 2877 CHECK(global.IsEmpty()); |
2878 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); | 2878 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); |
2879 v8::Persistent<String>* new_global = | 2879 v8::Persistent<String>* new_global = |
2880 reinterpret_cast<v8::Persistent<String>*>(&str); | 2880 reinterpret_cast<v8::Persistent<String>*>(&str); |
2881 new_global->Dispose(); | 2881 new_global->Dispose(); |
2882 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); | 2882 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); |
2883 } | 2883 } |
2884 | 2884 |
2885 | 2885 |
| 2886 THREADED_TEST(GlobalHandleUpcast) { |
| 2887 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 2888 v8::HandleScope scope(isolate); |
| 2889 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |
| 2890 v8::Persistent<String> global_string(isolate, local); |
| 2891 v8::Persistent<Value>& global_value = |
| 2892 v8::Persistent<Value>::Upcast(global_string); |
| 2893 CHECK(global_value->IsString()); |
| 2894 CHECK(global_string == v8::Persistent<String>::Cast(global_value)); |
| 2895 global_string.Dispose(); |
| 2896 } |
| 2897 |
| 2898 |
2886 THREADED_TEST(LocalHandle) { | 2899 THREADED_TEST(LocalHandle) { |
2887 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 2900 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
2888 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); | 2901 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |
2889 CHECK_EQ(local->Length(), 3); | 2902 CHECK_EQ(local->Length(), 3); |
2890 | 2903 |
2891 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); | 2904 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); |
2892 CHECK_EQ(local->Length(), 3); | 2905 CHECK_EQ(local->Length(), 3); |
2893 } | 2906 } |
2894 | 2907 |
2895 | 2908 |
(...skipping 16198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19094 i::Semaphore* sem_; | 19107 i::Semaphore* sem_; |
19095 volatile int sem_value_; | 19108 volatile int sem_value_; |
19096 }; | 19109 }; |
19097 | 19110 |
19098 | 19111 |
19099 THREADED_TEST(SemaphoreInterruption) { | 19112 THREADED_TEST(SemaphoreInterruption) { |
19100 ThreadInterruptTest().RunTest(); | 19113 ThreadInterruptTest().RunTest(); |
19101 } | 19114 } |
19102 | 19115 |
19103 #endif // WIN32 | 19116 #endif // WIN32 |
OLD | NEW |