| OLD | NEW | 
|    1 // Copyright 2014 the V8 project authors. All rights reserved. |    1 // Copyright 2014 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 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |    5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 
|    6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |    6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 
|    7  |    7  | 
|    8 #include "src/globals.h" |    8 #include "src/globals.h" | 
|    9  |    9  | 
|   10 namespace v8 { |   10 namespace v8 { | 
|   11 namespace internal { |   11 namespace internal { | 
|   12  |   12  | 
|   13 enum GCIdleTimeActionType { |   13 enum GCIdleTimeActionType { | 
|   14   DONE, |   14   DONE, | 
|   15   DO_NOTHING, |   15   DO_NOTHING, | 
|   16   DO_INCREMENTAL_MARKING, |   16   DO_INCREMENTAL_MARKING, | 
|   17   DO_SCAVENGE, |   17   DO_SCAVENGE, | 
|   18   DO_FULL_GC, |   18   DO_FULL_GC, | 
|   19   DO_FINALIZE_SWEEPING |   19   DO_FINALIZE_SWEEPING | 
|   20 }; |   20 }; | 
|   21  |   21  | 
|   22  |   22  | 
|   23 class GCIdleTimeAction { |   23 class GCIdleTimeAction { | 
|   24  public: |   24  public: | 
|   25   static GCIdleTimeAction Done() { |   25   static GCIdleTimeAction Done() { | 
|   26     GCIdleTimeAction result; |   26     GCIdleTimeAction result; | 
|   27     result.type = DONE; |   27     result.type = DONE; | 
|   28     result.parameter = 0; |   28     result.parameter = 0; | 
 |   29     result.additional_work = false; | 
|   29     return result; |   30     return result; | 
|   30   } |   31   } | 
|   31  |   32  | 
|   32   static GCIdleTimeAction Nothing() { |   33   static GCIdleTimeAction Nothing() { | 
|   33     GCIdleTimeAction result; |   34     GCIdleTimeAction result; | 
|   34     result.type = DO_NOTHING; |   35     result.type = DO_NOTHING; | 
|   35     result.parameter = 0; |   36     result.parameter = 0; | 
 |   37     result.additional_work = false; | 
|   36     return result; |   38     return result; | 
|   37   } |   39   } | 
|   38  |   40  | 
|   39   static GCIdleTimeAction IncrementalMarking(intptr_t step_size) { |   41   static GCIdleTimeAction IncrementalMarking(intptr_t step_size) { | 
|   40     GCIdleTimeAction result; |   42     GCIdleTimeAction result; | 
|   41     result.type = DO_INCREMENTAL_MARKING; |   43     result.type = DO_INCREMENTAL_MARKING; | 
|   42     result.parameter = step_size; |   44     result.parameter = step_size; | 
 |   45     result.additional_work = false; | 
|   43     return result; |   46     return result; | 
|   44   } |   47   } | 
|   45  |   48  | 
|   46   static GCIdleTimeAction Scavenge() { |   49   static GCIdleTimeAction Scavenge() { | 
|   47     GCIdleTimeAction result; |   50     GCIdleTimeAction result; | 
|   48     result.type = DO_SCAVENGE; |   51     result.type = DO_SCAVENGE; | 
|   49     result.parameter = 0; |   52     result.parameter = 0; | 
 |   53     result.additional_work = false; | 
|   50     return result; |   54     return result; | 
|   51   } |   55   } | 
|   52  |   56  | 
|   53   static GCIdleTimeAction FullGC() { |   57   static GCIdleTimeAction FullGC() { | 
|   54     GCIdleTimeAction result; |   58     GCIdleTimeAction result; | 
|   55     result.type = DO_FULL_GC; |   59     result.type = DO_FULL_GC; | 
|   56     result.parameter = 0; |   60     result.parameter = 0; | 
 |   61     result.additional_work = false; | 
|   57     return result; |   62     return result; | 
|   58   } |   63   } | 
|   59  |   64  | 
|   60   static GCIdleTimeAction FinalizeSweeping() { |   65   static GCIdleTimeAction FinalizeSweeping() { | 
|   61     GCIdleTimeAction result; |   66     GCIdleTimeAction result; | 
|   62     result.type = DO_FINALIZE_SWEEPING; |   67     result.type = DO_FINALIZE_SWEEPING; | 
|   63     result.parameter = 0; |   68     result.parameter = 0; | 
 |   69     result.additional_work = false; | 
|   64     return result; |   70     return result; | 
|   65   } |   71   } | 
|   66  |   72  | 
|   67   void Print(); |   73   void Print(); | 
|   68  |   74  | 
|   69   GCIdleTimeActionType type; |   75   GCIdleTimeActionType type; | 
|   70   intptr_t parameter; |   76   intptr_t parameter; | 
 |   77   bool additional_work; | 
|   71 }; |   78 }; | 
|   72  |   79  | 
|   73  |   80  | 
|   74 class GCTracer; |   81 class GCTracer; | 
|   75  |   82  | 
|   76 // The idle time handler makes decisions about which garbage collection |   83 // The idle time handler makes decisions about which garbage collection | 
|   77 // operations are executing during IdleNotification. |   84 // operations are executing during IdleNotification. | 
|   78 class GCIdleTimeHandler { |   85 class GCIdleTimeHandler { | 
|   79  public: |   86  public: | 
|   80   // If we haven't recorded any incremental marking events yet, we carefully |   87   // If we haven't recorded any incremental marking events yet, we carefully | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  203   int mark_compacts_since_idle_round_started_; |  210   int mark_compacts_since_idle_round_started_; | 
|  204   int scavenges_since_last_idle_round_; |  211   int scavenges_since_last_idle_round_; | 
|  205  |  212  | 
|  206   DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |  213   DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 
|  207 }; |  214 }; | 
|  208  |  215  | 
|  209 }  // namespace internal |  216 }  // namespace internal | 
|  210 }  // namespace v8 |  217 }  // namespace v8 | 
|  211  |  218  | 
|  212 #endif  // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |  219 #endif  // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 
| OLD | NEW |