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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 { | 298 { |
299 checkThread(); | 299 checkThread(); |
300 ASSERT(!**s_threadSpecific); | 300 ASSERT(!**s_threadSpecific); |
301 **s_threadSpecific = this; | 301 **s_threadSpecific = this; |
302 | 302 |
303 if (isMainThread()) { | 303 if (isMainThread()) { |
304 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); | 304 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); |
305 s_mainThreadUnderestimatedStackSize = StackFrameDepth::getUnderestimated
StackSize() - sizeof(void*); | 305 s_mainThreadUnderestimatedStackSize = StackFrameDepth::getUnderestimated
StackSize() - sizeof(void*); |
306 } | 306 } |
307 | 307 |
308 for (int heapIndex = 0; heapIndex < LargeObjectHeapIndex; heapIndex++) | 308 for (int heapIndex = 0; heapIndex < LargeObjectHeap; heapIndex++) |
309 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex); | 309 m_heaps[heapIndex] = new ThreadHeapForHeapPage(this, heapIndex); |
310 m_heaps[LargeObjectHeapIndex] = new LargeObjectHeap(this, LargeObjectHeapInd
ex); | 310 m_heaps[LargeObjectHeap] = new ThreadHeapForLargeObject(this, LargeObjectHea
p); |
311 | 311 |
312 m_weakCallbackStack = new CallbackStack(); | 312 m_weakCallbackStack = new CallbackStack(); |
313 } | 313 } |
314 | 314 |
315 ThreadState::~ThreadState() | 315 ThreadState::~ThreadState() |
316 { | 316 { |
317 checkThread(); | 317 checkThread(); |
318 delete m_weakCallbackStack; | 318 delete m_weakCallbackStack; |
319 m_weakCallbackStack = nullptr; | 319 m_weakCallbackStack = nullptr; |
320 for (int i = 0; i < NumberOfHeaps; ++i) | 320 for (int i = 0; i < NumberOfHeaps; ++i) |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 m_persistents->trace(visitor); | 563 m_persistents->trace(visitor); |
564 if (m_traceDOMWrappers) { | 564 if (m_traceDOMWrappers) { |
565 TRACE_EVENT0("blink_gc", "V8GCController::traceDOMWrappers"); | 565 TRACE_EVENT0("blink_gc", "V8GCController::traceDOMWrappers"); |
566 m_traceDOMWrappers(m_isolate, visitor); | 566 m_traceDOMWrappers(m_isolate, visitor); |
567 } | 567 } |
568 } | 568 } |
569 | 569 |
570 #if ENABLE(GC_PROFILING) | 570 #if ENABLE(GC_PROFILING) |
571 const GCInfo* ThreadState::findGCInfo(Address address) | 571 const GCInfo* ThreadState::findGCInfo(Address address) |
572 { | 572 { |
573 if (BasePage* page = findPageFromAddress(address)) | 573 if (BaseHeapPage* page = findPageFromAddress(address)) |
574 return page->findGCInfo(address); | 574 return page->findGCInfo(address); |
575 return nullptr; | 575 return nullptr; |
576 } | 576 } |
577 | 577 |
578 size_t ThreadState::SnapshotInfo::getClassTag(const GCInfo* gcInfo) | 578 size_t ThreadState::SnapshotInfo::getClassTag(const GCInfo* gcInfo) |
579 { | 579 { |
580 ClassTagMap::AddResult result = classTags.add(gcInfo, classTags.size()); | 580 ClassTagMap::AddResult result = classTags.add(gcInfo, classTags.size()); |
581 if (result.isNewEntry) { | 581 if (result.isNewEntry) { |
582 liveCount.append(0); | 582 liveCount.append(0); |
583 deadCount.append(0); | 583 deadCount.append(0); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 995 } |
996 | 996 |
997 void ThreadState::prepareHeapForTermination() | 997 void ThreadState::prepareHeapForTermination() |
998 { | 998 { |
999 checkThread(); | 999 checkThread(); |
1000 for (int i = 0; i < NumberOfHeaps; ++i) | 1000 for (int i = 0; i < NumberOfHeaps; ++i) |
1001 m_heaps[i]->prepareHeapForTermination(); | 1001 m_heaps[i]->prepareHeapForTermination(); |
1002 } | 1002 } |
1003 | 1003 |
1004 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 1004 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
1005 BasePage* ThreadState::findPageFromAddress(Address address) | 1005 BaseHeapPage* ThreadState::findPageFromAddress(Address address) |
1006 { | 1006 { |
1007 for (int i = 0; i < NumberOfHeaps; ++i) { | 1007 for (int i = 0; i < NumberOfHeaps; ++i) { |
1008 if (BasePage* page = m_heaps[i]->findPageFromAddress(address)) | 1008 if (BaseHeapPage* page = m_heaps[i]->findPageFromAddress(address)) |
1009 return page; | 1009 return page; |
1010 } | 1010 } |
1011 return nullptr; | 1011 return nullptr; |
1012 } | 1012 } |
1013 #endif | 1013 #endif |
1014 | 1014 |
1015 size_t ThreadState::objectPayloadSizeForTesting() | 1015 size_t ThreadState::objectPayloadSizeForTesting() |
1016 { | 1016 { |
1017 size_t objectPayloadSize = 0; | 1017 size_t objectPayloadSize = 0; |
1018 for (int i = 0; i < NumberOfHeaps; ++i) | 1018 for (int i = 0; i < NumberOfHeaps; ++i) |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 json->beginArray(it->key.ascii().data()); | 1313 json->beginArray(it->key.ascii().data()); |
1314 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1314 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1315 json->pushInteger(it->value.ages[age]); | 1315 json->pushInteger(it->value.ages[age]); |
1316 json->endArray(); | 1316 json->endArray(); |
1317 } | 1317 } |
1318 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1318 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1319 } | 1319 } |
1320 #endif | 1320 #endif |
1321 | 1321 |
1322 } // namespace blink | 1322 } // namespace blink |
OLD | NEW |