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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 { | 250 { |
251 checkThread(); | 251 checkThread(); |
252 ASSERT(!**s_threadSpecific); | 252 ASSERT(!**s_threadSpecific); |
253 **s_threadSpecific = this; | 253 **s_threadSpecific = this; |
254 | 254 |
255 if (isMainThread()) { | 255 if (isMainThread()) { |
256 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); | 256 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); |
257 s_mainThreadUnderestimatedStackSize = StackFrameDepth::getUnderestimated
StackSize() - sizeof(void*); | 257 s_mainThreadUnderestimatedStackSize = StackFrameDepth::getUnderestimated
StackSize() - sizeof(void*); |
258 } | 258 } |
259 | 259 |
260 for (int heapIndex = 0; heapIndex < LargeObjectHeap; heapIndex++) | 260 for (int heapIndex = 0; heapIndex < LargeObjectHeapIndex; heapIndex++) |
261 m_heaps[heapIndex] = new ThreadHeapForHeapPage(this, heapIndex); | 261 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex); |
262 m_heaps[LargeObjectHeap] = new ThreadHeapForLargeObject(this, LargeObjectHea
p); | 262 m_heaps[LargeObjectHeapIndex] = new LargeObjectHeap(this, LargeObjectHeapInd
ex); |
263 | 263 |
264 m_weakCallbackStack = new CallbackStack(); | 264 m_weakCallbackStack = new CallbackStack(); |
265 } | 265 } |
266 | 266 |
267 ThreadState::~ThreadState() | 267 ThreadState::~ThreadState() |
268 { | 268 { |
269 checkThread(); | 269 checkThread(); |
270 delete m_weakCallbackStack; | 270 delete m_weakCallbackStack; |
271 m_weakCallbackStack = nullptr; | 271 m_weakCallbackStack = nullptr; |
272 for (int i = 0; i < NumberOfHeaps; ++i) | 272 for (int i = 0; i < NumberOfHeaps; ++i) |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 m_persistents->trace(visitor); | 515 m_persistents->trace(visitor); |
516 if (m_traceDOMWrappers) { | 516 if (m_traceDOMWrappers) { |
517 TRACE_EVENT0("blink_gc", "V8GCController::traceDOMWrappers"); | 517 TRACE_EVENT0("blink_gc", "V8GCController::traceDOMWrappers"); |
518 m_traceDOMWrappers(m_isolate, visitor); | 518 m_traceDOMWrappers(m_isolate, visitor); |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 #if ENABLE(GC_PROFILING) | 522 #if ENABLE(GC_PROFILING) |
523 const GCInfo* ThreadState::findGCInfo(Address address) | 523 const GCInfo* ThreadState::findGCInfo(Address address) |
524 { | 524 { |
525 if (BaseHeapPage* page = findPageFromAddress(address)) | 525 if (BasePage* page = findPageFromAddress(address)) |
526 return page->findGCInfo(address); | 526 return page->findGCInfo(address); |
527 return nullptr; | 527 return nullptr; |
528 } | 528 } |
529 | 529 |
530 size_t ThreadState::SnapshotInfo::getClassTag(const GCInfo* gcInfo) | 530 size_t ThreadState::SnapshotInfo::getClassTag(const GCInfo* gcInfo) |
531 { | 531 { |
532 ClassTagMap::AddResult result = classTags.add(gcInfo, classTags.size()); | 532 ClassTagMap::AddResult result = classTags.add(gcInfo, classTags.size()); |
533 if (result.isNewEntry) { | 533 if (result.isNewEntry) { |
534 liveCount.append(0); | 534 liveCount.append(0); |
535 deadCount.append(0); | 535 deadCount.append(0); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 } | 947 } |
948 | 948 |
949 void ThreadState::prepareHeapForTermination() | 949 void ThreadState::prepareHeapForTermination() |
950 { | 950 { |
951 checkThread(); | 951 checkThread(); |
952 for (int i = 0; i < NumberOfHeaps; ++i) | 952 for (int i = 0; i < NumberOfHeaps; ++i) |
953 m_heaps[i]->prepareHeapForTermination(); | 953 m_heaps[i]->prepareHeapForTermination(); |
954 } | 954 } |
955 | 955 |
956 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 956 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
957 BaseHeapPage* ThreadState::findPageFromAddress(Address address) | 957 BasePage* ThreadState::findPageFromAddress(Address address) |
958 { | 958 { |
959 for (int i = 0; i < NumberOfHeaps; ++i) { | 959 for (int i = 0; i < NumberOfHeaps; ++i) { |
960 if (BaseHeapPage* page = m_heaps[i]->findPageFromAddress(address)) | 960 if (BasePage* page = m_heaps[i]->findPageFromAddress(address)) |
961 return page; | 961 return page; |
962 } | 962 } |
963 return nullptr; | 963 return nullptr; |
964 } | 964 } |
965 #endif | 965 #endif |
966 | 966 |
967 size_t ThreadState::objectPayloadSizeForTesting() | 967 size_t ThreadState::objectPayloadSizeForTesting() |
968 { | 968 { |
969 size_t objectPayloadSize = 0; | 969 size_t objectPayloadSize = 0; |
970 for (int i = 0; i < NumberOfHeaps; ++i) | 970 for (int i = 0; i < NumberOfHeaps; ++i) |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 json->beginArray(it->key.ascii().data()); | 1265 json->beginArray(it->key.ascii().data()); |
1266 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1266 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1267 json->pushInteger(it->value.ages[age]); | 1267 json->pushInteger(it->value.ages[age]); |
1268 json->endArray(); | 1268 json->endArray(); |
1269 } | 1269 } |
1270 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1270 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1271 } | 1271 } |
1272 #endif | 1272 #endif |
1273 | 1273 |
1274 } // namespace blink | 1274 } // namespace blink |
OLD | NEW |