| 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 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 { | 2532 { |
| 2533 v8::HandleScope scope(isolate); | 2533 v8::HandleScope scope(isolate); |
| 2534 Local<String> empty; | 2534 Local<String> empty; |
| 2535 global.Reset(isolate, empty); | 2535 global.Reset(isolate, empty); |
| 2536 } | 2536 } |
| 2537 CHECK(global.IsEmpty()); | 2537 CHECK(global.IsEmpty()); |
| 2538 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); | 2538 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); |
| 2539 } | 2539 } |
| 2540 | 2540 |
| 2541 | 2541 |
| 2542 THREADED_TEST(ClearAndLeakGlobal) { |
| 2543 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 2544 v8::internal::GlobalHandles* global_handles = NULL; |
| 2545 int initial_handle_count = 0; |
| 2546 v8::Persistent<String> global; |
| 2547 { |
| 2548 v8::HandleScope scope(isolate); |
| 2549 Local<String> str = v8_str("str"); |
| 2550 global_handles = |
| 2551 reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| 2552 initial_handle_count = global_handles->NumberOfGlobalHandles(); |
| 2553 global = v8::Persistent<String>::New(isolate, str); |
| 2554 } |
| 2555 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); |
| 2556 String* str = global.ClearAndLeak(); |
| 2557 CHECK(global.IsEmpty()); |
| 2558 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); |
| 2559 v8::Persistent<String>* new_global = |
| 2560 reinterpret_cast<v8::Persistent<String>*>(&str); |
| 2561 new_global->Dispose(); |
| 2562 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); |
| 2563 } |
| 2564 |
| 2565 |
| 2542 THREADED_TEST(LocalHandle) { | 2566 THREADED_TEST(LocalHandle) { |
| 2543 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 2567 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 2544 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); | 2568 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |
| 2545 CHECK_EQ(local->Length(), 3); | 2569 CHECK_EQ(local->Length(), 3); |
| 2546 | 2570 |
| 2547 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); | 2571 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); |
| 2548 CHECK_EQ(local->Length(), 3); | 2572 CHECK_EQ(local->Length(), 3); |
| 2549 } | 2573 } |
| 2550 | 2574 |
| 2551 | 2575 |
| (...skipping 16397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18949 i::Semaphore* sem_; | 18973 i::Semaphore* sem_; |
| 18950 volatile int sem_value_; | 18974 volatile int sem_value_; |
| 18951 }; | 18975 }; |
| 18952 | 18976 |
| 18953 | 18977 |
| 18954 THREADED_TEST(SemaphoreInterruption) { | 18978 THREADED_TEST(SemaphoreInterruption) { |
| 18955 ThreadInterruptTest().RunTest(); | 18979 ThreadInterruptTest().RunTest(); |
| 18956 } | 18980 } |
| 18957 | 18981 |
| 18958 #endif // WIN32 | 18982 #endif // WIN32 |
| OLD | NEW |