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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 235 } |
236 #endif | 236 #endif |
237 | 237 |
238 | 238 |
239 static int NumberOfWeakCalls = 0; | 239 static int NumberOfWeakCalls = 0; |
240 static void WeakPointerCallback( | 240 static void WeakPointerCallback( |
241 const v8::WeakCallbackData<v8::Value, void>& data) { | 241 const v8::WeakCallbackData<v8::Value, void>& data) { |
242 std::pair<v8::Persistent<v8::Value>*, int>* p = | 242 std::pair<v8::Persistent<v8::Value>*, int>* p = |
243 reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( | 243 reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( |
244 data.GetParameter()); | 244 data.GetParameter()); |
245 DCHECK_EQ(1234, p->second); | 245 CHECK_EQ(1234, p->second); |
246 NumberOfWeakCalls++; | 246 NumberOfWeakCalls++; |
247 p->first->Reset(); | 247 p->first->Reset(); |
248 } | 248 } |
249 | 249 |
250 | 250 |
251 HEAP_TEST(ObjectGroups) { | 251 HEAP_TEST(ObjectGroups) { |
252 FLAG_incremental_marking = false; | 252 FLAG_incremental_marking = false; |
253 CcTest::InitializeVM(); | 253 CcTest::InitializeVM(); |
254 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 254 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
255 Heap* heap = CcTest::heap(); | 255 Heap* heap = CcTest::heap(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 356 } |
357 | 357 |
358 | 358 |
359 class TestRetainedObjectInfo : public v8::RetainedObjectInfo { | 359 class TestRetainedObjectInfo : public v8::RetainedObjectInfo { |
360 public: | 360 public: |
361 TestRetainedObjectInfo() : has_been_disposed_(false) {} | 361 TestRetainedObjectInfo() : has_been_disposed_(false) {} |
362 | 362 |
363 bool has_been_disposed() { return has_been_disposed_; } | 363 bool has_been_disposed() { return has_been_disposed_; } |
364 | 364 |
365 virtual void Dispose() { | 365 virtual void Dispose() { |
366 DCHECK(!has_been_disposed_); | 366 CHECK(!has_been_disposed_); |
367 has_been_disposed_ = true; | 367 has_been_disposed_ = true; |
368 } | 368 } |
369 | 369 |
370 virtual bool IsEquivalent(v8::RetainedObjectInfo* other) { | 370 virtual bool IsEquivalent(v8::RetainedObjectInfo* other) { |
371 return other == this; | 371 return other == this; |
372 } | 372 } |
373 | 373 |
374 virtual intptr_t GetHash() { return 0; } | 374 virtual intptr_t GetHash() { return 0; } |
375 | 375 |
376 virtual const char* GetLabel() { return "whatever"; } | 376 virtual const char* GetLabel() { return "whatever"; } |
377 | 377 |
378 private: | 378 private: |
379 bool has_been_disposed_; | 379 bool has_been_disposed_; |
380 }; | 380 }; |
381 | 381 |
382 | 382 |
383 TEST(EmptyObjectGroups) { | 383 TEST(EmptyObjectGroups) { |
384 CcTest::InitializeVM(); | 384 CcTest::InitializeVM(); |
385 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 385 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
386 | 386 |
387 v8::HandleScope handle_scope(CcTest::isolate()); | 387 v8::HandleScope handle_scope(CcTest::isolate()); |
388 | 388 |
389 TestRetainedObjectInfo info; | 389 TestRetainedObjectInfo info; |
390 global_handles->AddObjectGroup(NULL, 0, &info); | 390 global_handles->AddObjectGroup(NULL, 0, &info); |
391 DCHECK(info.has_been_disposed()); | 391 CHECK(info.has_been_disposed()); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 #if defined(__has_feature) | 395 #if defined(__has_feature) |
396 #if __has_feature(address_sanitizer) | 396 #if __has_feature(address_sanitizer) |
397 #define V8_WITH_ASAN 1 | 397 #define V8_WITH_ASAN 1 |
398 #endif | 398 #endif |
399 #endif | 399 #endif |
400 | 400 |
401 | 401 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 489 |
490 | 490 |
491 TEST(RegressJoinThreadsOnIsolateDeinit) { | 491 TEST(RegressJoinThreadsOnIsolateDeinit) { |
492 intptr_t size_limit = ShortLivingIsolate() * 2; | 492 intptr_t size_limit = ShortLivingIsolate() * 2; |
493 for (int i = 0; i < 10; i++) { | 493 for (int i = 0; i < 10; i++) { |
494 CHECK_GT(size_limit, ShortLivingIsolate()); | 494 CHECK_GT(size_limit, ShortLivingIsolate()); |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 #endif // __linux__ and !USE_SIMULATOR | 498 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |