Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.cpp

Issue 2703713003: Remove SafePointBarrier (Closed)
Patch Set: temp Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void ThreadHeapStats::decreaseAllocatedSpace(size_t delta) { 143 void ThreadHeapStats::decreaseAllocatedSpace(size_t delta) {
144 atomicSubtract(&m_allocatedSpace, static_cast<long>(delta)); 144 atomicSubtract(&m_allocatedSpace, static_cast<long>(delta));
145 ProcessHeap::decreaseTotalAllocatedSpace(delta); 145 ProcessHeap::decreaseTotalAllocatedSpace(delta);
146 } 146 }
147 147
148 ThreadHeap::ThreadHeap() 148 ThreadHeap::ThreadHeap()
149 : m_regionTree(WTF::makeUnique<RegionTree>()), 149 : m_regionTree(WTF::makeUnique<RegionTree>()),
150 m_heapDoesNotContainCache(WTF::wrapUnique(new HeapDoesNotContainCache)), 150 m_heapDoesNotContainCache(WTF::wrapUnique(new HeapDoesNotContainCache)),
151 m_safePointBarrier(WTF::makeUnique<SafePointBarrier>()),
152 m_freePagePool(WTF::wrapUnique(new PagePool)), 151 m_freePagePool(WTF::wrapUnique(new PagePool)),
153 m_markingStack(CallbackStack::create()), 152 m_markingStack(CallbackStack::create()),
154 m_postMarkingCallbackStack(CallbackStack::create()), 153 m_postMarkingCallbackStack(CallbackStack::create()),
155 m_globalWeakCallbackStack(CallbackStack::create()), 154 m_globalWeakCallbackStack(CallbackStack::create()),
156 m_ephemeronStack(CallbackStack::create()) { 155 m_ephemeronStack(CallbackStack::create()) {
157 if (ThreadState::current()->isMainThread()) 156 if (ThreadState::current()->isMainThread())
158 s_mainThreadHeap = this; 157 s_mainThreadHeap = this;
159 } 158 }
160 159
161 ThreadHeap::~ThreadHeap() { 160 ThreadHeap::~ThreadHeap() {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 state->visitPersistents(visitor); 531 state->visitPersistents(visitor);
533 } 532 }
534 533
535 void ThreadHeap::visitStackRoots(Visitor* visitor) { 534 void ThreadHeap::visitStackRoots(Visitor* visitor) {
536 ASSERT(ThreadState::current()->isInGC()); 535 ASSERT(ThreadState::current()->isInGC());
537 TRACE_EVENT0("blink_gc", "ThreadHeap::visitStackRoots"); 536 TRACE_EVENT0("blink_gc", "ThreadHeap::visitStackRoots");
538 for (ThreadState* state : m_threads) 537 for (ThreadState* state : m_threads)
539 state->visitStack(visitor); 538 state->visitStack(visitor);
540 } 539 }
541 540
542 void ThreadHeap::enterSafePoint(ThreadState* threadState) {
543 m_safePointBarrier->enterSafePoint(threadState);
544 }
545
546 void ThreadHeap::leaveSafePoint() {
547 m_safePointBarrier->leaveSafePoint();
548 }
549
550 BasePage* ThreadHeap::lookupPageForAddress(Address address) { 541 BasePage* ThreadHeap::lookupPageForAddress(Address address) {
551 ASSERT(ThreadState::current()->isInGC()); 542 ASSERT(ThreadState::current()->isInGC());
552 if (PageMemoryRegion* region = m_regionTree->lookup(address)) { 543 if (PageMemoryRegion* region = m_regionTree->lookup(address)) {
553 return region->pageFromAddress(address); 544 return region->pageFromAddress(address);
554 } 545 }
555 return nullptr; 546 return nullptr;
556 } 547 }
557 548
558 void ThreadHeap::resetHeapCounters() { 549 void ThreadHeap::resetHeapCounters() {
559 ASSERT(ThreadState::current()->isInGC()); 550 ASSERT(ThreadState::current()->isInGC());
560 551
561 ThreadHeap::reportMemoryUsageForTracing(); 552 ThreadHeap::reportMemoryUsageForTracing();
562 553
563 ProcessHeap::decreaseTotalAllocatedObjectSize(m_stats.allocatedObjectSize()); 554 ProcessHeap::decreaseTotalAllocatedObjectSize(m_stats.allocatedObjectSize());
564 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); 555 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize());
565 556
566 m_stats.reset(); 557 m_stats.reset();
567 for (ThreadState* state : m_threads) 558 for (ThreadState* state : m_threads)
568 state->resetHeapCounters(); 559 state->resetHeapCounters();
569 } 560 }
570 561
571 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; 562 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr;
572 563
573 } // namespace blink 564 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | third_party/WebKit/Source/platform/heap/SafePoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698