c7cb9beca1
This is a reland offbfa9bf4ec
The arm64 was missing proper codegen for CFI, thus sizes were off. Original change's description: > Reland "[deoptimizer] Change deopt entries into builtins" > > This is a reland of7f58ced72e
> > It fixes the different exit size emitted on x64/Atom CPUs due to > performance tuning in TurboAssembler::Call. Additionally, add > cctests to verify the fixed size exits. > > Original change's description: > > [deoptimizer] Change deopt entries into builtins > > > > While the overall goal of this commit is to change deoptimization > > entries into builtins, there are multiple related things happening: > > > > - Deoptimization entries, formerly stubs (i.e. Code objects generated > > at runtime, guaranteed to be immovable), have been converted into > > builtins. The major restriction is that we now need to preserve the > > kRootRegister, which was formerly used on most architectures to pass > > the deoptimization id. The solution differs based on platform. > > - Renamed DEOPT_ENTRIES_OR_FOR_TESTING code kind to FOR_TESTING. > > - Removed heap/ support for immovable Code generation. > > - Removed the DeserializerData class (no longer needed). > > - arm64: to preserve 4-byte deopt exits, introduced a new optimization > > in which the final jump to the deoptimization entry is generated > > once per Code object, and deopt exits can continue to emit a > > near-call. > > - arm,ia32,x64: change to fixed-size deopt exits. This reduces exit > > sizes by 4/8, 5, and 5 bytes, respectively. > > > > On arm the deopt exit size is reduced from 12 (or 16) bytes to 8 bytes > > by using the same strategy as on arm64 (recalc deopt id from return > > address). Before: > > > > e300a002 movw r10, <id> > > e59fc024 ldr ip, [pc, <entry offset>] > > e12fff3c blx ip > > > > After: > > > > e59acb35 ldr ip, [r10, <entry offset>] > > e12fff3c blx ip > > > > On arm64 the deopt exit size remains 4 bytes (or 8 bytes in same cases > > with CFI). Additionally, up to 4 builtin jumps are emitted per Code > > object (max 32 bytes added overhead per Code object). Before: > > > > 9401cdae bl <entry offset> > > > > After: > > > > # eager deoptimization entry jump. > > f95b1f50 ldr x16, [x26, <eager entry offset>] > > d61f0200 br x16 > > # lazy deoptimization entry jump. > > f95b2b50 ldr x16, [x26, <lazy entry offset>] > > d61f0200 br x16 > > # the deopt exit. > > 97fffffc bl <eager deoptimization entry jump offset> > > > > On ia32 the deopt exit size is reduced from 10 to 5 bytes. Before: > > > > bb00000000 mov ebx,<id> > > e825f5372b call <entry> > > > > After: > > > > e8ea2256ba call <entry> > > > > On x64 the deopt exit size is reduced from 12 to 7 bytes. Before: > > > > 49c7c511000000 REX.W movq r13,<id> > > e8ea2f0700 call <entry> > > > > After: > > > > 41ff9560360000 call [r13+<entry offset>] > > > > Bug: v8:8661,v8:8768 > > Change-Id: I13e30aedc360474dc818fecc528ce87c3bfeed42 > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2465834 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> > > Reviewed-by: Tobias Tebbi <tebbi@chromium.org> > > Reviewed-by: Ulan Degenbaev <ulan@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#70597} > > Tbr: ulan@chromium.org, tebbi@chromium.org, rmcilroy@chromium.org > Bug: v8:8661,v8:8768,chromium:1140165 > Change-Id: Ibcd5c39c58a70bf2b2ac221aa375fc68d495e144 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2485506 > Reviewed-by: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Tobias Tebbi <tebbi@chromium.org> > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Cr-Commit-Position: refs/heads/master@{#70655} Tbr: ulan@chromium.org, tebbi@chromium.org, rmcilroy@chromium.org Bug: v8:8661 Bug: v8:8768 Bug: chromium:1140165 Change-Id: I471cc94fc085e527dc9bfb5a84b96bd907c2333f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2488682 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#70672}
127 lines
5.6 KiB
C++
127 lines
5.6 KiB
C++
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef HEAP_HEAP_TESTER_H_
|
|
#define HEAP_HEAP_TESTER_H_
|
|
|
|
#include "src/heap/spaces.h"
|
|
#include "src/objects/fixed-array.h"
|
|
|
|
// Tests that should have access to private methods of {v8::internal::Heap}.
|
|
// Those tests need to be defined using HEAP_TEST(Name) { ... }.
|
|
#define HEAP_TEST_METHODS(V) \
|
|
V(CodeLargeObjectSpace) \
|
|
V(CodeLargeObjectSpace64k) \
|
|
V(CompactionFullAbortedPage) \
|
|
V(CompactionPartiallyAbortedPage) \
|
|
V(CompactionPartiallyAbortedPageIntraAbortedPointers) \
|
|
V(CompactionPartiallyAbortedPageWithInvalidatedSlots) \
|
|
V(CompactionPartiallyAbortedPageWithRememberedSetEntries) \
|
|
V(CompactionSpaceDivideMultiplePages) \
|
|
V(CompactionSpaceDivideSinglePage) \
|
|
V(InvalidatedSlotsAfterTrimming) \
|
|
V(InvalidatedSlotsAllInvalidatedRanges) \
|
|
V(InvalidatedSlotsCleanupEachObject) \
|
|
V(InvalidatedSlotsCleanupFull) \
|
|
V(InvalidatedSlotsCleanupRightTrim) \
|
|
V(InvalidatedSlotsCleanupOverlapRight) \
|
|
V(InvalidatedSlotsEvacuationCandidate) \
|
|
V(InvalidatedSlotsNoInvalidatedRanges) \
|
|
V(InvalidatedSlotsResetObjectRegression) \
|
|
V(InvalidatedSlotsRightTrimFixedArray) \
|
|
V(InvalidatedSlotsRightTrimLargeFixedArray) \
|
|
V(InvalidatedSlotsLeftTrimFixedArray) \
|
|
V(InvalidatedSlotsFastToSlow) \
|
|
V(InvalidatedSlotsSomeInvalidatedRanges) \
|
|
V(TestNewSpaceRefsInCopiedCode) \
|
|
V(GCFlags) \
|
|
V(MarkCompactCollector) \
|
|
V(MarkCompactEpochCounter) \
|
|
V(MemoryReducerActivationForSmallHeaps) \
|
|
V(NoPromotion) \
|
|
V(NumberStringCacheSize) \
|
|
V(ObjectGroups) \
|
|
V(Promotion) \
|
|
V(Regression39128) \
|
|
V(ResetWeakHandle) \
|
|
V(StressHandles) \
|
|
V(TestMemoryReducerSampleJsCalls) \
|
|
V(TestSizeOfObjects) \
|
|
V(Regress10560) \
|
|
V(Regress538257) \
|
|
V(Regress587004) \
|
|
V(Regress589413) \
|
|
V(Regress658718) \
|
|
V(Regress670675) \
|
|
V(Regress777177) \
|
|
V(Regress779503) \
|
|
V(Regress791582) \
|
|
V(Regress845060) \
|
|
V(RegressMissingWriteBarrierInAllocate) \
|
|
V(WriteBarrier_Marking) \
|
|
V(WriteBarrier_MarkingExtension) \
|
|
V(WriteBarriersInCopyJSObject) \
|
|
V(DoNotEvacuatePinnedPages) \
|
|
V(ObjectStartBitmap)
|
|
|
|
#define HEAP_TEST(Name) \
|
|
CcTest register_test_##Name(v8::internal::heap::HeapTester::Test##Name, \
|
|
__FILE__, #Name, true, true); \
|
|
void v8::internal::heap::HeapTester::Test##Name()
|
|
|
|
#define UNINITIALIZED_HEAP_TEST(Name) \
|
|
CcTest register_test_##Name(v8::internal::heap::HeapTester::Test##Name, \
|
|
__FILE__, #Name, true, false); \
|
|
void v8::internal::heap::HeapTester::Test##Name()
|
|
|
|
#define THREADED_HEAP_TEST(Name) \
|
|
RegisterThreadedTest register_##Name( \
|
|
v8::internal::heap::HeapTester::Test##Name, #Name); \
|
|
/* */ HEAP_TEST(Name)
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
template <typename T>
|
|
class Handle;
|
|
|
|
namespace heap {
|
|
|
|
class HeapTester {
|
|
public:
|
|
#define DECLARE_STATIC(Name) static void Test##Name();
|
|
|
|
HEAP_TEST_METHODS(DECLARE_STATIC)
|
|
#undef HEAP_TEST_METHODS
|
|
|
|
// test-alloc.cc
|
|
static AllocationResult AllocateAfterFailures();
|
|
static Handle<Object> TestAllocateAfterFailures();
|
|
|
|
// test-invalidated-slots.cc
|
|
static Page* AllocateByteArraysOnPage(Heap* heap,
|
|
std::vector<ByteArray>* byte_arrays);
|
|
|
|
// test-api.cc
|
|
static void ResetWeakHandle(bool global_gc);
|
|
|
|
// test-heap.cc
|
|
static AllocationResult AllocateByteArrayForTest(Heap* heap, int length,
|
|
AllocationType allocation);
|
|
static bool CodeEnsureLinearAllocationArea(Heap* heap, int size_in_bytes);
|
|
|
|
// test-mark-compact.cc
|
|
static AllocationResult AllocateMapForTest(v8::internal::Isolate* isolate);
|
|
static AllocationResult AllocateFixedArrayForTest(Heap* heap, int length,
|
|
AllocationType allocation);
|
|
|
|
static void UncommitFromSpace(Heap* heap);
|
|
};
|
|
|
|
} // namespace heap
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // HEAP_HEAP_TESTER_H_
|