| OLD | NEW | 
|    1 // Copyright 2015 the V8 project authors. All rights reserved. |    1 // Copyright 2015 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include <stdlib.h> |    5 #include <stdlib.h> | 
|    6  |    6  | 
|    7 #ifdef __linux__ |    7 #ifdef __linux__ | 
|    8 #include <errno.h> |    8 #include <errno.h> | 
|    9 #include <fcntl.h> |    9 #include <fcntl.h> | 
|   10 #include <sys/stat.h> |   10 #include <sys/stat.h> | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50  |   50  | 
|   51   double MonotonicallyIncreasingTime() override { |   51   double MonotonicallyIncreasingTime() override { | 
|   52     return platform_->MonotonicallyIncreasingTime(); |   52     return platform_->MonotonicallyIncreasingTime(); | 
|   53   } |   53   } | 
|   54  |   54  | 
|   55   void CallIdleOnForegroundThread(v8::Isolate* isolate, |   55   void CallIdleOnForegroundThread(v8::Isolate* isolate, | 
|   56                                   IdleTask* task) override { |   56                                   IdleTask* task) override { | 
|   57     platform_->CallIdleOnForegroundThread(isolate, task); |   57     platform_->CallIdleOnForegroundThread(isolate, task); | 
|   58   } |   58   } | 
|   59  |   59  | 
|   60   bool IdleTasksEnabled(v8::Isolate* isolate) override { return true; } |   60   bool IdleTasksEnabled(v8::Isolate* isolate) override { return false; } | 
|   61  |   61  | 
|   62   bool PendingTask() { return task_ != nullptr; } |   62   bool PendingTask() { return task_ != nullptr; } | 
|   63  |   63  | 
|   64   void PerformTask() { |   64   void PerformTask() { | 
|   65     Task* task = task_; |   65     Task* task = task_; | 
|   66     task_ = nullptr; |   66     task_ = nullptr; | 
|   67     task->Run(); |   67     task->Run(); | 
|   68     delete task; |   68     delete task; | 
|   69   } |   69   } | 
|   70  |   70  | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  107   marking->Stop(); |  107   marking->Stop(); | 
|  108   marking->Start(i::GarbageCollectionReason::kTesting); |  108   marking->Start(i::GarbageCollectionReason::kTesting); | 
|  109   CHECK(platform.PendingTask()); |  109   CHECK(platform.PendingTask()); | 
|  110   while (platform.PendingTask()) { |  110   while (platform.PendingTask()) { | 
|  111     platform.PerformTask(); |  111     platform.PerformTask(); | 
|  112   } |  112   } | 
|  113   CHECK(marking->IsStopped()); |  113   CHECK(marking->IsStopped()); | 
|  114   i::V8::SetPlatformForTesting(old_platform); |  114   i::V8::SetPlatformForTesting(old_platform); | 
|  115 } |  115 } | 
|  116  |  116  | 
|  117  |  | 
|  118 TEST(IncrementalMarkingUsingIdleTasksAfterGC) { |  | 
|  119   if (!i::FLAG_incremental_marking) return; |  | 
|  120  |  | 
|  121   CcTest::InitializeVM(); |  | 
|  122   v8::Platform* old_platform = i::V8::GetCurrentPlatform(); |  | 
|  123   MockPlatform platform(old_platform); |  | 
|  124   i::V8::SetPlatformForTesting(&platform); |  | 
|  125   i::heap::SimulateFullSpace(CcTest::heap()->old_space()); |  | 
|  126   CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |  | 
|  127   // Perform any pending idle tasks. |  | 
|  128   while (platform.PendingTask()) { |  | 
|  129     platform.PerformTask(); |  | 
|  130   } |  | 
|  131   CHECK(!platform.PendingTask()); |  | 
|  132   i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |  | 
|  133   marking->Stop(); |  | 
|  134   marking->Start(i::GarbageCollectionReason::kTesting); |  | 
|  135   CHECK(platform.PendingTask()); |  | 
|  136   while (platform.PendingTask()) { |  | 
|  137     platform.PerformTask(); |  | 
|  138   } |  | 
|  139   CHECK(marking->IsStopped()); |  | 
|  140   i::V8::SetPlatformForTesting(old_platform); |  | 
|  141 } |  | 
|  142  |  | 
|  143 }  // namespace internal |  117 }  // namespace internal | 
|  144 }  // namespace v8 |  118 }  // namespace v8 | 
| OLD | NEW |