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

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

Issue 1804863002: Refactor RegionTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 getThreadState()->shouldFlushHeapDoesNotContainCache(); 419 getThreadState()->shouldFlushHeapDoesNotContainCache();
420 PageMemory* pageMemory = Heap::getFreePagePool()->takeFreePage(arenaIndex()) ; 420 PageMemory* pageMemory = Heap::getFreePagePool()->takeFreePage(arenaIndex()) ;
421 421
422 if (!pageMemory) { 422 if (!pageMemory) {
423 // Allocate a memory region for blinkPagesPerRegion pages that 423 // Allocate a memory region for blinkPagesPerRegion pages that
424 // will each have the following layout. 424 // will each have the following layout.
425 // 425 //
426 // [ guard os page | ... payload ... | guard os page ] 426 // [ guard os page | ... payload ... | guard os page ]
427 // ^---{ aligned to blink page size } 427 // ^---{ aligned to blink page size }
428 PageMemoryRegion* region = PageMemoryRegion::allocateNormalPages(); 428 PageMemoryRegion* region = PageMemoryRegion::allocateNormalPages();
429 Heap::addPageMemoryRegion(region);
haraken 2016/03/15 05:49:50 Does addPageMemoryRegion need to be a method of He
keishi 2016/03/15 07:48:43 Done. I had the addPageMemoryRegion because region
429 430
430 // Setup the PageMemory object for each of the pages in the region. 431 // Setup the PageMemory object for each of the pages in the region.
431 for (size_t i = 0; i < blinkPagesPerRegion; ++i) { 432 for (size_t i = 0; i < blinkPagesPerRegion; ++i) {
432 PageMemory* memory = PageMemory::setupPageMemoryInRegion(region, i * blinkPageSize, blinkPagePayloadSize()); 433 PageMemory* memory = PageMemory::setupPageMemoryInRegion(region, i * blinkPageSize, blinkPagePayloadSize());
433 // Take the first possible page ensuring that this thread actually 434 // Take the first possible page ensuring that this thread actually
434 // gets a page and add the rest to the page pool. 435 // gets a page and add the rest to the page pool.
435 if (!pageMemory) { 436 if (!pageMemory) {
436 bool result = memory->commit(); 437 bool result = memory->commit();
437 // If you hit the ASSERT, it will mean that you're hitting 438 // If you hit the ASSERT, it will mean that you're hitting
438 // the limit of the number of mmapped regions OS can support 439 // the limit of the number of mmapped regions OS can support
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1589
1589 m_hasEntries = true; 1590 m_hasEntries = true;
1590 size_t index = hash(address); 1591 size_t index = hash(address);
1591 ASSERT(!(index & 1)); 1592 ASSERT(!(index & 1));
1592 Address cachePage = roundToBlinkPageStart(address); 1593 Address cachePage = roundToBlinkPageStart(address);
1593 m_entries[index + 1] = m_entries[index]; 1594 m_entries[index + 1] = m_entries[index];
1594 m_entries[index] = cachePage; 1595 m_entries[index] = cachePage;
1595 } 1596 }
1596 1597
1597 } // namespace blink 1598 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698