| 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 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2949 | 2949 |
| 2950 THREADED_TEST(ResettingGlobalHandle) { | 2950 THREADED_TEST(ResettingGlobalHandle) { |
| 2951 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 2951 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 2952 v8::Persistent<String> global; | 2952 v8::Persistent<String> global; |
| 2953 { | 2953 { |
| 2954 v8::HandleScope scope(isolate); | 2954 v8::HandleScope scope(isolate); |
| 2955 global.Reset(isolate, v8_str("str")); | 2955 global.Reset(isolate, v8_str("str")); |
| 2956 } | 2956 } |
| 2957 v8::internal::GlobalHandles* global_handles = | 2957 v8::internal::GlobalHandles* global_handles = |
| 2958 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); | 2958 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| 2959 int initial_handle_count = global_handles->NumberOfGlobalHandles(); | 2959 int initial_handle_count = global_handles->global_handles_count(); |
| 2960 { | 2960 { |
| 2961 v8::HandleScope scope(isolate); | 2961 v8::HandleScope scope(isolate); |
| 2962 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); | 2962 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); |
| 2963 } | 2963 } |
| 2964 { | 2964 { |
| 2965 v8::HandleScope scope(isolate); | 2965 v8::HandleScope scope(isolate); |
| 2966 global.Reset(isolate, v8_str("longer")); | 2966 global.Reset(isolate, v8_str("longer")); |
| 2967 } | 2967 } |
| 2968 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); | 2968 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count); |
| 2969 { | 2969 { |
| 2970 v8::HandleScope scope(isolate); | 2970 v8::HandleScope scope(isolate); |
| 2971 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6); | 2971 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6); |
| 2972 } | 2972 } |
| 2973 global.Dispose(isolate); | 2973 global.Dispose(isolate); |
| 2974 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1); | 2974 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1); |
| 2975 } | 2975 } |
| 2976 | 2976 |
| 2977 | 2977 |
| 2978 THREADED_TEST(ResettingGlobalHandleToEmpty) { | 2978 THREADED_TEST(ResettingGlobalHandleToEmpty) { |
| 2979 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 2979 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 2980 v8::Persistent<String> global; | 2980 v8::Persistent<String> global; |
| 2981 { | 2981 { |
| 2982 v8::HandleScope scope(isolate); | 2982 v8::HandleScope scope(isolate); |
| 2983 global.Reset(isolate, v8_str("str")); | 2983 global.Reset(isolate, v8_str("str")); |
| 2984 } | 2984 } |
| 2985 v8::internal::GlobalHandles* global_handles = | 2985 v8::internal::GlobalHandles* global_handles = |
| 2986 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); | 2986 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| 2987 int initial_handle_count = global_handles->NumberOfGlobalHandles(); | 2987 int initial_handle_count = global_handles->global_handles_count(); |
| 2988 { | 2988 { |
| 2989 v8::HandleScope scope(isolate); | 2989 v8::HandleScope scope(isolate); |
| 2990 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); | 2990 CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); |
| 2991 } | 2991 } |
| 2992 { | 2992 { |
| 2993 v8::HandleScope scope(isolate); | 2993 v8::HandleScope scope(isolate); |
| 2994 Local<String> empty; | 2994 Local<String> empty; |
| 2995 global.Reset(isolate, empty); | 2995 global.Reset(isolate, empty); |
| 2996 } | 2996 } |
| 2997 CHECK(global.IsEmpty()); | 2997 CHECK(global.IsEmpty()); |
| 2998 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1); | 2998 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1); |
| 2999 } | 2999 } |
| 3000 | 3000 |
| 3001 | 3001 |
| 3002 THREADED_TEST(ClearAndLeakGlobal) { | 3002 THREADED_TEST(ClearAndLeakGlobal) { |
| 3003 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 3003 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 3004 v8::internal::GlobalHandles* global_handles = NULL; | 3004 v8::internal::GlobalHandles* global_handles = NULL; |
| 3005 int initial_handle_count = 0; | 3005 int initial_handle_count = 0; |
| 3006 v8::Persistent<String> global; | 3006 v8::Persistent<String> global; |
| 3007 { | 3007 { |
| 3008 v8::HandleScope scope(isolate); | 3008 v8::HandleScope scope(isolate); |
| 3009 Local<String> str = v8_str("str"); | 3009 Local<String> str = v8_str("str"); |
| 3010 global_handles = | 3010 global_handles = |
| 3011 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); | 3011 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| 3012 initial_handle_count = global_handles->NumberOfGlobalHandles(); | 3012 initial_handle_count = global_handles->global_handles_count(); |
| 3013 global.Reset(isolate, str); | 3013 global.Reset(isolate, str); |
| 3014 } | 3014 } |
| 3015 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); | 3015 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1); |
| 3016 String* str = global.ClearAndLeak(); | 3016 String* str = global.ClearAndLeak(); |
| 3017 CHECK(global.IsEmpty()); | 3017 CHECK(global.IsEmpty()); |
| 3018 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); | 3018 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1); |
| 3019 global_handles->Destroy(reinterpret_cast<i::Object**>(str)); | 3019 global_handles->Destroy(reinterpret_cast<i::Object**>(str)); |
| 3020 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); | 3020 CHECK_EQ(global_handles->global_handles_count(), initial_handle_count); |
| 3021 } | 3021 } |
| 3022 | 3022 |
| 3023 | 3023 |
| 3024 THREADED_TEST(GlobalHandleUpcast) { | 3024 THREADED_TEST(GlobalHandleUpcast) { |
| 3025 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 3025 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 3026 v8::HandleScope scope(isolate); | 3026 v8::HandleScope scope(isolate); |
| 3027 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); | 3027 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |
| 3028 v8::Persistent<String> global_string(isolate, local); | 3028 v8::Persistent<String> global_string(isolate, local); |
| 3029 #ifdef V8_USE_UNSAFE_HANDLES | 3029 #ifdef V8_USE_UNSAFE_HANDLES |
| 3030 v8::Persistent<Value> global_value = | 3030 v8::Persistent<Value> global_value = |
| (...skipping 16306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19337 i::Semaphore* sem_; | 19337 i::Semaphore* sem_; |
| 19338 volatile int sem_value_; | 19338 volatile int sem_value_; |
| 19339 }; | 19339 }; |
| 19340 | 19340 |
| 19341 | 19341 |
| 19342 THREADED_TEST(SemaphoreInterruption) { | 19342 THREADED_TEST(SemaphoreInterruption) { |
| 19343 ThreadInterruptTest().RunTest(); | 19343 ThreadInterruptTest().RunTest(); |
| 19344 } | 19344 } |
| 19345 | 19345 |
| 19346 #endif // WIN32 | 19346 #endif // WIN32 |
| OLD | NEW |