| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 | 237 |
| 238 static int NumberOfWeakCalls = 0; | 238 static int NumberOfWeakCalls = 0; |
| 239 static void WeakPointerCallback( | 239 static void WeakPointerCallback( |
| 240 const v8::WeakCallbackData<v8::Value, void>& data) { | 240 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 241 std::pair<v8::Persistent<v8::Value>*, int>* p = | 241 std::pair<v8::Persistent<v8::Value>*, int>* p = |
| 242 reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( | 242 reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( |
| 243 data.GetParameter()); | 243 data.GetParameter()); |
| 244 ASSERT_EQ(1234, p->second); | 244 DCHECK_EQ(1234, p->second); |
| 245 NumberOfWeakCalls++; | 245 NumberOfWeakCalls++; |
| 246 p->first->Reset(); | 246 p->first->Reset(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 | 249 |
| 250 TEST(ObjectGroups) { | 250 TEST(ObjectGroups) { |
| 251 FLAG_incremental_marking = false; | 251 FLAG_incremental_marking = false; |
| 252 CcTest::InitializeVM(); | 252 CcTest::InitializeVM(); |
| 253 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 253 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
| 254 TestHeap* heap = CcTest::test_heap(); | 254 TestHeap* heap = CcTest::test_heap(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 | 360 |
| 361 | 361 |
| 362 class TestRetainedObjectInfo : public v8::RetainedObjectInfo { | 362 class TestRetainedObjectInfo : public v8::RetainedObjectInfo { |
| 363 public: | 363 public: |
| 364 TestRetainedObjectInfo() : has_been_disposed_(false) {} | 364 TestRetainedObjectInfo() : has_been_disposed_(false) {} |
| 365 | 365 |
| 366 bool has_been_disposed() { return has_been_disposed_; } | 366 bool has_been_disposed() { return has_been_disposed_; } |
| 367 | 367 |
| 368 virtual void Dispose() { | 368 virtual void Dispose() { |
| 369 ASSERT(!has_been_disposed_); | 369 DCHECK(!has_been_disposed_); |
| 370 has_been_disposed_ = true; | 370 has_been_disposed_ = true; |
| 371 } | 371 } |
| 372 | 372 |
| 373 virtual bool IsEquivalent(v8::RetainedObjectInfo* other) { | 373 virtual bool IsEquivalent(v8::RetainedObjectInfo* other) { |
| 374 return other == this; | 374 return other == this; |
| 375 } | 375 } |
| 376 | 376 |
| 377 virtual intptr_t GetHash() { return 0; } | 377 virtual intptr_t GetHash() { return 0; } |
| 378 | 378 |
| 379 virtual const char* GetLabel() { return "whatever"; } | 379 virtual const char* GetLabel() { return "whatever"; } |
| 380 | 380 |
| 381 private: | 381 private: |
| 382 bool has_been_disposed_; | 382 bool has_been_disposed_; |
| 383 }; | 383 }; |
| 384 | 384 |
| 385 | 385 |
| 386 TEST(EmptyObjectGroups) { | 386 TEST(EmptyObjectGroups) { |
| 387 CcTest::InitializeVM(); | 387 CcTest::InitializeVM(); |
| 388 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 388 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
| 389 | 389 |
| 390 v8::HandleScope handle_scope(CcTest::isolate()); | 390 v8::HandleScope handle_scope(CcTest::isolate()); |
| 391 | 391 |
| 392 Handle<Object> object = global_handles->Create( | 392 Handle<Object> object = global_handles->Create( |
| 393 CcTest::test_heap()->AllocateFixedArray(1).ToObjectChecked()); | 393 CcTest::test_heap()->AllocateFixedArray(1).ToObjectChecked()); |
| 394 | 394 |
| 395 TestRetainedObjectInfo info; | 395 TestRetainedObjectInfo info; |
| 396 global_handles->AddObjectGroup(NULL, 0, &info); | 396 global_handles->AddObjectGroup(NULL, 0, &info); |
| 397 ASSERT(info.has_been_disposed()); | 397 DCHECK(info.has_been_disposed()); |
| 398 | 398 |
| 399 global_handles->AddImplicitReferences( | 399 global_handles->AddImplicitReferences( |
| 400 Handle<HeapObject>::cast(object).location(), NULL, 0); | 400 Handle<HeapObject>::cast(object).location(), NULL, 0); |
| 401 } | 401 } |
| 402 | 402 |
| 403 | 403 |
| 404 #if defined(__has_feature) | 404 #if defined(__has_feature) |
| 405 #if __has_feature(address_sanitizer) | 405 #if __has_feature(address_sanitizer) |
| 406 #define V8_WITH_ASAN 1 | 406 #define V8_WITH_ASAN 1 |
| 407 #endif | 407 #endif |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 496 |
| 497 | 497 |
| 498 TEST(RegressJoinThreadsOnIsolateDeinit) { | 498 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 499 intptr_t size_limit = ShortLivingIsolate() * 2; | 499 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 500 for (int i = 0; i < 10; i++) { | 500 for (int i = 0; i < 10; i++) { |
| 501 CHECK_GT(size_limit, ShortLivingIsolate()); | 501 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 502 } | 502 } |
| 503 } | 503 } |
| 504 | 504 |
| 505 #endif // __linux__ and !USE_SIMULATOR | 505 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |