12020-02-17 Yusuke Suzuki <ysuzuki@apple.com>
2
3 [JSC] Shrink Structure
4 https://bugs.webkit.org/show_bug.cgi?id=207827
5
6 Reviewed by NOBODY (OOPS!).
7
8 This patch shrinks sizeof(Structure) from 112 to 96 (16 bytes) in 64 bit architectures.
9 Structure is one of the most frequently allocated JSCell in JSC. So it is worth doing
10 all the sort of bit hacks to make it compact as much as possible.
11
12 1. StringHasher is always generating 24 bits hashes so far. By leveraging this fact,
13 we store hash code in Structure in 3 bytes (24 bits) for property-hash and seen-property-hash.
14 2. Instead of using bloom-filter of pointers for seen-properties, we should use bloom-filter of hash-codes.
15 3. Used PackedPtr for C++ non-concurrently accessed data structures.
16 4. Put outOfLineTypeFlags, maxOffset and transitionOffset into highest bits of m_propertyTableUnsafe,
17 m_cachedPrototypeChain, and m_classInfo. Do not use PackedPtr here since some of them are concurrently accessed
18 by GC.
19 5. Put m_inlineCapacity into lower 8 bits of m_propertyHash.
20 6. Remove m_lock, and use Structure::cellLock() instead.
21
22 Combining all of the above techniques and getting 16 bytes.
23
24 * dfg/DFGSpeculativeJIT.cpp:
25 (JSC::DFG::SpeculativeJIT::compileCheckSubClass):
26 (JSC::DFG::SpeculativeJIT::compileCreateThis):
27 (JSC::DFG::SpeculativeJIT::compileCreatePromise):
28 (JSC::DFG::SpeculativeJIT::compileCreateInternalFieldObject):
29 * ftl/FTLAbstractHeapRepository.h:
30 * ftl/FTLLowerDFGToB3.cpp:
31 (JSC::FTL::DFG::LowerDFGToB3::compileCreatePromise):
32 (JSC::FTL::DFG::LowerDFGToB3::compileCreateInternalFieldObject):
33 (JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass):
34 * jit/JITOpcodes.cpp:
35 (JSC::JIT::emit_op_create_this):
36 * jit/JITOpcodes32_64.cpp:
37 (JSC::JIT::emit_op_create_this):
38 * runtime/ClonedArguments.cpp:
39 (JSC::ClonedArguments::createStructure):
40 * runtime/ConcurrentJSLock.h:
41 (JSC::ConcurrentJSLockerBase::ConcurrentJSLockerBase):
42 (JSC::GCSafeConcurrentJSLockerImpl::GCSafeConcurrentJSLockerImpl):
43 (JSC::GCSafeConcurrentJSLockerImpl::~GCSafeConcurrentJSLockerImpl):
44 (JSC::ConcurrentJSLockerImpl::ConcurrentJSLockerImpl):
45 (JSC::GCSafeConcurrentJSLocker::GCSafeConcurrentJSLocker): Deleted.
46 (JSC::GCSafeConcurrentJSLocker::~GCSafeConcurrentJSLocker): Deleted.
47 (JSC::ConcurrentJSLocker::ConcurrentJSLocker): Deleted.
48 * runtime/JSCell.h:
49 * runtime/JSObject.cpp:
50 (JSC::JSObject::deleteProperty):
51 (JSC::JSObject::shiftButterflyAfterFlattening):
52 * runtime/JSObject.h:
53 (JSC::JSObject::getDirectConcurrently const):
54 * runtime/JSObjectInlines.h:
55 (JSC::JSObject::prepareToPutDirectWithoutTransition):
56 * runtime/Structure.cpp:
57 (JSC::StructureTransitionTable::setSingleTransition):
58 (JSC::Structure::dumpStatistics):
59 (JSC::Structure::Structure):
60 (JSC::Structure::create):
61 (JSC::Structure::findStructuresAndMapForMaterialization):
62 (JSC::Structure::materializePropertyTable):
63 (JSC::Structure::addPropertyTransitionToExistingStructureConcurrently):
64 (JSC::Structure::addNewPropertyTransition):
65 (JSC::Structure::removeNewPropertyTransition):
66 (JSC::Structure::changePrototypeTransition):
67 (JSC::Structure::attributeChangeTransition):
68 (JSC::Structure::toDictionaryTransition):
69 (JSC::Structure::takePropertyTableOrCloneIfPinned):
70 (JSC::Structure::nonPropertyTransitionSlow):
71 (JSC::Structure::flattenDictionaryStructure):
72 (JSC::Structure::ensurePropertyReplacementWatchpointSet):
73 (JSC::Structure::copyPropertyTableForPinning):
74 (JSC::Structure::add):
75 (JSC::Structure::remove):
76 (JSC::Structure::visitChildren):
77 (JSC::Structure::canCachePropertyNameEnumerator const):
78 * runtime/Structure.h:
79 * runtime/StructureInlines.h:
80 (JSC::Structure::get):
81 (JSC::Structure::forEachPropertyConcurrently):
82 (JSC::Structure::cachedPrototypeChain const):
83 (JSC::Structure::setCachedPrototypeChain):
84 (JSC::Structure::clearCachedPrototypeChain):
85 (JSC::Structure::prototypeChain const):
86 (JSC::Structure::propertyReplacementWatchpointSet):
87 (JSC::Structure::checkOffsetConsistency const):
88 (JSC::Structure::add):
89 (JSC::Structure::remove):
90 (JSC::Structure::removePropertyWithoutTransition):
91 (JSC::Structure::setPropertyTable):
92 (JSC::Structure::clearPropertyTable):
93 (JSC::Structure::setOutOfLineTypeFlags):
94 (JSC::Structure::setClassInfo):
95 * runtime/StructureTransitionTable.h:
96 (JSC::toAttributes):
97 (JSC::StructureTransitionTable::StructureTransitionTable):
98 (JSC::StructureTransitionTable::isUsingSingleSlot const):
99 (JSC::StructureTransitionTable::map const):
100 (JSC::StructureTransitionTable::weakImpl const):
101 (JSC::StructureTransitionTable::setMap):
102 * runtime/WriteBarrier.h:
103 * wasm/js/WebAssemblyFunction.cpp:
104 (JSC::WebAssemblyFunction::jsCallEntrypointSlow):
105