Changeset 276855 in webkit
- Timestamp:
- Apr 30, 2021 2:50:21 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r276823 r276855 1 2021-04-30 Filip Pizlo <fpizlo@apple.com> 2 3 Make the JIT pool smaller on AS 4 https://bugs.webkit.org/show_bug.cgi?id=225249 5 6 Reviewed by Saam Barati. 7 8 This adds three related features: 9 10 - Makes it easy to dump where the JIT pool was allocated. 11 12 - Makes it possible to override the JIT pool size with Options even with jump islands. 13 14 - Changes the default JIT pool size on AS to 512MB. 15 16 Estimated 2% speed-up on JetStream2, 1.5% speed-up on Speedometer2. 17 18 * jit/ExecutableAllocator.cpp: 19 (JSC::initializeJITPageReservation): 20 * runtime/OptionsList.h: 21 1 22 2021-04-29 Saam Barati <sbarati@apple.com> 2 23 -
trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
r274602 r276855 1 1 /* 2 * Copyright (C) 2008-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2008-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 96 96 #elif CPU(ARM64) 97 97 #if ENABLE(JUMP_ISLANDS) 98 static constexpr size_t fixedExecutableMemoryPoolSize = 1 * GB;98 static constexpr size_t fixedExecutableMemoryPoolSize = 512 * MB; 99 99 // These sizes guarantee that any jump within an island can jump forwards or backwards 100 100 // to the adjacent island in a single instruction. 101 101 static constexpr size_t regionSize = 112 * MB; 102 102 static constexpr size_t islandRegionSize = 16 * MB; 103 static constexpr size_t numberOfRegions = fixedExecutableMemoryPoolSize / regionSize;103 static constexpr size_t maxNumberOfRegions = fixedExecutableMemoryPoolSize / regionSize; 104 104 static constexpr size_t islandSizeInBytes = 4; 105 105 static constexpr size_t maxIslandsPerRegion = islandRegionSize / islandSizeInBytes; … … 332 332 333 333 reservation.size = fixedExecutableMemoryPoolSize; 334 #if !ENABLE(JUMP_ISLANDS) 335 // FIXME: Consider making jump islands work with Options::jitMemoryReservationSize 336 // https://bugs.webkit.org/show_bug.cgi?id=209037 334 337 335 if (Options::jitMemoryReservationSize()) 338 336 reservation.size = Options::jitMemoryReservationSize(); 339 #endif 337 340 338 reservation.size = std::max(roundUpToMultipleOf(pageSize(), reservation.size), pageSize() * 2); 341 339 … … 352 350 353 351 reservation.pageReservation = tryCreatePageReservation(reservation.size); 352 353 if (Options::verboseExecutablePoolAllocation()) 354 dataLog(getpid(), ": Got executable pool reservation at ", RawPointer(reservation.pageReservation.base()), "...", RawPointer(bitwise_cast<char*>(reservation.pageReservation.base()) + reservation.pageReservation.size()), ", while I'm at ", RawPointer(bitwise_cast<void*>(initializeJITPageReservation)), "\n"); 355 354 356 if (reservation.pageReservation) { 355 357 ASSERT(reservation.pageReservation.size() == reservation.size); … … 398 400 FixedVMPoolExecutableAllocator() 399 401 #if ENABLE(JUMP_ISLANDS) 400 : m_allocators(constructFixedSizeArrayWithArguments<RegionAllocator, numberOfRegions>(*this)) 402 : m_allocators(constructFixedSizeArrayWithArguments<RegionAllocator, maxNumberOfRegions>(*this)) 403 , m_numAllocators(maxNumberOfRegions) 401 404 #else 402 405 : m_allocator(*this) … … 409 412 uintptr_t start = bitwise_cast<uintptr_t>(memoryStart()); 410 413 uintptr_t reservationEnd = bitwise_cast<uintptr_t>(memoryEnd()); 411 for (size_t i = 0; i < numberOfRegions; ++i) { 412 RELEASE_ASSERT(start < reservationEnd); 414 for (size_t i = 0; i < maxNumberOfRegions; ++i) { 415 RELEASE_ASSERT(start < reservationEnd || Options::jitMemoryReservationSize()); 416 if (start >= reservationEnd) { 417 m_numAllocators = i; 418 break; 419 } 413 420 m_allocators[i].m_start = tagCodePtr<ExecutableMemoryPtrTag>(bitwise_cast<void*>(start)); 414 421 m_allocators[i].m_end = tagCodePtr<ExecutableMemoryPtrTag>(bitwise_cast<void*>(start + regionSize)); 415 422 if (m_allocators[i].end() > reservationEnd) { 416 423 // We may have taken a page for the executable only copy thunk. 417 RELEASE_ASSERT(i == numberOfRegions - 1);424 RELEASE_ASSERT(i == maxNumberOfRegions - 1 || Options::jitMemoryReservationSize()); 418 425 m_allocators[i].m_end = tagCodePtr<ExecutableMemoryPtrTag>(bitwise_cast<void*>(reservationEnd)); 419 426 } … … 451 458 unsigned start = 0; 452 459 if (Options::useRandomizingExecutableIslandAllocation()) 453 start = cryptographicallyRandomNumber() % m_ allocators.size();460 start = cryptographicallyRandomNumber() % m_numAllocators; 454 461 455 462 unsigned i = start; … … 458 465 if (RefPtr<ExecutableMemoryHandle> result = allocator.allocate(locker, sizeInBytes)) 459 466 return result; 460 i = (i + 1) % m_ allocators.size();467 i = (i + 1) % m_numAllocators; 461 468 if (i == start) 462 469 break; … … 833 840 PageReservation m_reservation; 834 841 #if ENABLE(JUMP_ISLANDS) 835 std::array<RegionAllocator, numberOfRegions> m_allocators; 842 std::array<RegionAllocator, maxNumberOfRegions> m_allocators; 843 unsigned m_numAllocators; 836 844 RedBlackTree<Islands, void*> m_islandsForJumpSourceLocation; 837 845 #else -
trunk/Source/JavaScriptCore/runtime/OptionsList.h
r276786 r276855 533 533 v(Bool, useSharedArrayBuffer, false, Normal, nullptr) \ 534 534 v(Bool, useTopLevelAwait, true, Normal, "allow the await keyword at the top level of a module.") \ 535 v(Bool, dumpLinking, false, Normal, nullptr) \ 536 v(Bool, verifySame4GBLink, false, Normal, nullptr) \ 537 v(Bool, verboseExecutablePoolAllocation, false, Normal, nullptr) \ 535 538 536 539
Note: See TracChangeset
for help on using the changeset viewer.