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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 396 |
397 static void TestWeakGlobalHandleCallback(v8::Isolate* isolate, | 397 static void TestWeakGlobalHandleCallback(v8::Isolate* isolate, |
398 v8::Persistent<v8::Value>* handle, | 398 v8::Persistent<v8::Value>* handle, |
399 void* id) { | 399 void* id) { |
400 if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true; | 400 if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true; |
401 handle->Dispose(isolate); | 401 handle->Dispose(isolate); |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 TEST(WeakGlobalHandlesScavenge) { | 405 TEST(WeakGlobalHandlesScavenge) { |
| 406 i::FLAG_stress_compaction = false; |
406 CcTest::InitializeVM(); | 407 CcTest::InitializeVM(); |
407 Isolate* isolate = Isolate::Current(); | 408 Isolate* isolate = Isolate::Current(); |
408 Heap* heap = isolate->heap(); | 409 Heap* heap = isolate->heap(); |
409 Factory* factory = isolate->factory(); | 410 Factory* factory = isolate->factory(); |
410 GlobalHandles* global_handles = isolate->global_handles(); | 411 GlobalHandles* global_handles = isolate->global_handles(); |
411 | 412 |
412 WeakPointerCleared = false; | 413 WeakPointerCleared = false; |
413 | 414 |
414 Handle<Object> h1; | 415 Handle<Object> h1; |
415 Handle<Object> h2; | 416 Handle<Object> h2; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 CHECK((*h1)->IsString()); | 483 CHECK((*h1)->IsString()); |
483 | 484 |
484 CHECK(WeakPointerCleared); | 485 CHECK(WeakPointerCleared); |
485 CHECK(!GlobalHandles::IsNearDeath(h1.location())); | 486 CHECK(!GlobalHandles::IsNearDeath(h1.location())); |
486 | 487 |
487 global_handles->Destroy(h1.location()); | 488 global_handles->Destroy(h1.location()); |
488 } | 489 } |
489 | 490 |
490 | 491 |
491 TEST(DeleteWeakGlobalHandle) { | 492 TEST(DeleteWeakGlobalHandle) { |
| 493 i::FLAG_stress_compaction = false; |
492 CcTest::InitializeVM(); | 494 CcTest::InitializeVM(); |
493 Isolate* isolate = Isolate::Current(); | 495 Isolate* isolate = Isolate::Current(); |
494 Heap* heap = isolate->heap(); | 496 Heap* heap = isolate->heap(); |
495 Factory* factory = isolate->factory(); | 497 Factory* factory = isolate->factory(); |
496 GlobalHandles* global_handles = isolate->global_handles(); | 498 GlobalHandles* global_handles = isolate->global_handles(); |
497 | 499 |
498 WeakPointerCleared = false; | 500 WeakPointerCleared = false; |
499 | 501 |
500 Handle<Object> h; | 502 Handle<Object> h; |
501 | 503 |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 map->GetPrototypeTransitions()->address())); | 1973 map->GetPrototypeTransitions()->address())); |
1972 CHECK(space->LastPage()->Contains(prototype->address())); | 1974 CHECK(space->LastPage()->Contains(prototype->address())); |
1973 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); | 1975 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); |
1974 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1976 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1975 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1977 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1976 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); | 1978 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1977 } | 1979 } |
1978 | 1980 |
1979 | 1981 |
1980 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { | 1982 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { |
| 1983 i::FLAG_stress_compaction = false; |
1981 i::FLAG_allow_natives_syntax = true; | 1984 i::FLAG_allow_natives_syntax = true; |
1982 #ifdef VERIFY_HEAP | 1985 #ifdef VERIFY_HEAP |
1983 i::FLAG_verify_heap = true; | 1986 i::FLAG_verify_heap = true; |
1984 #endif | 1987 #endif |
1985 | 1988 |
1986 CcTest::InitializeVM(); | 1989 CcTest::InitializeVM(); |
1987 if (!i::V8::UseCrankshaft()) return; | 1990 if (!i::V8::UseCrankshaft()) return; |
1988 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); | 1991 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); |
1989 | 1992 |
1990 { | 1993 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 "Test finalizing incremental mark-sweep"); | 2030 "Test finalizing incremental mark-sweep"); |
2028 } | 2031 } |
2029 | 2032 |
2030 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); | 2033 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); |
2031 CHECK_EQ(0, f->shared()->opt_count()); | 2034 CHECK_EQ(0, f->shared()->opt_count()); |
2032 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 2035 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
2033 } | 2036 } |
2034 | 2037 |
2035 | 2038 |
2036 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { | 2039 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { |
| 2040 i::FLAG_stress_compaction = false; |
2037 i::FLAG_allow_natives_syntax = true; | 2041 i::FLAG_allow_natives_syntax = true; |
2038 #ifdef VERIFY_HEAP | 2042 #ifdef VERIFY_HEAP |
2039 i::FLAG_verify_heap = true; | 2043 i::FLAG_verify_heap = true; |
2040 #endif | 2044 #endif |
2041 | 2045 |
2042 CcTest::InitializeVM(); | 2046 CcTest::InitializeVM(); |
2043 if (!i::V8::UseCrankshaft()) return; | 2047 if (!i::V8::UseCrankshaft()) return; |
2044 v8::HandleScope outer_scope(CcTest::isolate()); | 2048 v8::HandleScope outer_scope(CcTest::isolate()); |
2045 | 2049 |
2046 { | 2050 { |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3175 " var a = new Array(n);" | 3179 " var a = new Array(n);" |
3176 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3180 " for (var i = 0; i < n; i += 100) a[i] = i;" |
3177 "};" | 3181 "};" |
3178 "f(10 * 1024 * 1024);"); | 3182 "f(10 * 1024 * 1024);"); |
3179 IncrementalMarking* marking = HEAP->incremental_marking(); | 3183 IncrementalMarking* marking = HEAP->incremental_marking(); |
3180 if (marking->IsStopped()) marking->Start(); | 3184 if (marking->IsStopped()) marking->Start(); |
3181 // This big step should be sufficient to mark the whole array. | 3185 // This big step should be sufficient to mark the whole array. |
3182 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3186 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
3183 ASSERT(marking->IsComplete()); | 3187 ASSERT(marking->IsComplete()); |
3184 } | 3188 } |
OLD | NEW |