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 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 } | 4305 } |
4306 CHECK(weak_cell1->value()->IsFixedArray()); | 4306 CHECK(weak_cell1->value()->IsFixedArray()); |
4307 CHECK_EQ(*survivor, weak_cell2->value()); | 4307 CHECK_EQ(*survivor, weak_cell2->value()); |
4308 heap->CollectGarbage(NEW_SPACE); | 4308 heap->CollectGarbage(NEW_SPACE); |
4309 CHECK(weak_cell1->value()->IsFixedArray()); | 4309 CHECK(weak_cell1->value()->IsFixedArray()); |
4310 CHECK_EQ(*survivor, weak_cell2->value()); | 4310 CHECK_EQ(*survivor, weak_cell2->value()); |
4311 heap->CollectGarbage(NEW_SPACE); | 4311 heap->CollectGarbage(NEW_SPACE); |
4312 CHECK(weak_cell1->value()->IsFixedArray()); | 4312 CHECK(weak_cell1->value()->IsFixedArray()); |
4313 CHECK_EQ(*survivor, weak_cell2->value()); | 4313 CHECK_EQ(*survivor, weak_cell2->value()); |
4314 heap->CollectAllAvailableGarbage(); | 4314 heap->CollectAllAvailableGarbage(); |
| 4315 CHECK(weak_cell1->cleared()); |
4315 CHECK_EQ(*survivor, weak_cell2->value()); | 4316 CHECK_EQ(*survivor, weak_cell2->value()); |
4316 CHECK(weak_cell2->value()->IsFixedArray()); | |
4317 } | 4317 } |
4318 | 4318 |
4319 | 4319 |
4320 TEST(WeakCellsWithIncrementalMarking) { | 4320 TEST(WeakCellsWithIncrementalMarking) { |
4321 CcTest::InitializeVM(); | 4321 CcTest::InitializeVM(); |
4322 Isolate* isolate = CcTest::i_isolate(); | 4322 Isolate* isolate = CcTest::i_isolate(); |
4323 v8::internal::Heap* heap = CcTest::heap(); | 4323 v8::internal::Heap* heap = CcTest::heap(); |
4324 v8::internal::Factory* factory = isolate->factory(); | 4324 v8::internal::Factory* factory = isolate->factory(); |
4325 | 4325 |
4326 const int N = 16; | 4326 const int N = 16; |
(...skipping 10 matching lines...) Expand all Loading... |
4337 IncrementalMarking* marking = heap->incremental_marking(); | 4337 IncrementalMarking* marking = heap->incremental_marking(); |
4338 if (marking->IsStopped()) marking->Start(); | 4338 if (marking->IsStopped()) marking->Start(); |
4339 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4339 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
4340 heap->CollectGarbage(NEW_SPACE); | 4340 heap->CollectGarbage(NEW_SPACE); |
4341 CHECK(weak_cell->value()->IsFixedArray()); | 4341 CHECK(weak_cell->value()->IsFixedArray()); |
4342 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); | 4342 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); |
4343 } | 4343 } |
4344 heap->CollectAllGarbage(Heap::kNoGCFlags); | 4344 heap->CollectAllGarbage(Heap::kNoGCFlags); |
4345 CHECK_EQ(*survivor, weak_cells[0]->value()); | 4345 CHECK_EQ(*survivor, weak_cells[0]->value()); |
4346 for (int i = 1; i < N; i++) { | 4346 for (int i = 1; i < N; i++) { |
4347 CHECK(weak_cells[i]->value()->IsUndefined()); | 4347 CHECK(weak_cells[i]->cleared()); |
4348 } | 4348 } |
4349 } | 4349 } |
4350 | 4350 |
4351 | 4351 |
4352 #ifdef DEBUG | 4352 #ifdef DEBUG |
4353 TEST(AddInstructionChangesNewSpacePromotion) { | 4353 TEST(AddInstructionChangesNewSpacePromotion) { |
4354 i::FLAG_allow_natives_syntax = true; | 4354 i::FLAG_allow_natives_syntax = true; |
4355 i::FLAG_expose_gc = true; | 4355 i::FLAG_expose_gc = true; |
4356 i::FLAG_stress_compaction = true; | 4356 i::FLAG_stress_compaction = true; |
4357 i::FLAG_gc_interval = 1000; | 4357 i::FLAG_gc_interval = 1000; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 #ifdef DEBUG | 4613 #ifdef DEBUG |
4614 TEST(PathTracer) { | 4614 TEST(PathTracer) { |
4615 CcTest::InitializeVM(); | 4615 CcTest::InitializeVM(); |
4616 v8::HandleScope scope(CcTest::isolate()); | 4616 v8::HandleScope scope(CcTest::isolate()); |
4617 | 4617 |
4618 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4618 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4619 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4619 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4620 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4620 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4621 } | 4621 } |
4622 #endif // DEBUG | 4622 #endif // DEBUG |
OLD | NEW |