| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "platform/heap/ThreadState.h" | 32 #include "platform/heap/ThreadState.h" |
| 33 | 33 |
| 34 #include "platform/ScriptForbiddenScope.h" | 34 #include "platform/ScriptForbiddenScope.h" |
| 35 #include "platform/TraceEvent.h" | 35 #include "platform/TraceEvent.h" |
| 36 #include "platform/heap/CallbackStack.h" | 36 #include "platform/heap/CallbackStack.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/heap/Heap.h" | 38 #include "platform/heap/Heap.h" |
| 39 #include "platform/heap/MarkingVisitor.h" |
| 39 #include "platform/heap/SafePoint.h" | 40 #include "platform/heap/SafePoint.h" |
| 40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 41 #include "public/platform/WebScheduler.h" | 42 #include "public/platform/WebScheduler.h" |
| 42 #include "public/platform/WebThread.h" | 43 #include "public/platform/WebThread.h" |
| 43 #include "public/platform/WebTraceLocation.h" | 44 #include "public/platform/WebTraceLocation.h" |
| 44 #include "wtf/Partitions.h" | 45 #include "wtf/Partitions.h" |
| 45 #include "wtf/ThreadingPrimitives.h" | 46 #include "wtf/ThreadingPrimitives.h" |
| 46 #if ENABLE(GC_PROFILING) | 47 #if ENABLE(GC_PROFILING) |
| 47 #include "platform/TracedValue.h" | 48 #include "platform/TracedValue.h" |
| 48 #include "wtf/text/StringHash.h" | 49 #include "wtf/text/StringHash.h" |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 checkThread(); | 895 checkThread(); |
| 895 if (gcState() != EagerSweepScheduled && gcState() != LazySweepScheduled) | 896 if (gcState() != EagerSweepScheduled && gcState() != LazySweepScheduled) |
| 896 return; | 897 return; |
| 897 | 898 |
| 898 { | 899 { |
| 899 if (isMainThread()) | 900 if (isMainThread()) |
| 900 ScriptForbiddenScope::enter(); | 901 ScriptForbiddenScope::enter(); |
| 901 | 902 |
| 902 SweepForbiddenScope forbiddenScope(this); | 903 SweepForbiddenScope forbiddenScope(this); |
| 903 { | 904 { |
| 905 MarkingVisitor<Visitor::WeakProcessing> weakProcessingVisitor; |
| 906 |
| 904 // Disallow allocation during weak processing. | 907 // Disallow allocation during weak processing. |
| 905 NoAllocationScope noAllocationScope(this); | 908 NoAllocationScope noAllocationScope(this); |
| 906 { | 909 { |
| 907 // Perform thread-specific weak processing. | 910 // Perform thread-specific weak processing. |
| 908 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing
"); | 911 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing
"); |
| 909 // TODO(haraken): It is wrong to unconditionally use | 912 while (popAndInvokeThreadLocalWeakCallback(&weakProcessingVisito
r)) { } |
| 910 // s_markingVisitor, which is for GlobalMarking. | |
| 911 // ThreadTerminationGC should use a visitor for | |
| 912 // ThreadLocalMarking. However, a better fix is just to remove | |
| 913 // the visitor parameter. The only user of the visitor parameter | |
| 914 // is HashTable::process. | |
| 915 while (popAndInvokeThreadLocalWeakCallback(Heap::s_markingVisito
r)) { } | |
| 916 } | 913 } |
| 917 { | 914 { |
| 918 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); | 915 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); |
| 919 invokePreFinalizers(); | 916 invokePreFinalizers(); |
| 920 } | 917 } |
| 921 } | 918 } |
| 922 | 919 |
| 923 if (isMainThread()) | 920 if (isMainThread()) |
| 924 ScriptForbiddenScope::exit(); | 921 ScriptForbiddenScope::exit(); |
| 925 } | 922 } |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 json->beginArray(it->key.ascii().data()); | 1380 json->beginArray(it->key.ascii().data()); |
| 1384 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1381 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
| 1385 json->pushInteger(it->value.ages[age]); | 1382 json->pushInteger(it->value.ages[age]); |
| 1386 json->endArray(); | 1383 json->endArray(); |
| 1387 } | 1384 } |
| 1388 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1385 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
| 1389 } | 1386 } |
| 1390 #endif | 1387 #endif |
| 1391 | 1388 |
| 1392 } // namespace blink | 1389 } // namespace blink |
| OLD | NEW |