WebKit Bugzilla
Attachment 369811 Details for
Bug 197866
: [JSC] Compress JIT related data more by using Packed<>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197866-20190513191653.patch (text/plain), 18.91 KB, created by
Yusuke Suzuki
on 2019-05-13 19:16:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-05-13 19:16:53 PDT
Size:
18.91 KB
patch
obsolete
>Subversion Revision: 245221 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index eeb5b5c5aba6c329c7d8147131d091051250eac1..b699aef638fc5854394f0b0bdd50aead979879b0 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,62 @@ >+2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Compress JIT related data more by using Packed<> >+ https://bugs.webkit.org/show_bug.cgi?id=197866 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch leverages Packed<> more to reduce JIT related data size. When we measure memory usage on Gmail, we found that much memory is >+ consumed in DFG data. This patch attempts to reduce that size by using Packed<> to make various data structure's alignment 1. >+ >+ * dfg/DFGCommonData.cpp: >+ (JSC::DFG::CommonData::shrinkToFit): Add more shrinkToFit. >+ * dfg/DFGMinifiedID.h: Make alignment = 1. >+ (JSC::DFG::MinifiedID::operator! const): >+ (JSC::DFG::MinifiedID::operator== const): >+ (JSC::DFG::MinifiedID::operator!= const): >+ (JSC::DFG::MinifiedID::operator< const): >+ (JSC::DFG::MinifiedID::operator> const): >+ (JSC::DFG::MinifiedID::operator<= const): >+ (JSC::DFG::MinifiedID::operator>= const): >+ (JSC::DFG::MinifiedID::hash const): >+ (JSC::DFG::MinifiedID::dump const): >+ (JSC::DFG::MinifiedID::isHashTableDeletedValue const): >+ (JSC::DFG::MinifiedID::bits const): >+ * dfg/DFGMinifiedIDInlines.h: >+ (JSC::DFG::MinifiedID::MinifiedID): >+ * dfg/DFGMinifiedNode.cpp: >+ (JSC::DFG::MinifiedNode::fromNode): Make sizeof(MinifiedNode) from 16 to 13 with alignment = 1. >+ * dfg/DFGMinifiedNode.h: >+ (JSC::DFG::MinifiedNode::id const): >+ (JSC::DFG::MinifiedNode::hasConstant const): >+ (JSC::DFG::MinifiedNode::constant const): >+ (JSC::DFG::MinifiedNode::isPhantomDirectArguments const): >+ (JSC::DFG::MinifiedNode::isPhantomClonedArguments const): >+ (JSC::DFG::MinifiedNode::hasInlineCallFrame const): >+ (JSC::DFG::MinifiedNode::inlineCallFrame const): >+ (JSC::DFG::MinifiedNode::op const): Deleted. >+ (JSC::DFG::MinifiedNode::hasInlineCallFrame): Deleted. >+ * dfg/DFGVariableEvent.h: Make sizeof(VariableEvent) from 12 to 10 with alignment = 1. >+ (JSC::DFG::VariableEvent::fillGPR): >+ (JSC::DFG::VariableEvent::fillPair): >+ (JSC::DFG::VariableEvent::fillFPR): >+ (JSC::DFG::VariableEvent::birth): >+ (JSC::DFG::VariableEvent::spill): >+ (JSC::DFG::VariableEvent::death): >+ (JSC::DFG::VariableEvent::setLocal): >+ (JSC::DFG::VariableEvent::movHint): >+ (JSC::DFG::VariableEvent::id const): >+ (JSC::DFG::VariableEvent::gpr const): >+ (JSC::DFG::VariableEvent::tagGPR const): >+ (JSC::DFG::VariableEvent::payloadGPR const): >+ (JSC::DFG::VariableEvent::fpr const): >+ (JSC::DFG::VariableEvent::spillRegister const): >+ (JSC::DFG::VariableEvent::bytecodeRegister const): >+ (JSC::DFG::VariableEvent::machineRegister const): >+ (JSC::DFG::VariableEvent::variableRepresentation const): >+ * dfg/DFGVariableEventStream.cpp: >+ (JSC::DFG::tryToSetConstantRecovery): >+ > 2019-05-12 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] Compress Watchpoint size by using enum type and Packed<> data structure >diff --git a/Source/JavaScriptCore/dfg/DFGCommonData.cpp b/Source/JavaScriptCore/dfg/DFGCommonData.cpp >index 73554bcb80fe99dee5e5a23185429779c61e4f21..5b6cf5cfcd744e3f87454b7099932ccec87d1361 100644 >--- a/Source/JavaScriptCore/dfg/DFGCommonData.cpp >+++ b/Source/JavaScriptCore/dfg/DFGCommonData.cpp >@@ -85,9 +85,12 @@ void CommonData::removeCallSiteIndex(CallSiteIndex callSite) > void CommonData::shrinkToFit() > { > codeOrigins.shrinkToFit(); >+ dfgIdentifiers.shrinkToFit(); > weakReferences.shrinkToFit(); >+ weakStructureReferences.shrinkToFit(); > transitions.shrinkToFit(); > catchEntrypoints.shrinkToFit(); >+ jumpReplacements.shrinkToFit(); > } > > static Lock pcCodeBlockMapLock; >diff --git a/Source/JavaScriptCore/dfg/DFGMinifiedID.h b/Source/JavaScriptCore/dfg/DFGMinifiedID.h >index a645cfa7b74292f9ccbf0b198beb79f37f874246..8cdcfc758ccf049213444ffcdc2eb2801f79018b 100644 >--- a/Source/JavaScriptCore/dfg/DFGMinifiedID.h >+++ b/Source/JavaScriptCore/dfg/DFGMinifiedID.h >@@ -42,20 +42,20 @@ class MinifiedID { > MinifiedID(WTF::HashTableDeletedValueType) : m_index(otherInvalidIndex()) { } > explicit MinifiedID(Node* node); > >- bool operator!() const { return m_index == invalidIndex(); } >+ bool operator!() const { return m_index.get() == invalidIndex(); } > >- bool operator==(const MinifiedID& other) const { return m_index == other.m_index; } >- bool operator!=(const MinifiedID& other) const { return m_index != other.m_index; } >- bool operator<(const MinifiedID& other) const { return m_index < other.m_index; } >- bool operator>(const MinifiedID& other) const { return m_index > other.m_index; } >- bool operator<=(const MinifiedID& other) const { return m_index <= other.m_index; } >- bool operator>=(const MinifiedID& other) const { return m_index >= other.m_index; } >+ bool operator==(const MinifiedID& other) const { return m_index.get() == other.m_index.get(); } >+ bool operator!=(const MinifiedID& other) const { return m_index.get() != other.m_index.get(); } >+ bool operator<(const MinifiedID& other) const { return m_index.get() < other.m_index.get(); } >+ bool operator>(const MinifiedID& other) const { return m_index.get() > other.m_index.get(); } >+ bool operator<=(const MinifiedID& other) const { return m_index.get() <= other.m_index.get(); } >+ bool operator>=(const MinifiedID& other) const { return m_index.get() >= other.m_index.get(); } > >- unsigned hash() const { return WTF::IntHash<unsigned>::hash(m_index); } >+ unsigned hash() const { return WTF::IntHash<unsigned>::hash(m_index.get()); } > >- void dump(PrintStream& out) const { out.print(m_index); } >+ void dump(PrintStream& out) const { out.print(m_index.get()); } > >- bool isHashTableDeletedValue() const { return m_index == otherInvalidIndex(); } >+ bool isHashTableDeletedValue() const { return m_index.get() == otherInvalidIndex(); } > > static MinifiedID fromBits(unsigned value) > { >@@ -64,7 +64,7 @@ class MinifiedID { > return result; > } > >- unsigned bits() const { return m_index; } >+ unsigned bits() const { return m_index.get(); } > > private: > friend class MinifiedNode; >@@ -72,7 +72,7 @@ class MinifiedID { > static constexpr unsigned invalidIndex() { return static_cast<unsigned>(-1); } > static constexpr unsigned otherInvalidIndex() { return static_cast<unsigned>(-2); } > >- unsigned m_index { invalidIndex() }; >+ Packed<unsigned> m_index { invalidIndex() }; > }; > > struct MinifiedIDHash { >diff --git a/Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h b/Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h >index 3869cf712dee5062218659e6fe6ec75d423f9e7a..5ea813756f998244945565b410d89ec066a9f2c0 100644 >--- a/Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h >+++ b/Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h >@@ -35,7 +35,7 @@ namespace DFG { > inline MinifiedID::MinifiedID(Node* node) > : m_index(node->index()) > { >- RELEASE_ASSERT(m_index != invalidIndex() && m_index != otherInvalidIndex()); >+ RELEASE_ASSERT(m_index.get() != invalidIndex() && m_index.get() != otherInvalidIndex()); > } > > } } // namespace JSC::DFG >diff --git a/Source/JavaScriptCore/dfg/DFGMinifiedNode.cpp b/Source/JavaScriptCore/dfg/DFGMinifiedNode.cpp >index 9a2ff991b33cc092a927ddf688993f3855bdd52b..90324c946a20252a00423853dc000dd28b59aa9b 100644 >--- a/Source/JavaScriptCore/dfg/DFGMinifiedNode.cpp >+++ b/Source/JavaScriptCore/dfg/DFGMinifiedNode.cpp >@@ -39,7 +39,9 @@ MinifiedNode MinifiedNode::fromNode(Node* node) > ASSERT(belongsInMinifiedGraph(node->op())); > MinifiedNode result; > result.m_id = MinifiedID(node); >- result.m_op = node->op(); >+ result.m_hasConstant = hasConstant(node->op()); >+ result.m_isPhantomDirectArguments = node->op() == PhantomDirectArguments; >+ result.m_isPhantomClonedArguments = node->op() == PhantomClonedArguments; > if (hasConstant(node->op())) > result.m_info = JSValue::encode(node->asJSValue()); > else { >diff --git a/Source/JavaScriptCore/dfg/DFGMinifiedNode.h b/Source/JavaScriptCore/dfg/DFGMinifiedNode.h >index de6cd4c7a712889c03730d3d62f79e3b374a99bf..ae5f9d017e5ed174390e2c84e361f3857e721e23 100644 >--- a/Source/JavaScriptCore/dfg/DFGMinifiedNode.h >+++ b/Source/JavaScriptCore/dfg/DFGMinifiedNode.h >@@ -57,20 +57,21 @@ class MinifiedNode { > static MinifiedNode fromNode(Node*); > > MinifiedID id() const { return m_id; } >- NodeType op() const { return m_op; } > >- bool hasConstant() const { return hasConstant(m_op); } >+ bool hasConstant() const { return m_hasConstant; } > > JSValue constant() const > { >- return JSValue::decode(bitwise_cast<EncodedJSValue>(m_info)); >+ return JSValue::decode(bitwise_cast<EncodedJSValue>(m_info.get())); > } > >- bool hasInlineCallFrame() const { return hasInlineCallFrame(m_op); } >+ bool isPhantomDirectArguments() const { return m_isPhantomDirectArguments; } >+ bool isPhantomClonedArguments() const { return m_isPhantomClonedArguments; } >+ bool hasInlineCallFrame() const { return m_isPhantomDirectArguments || m_isPhantomClonedArguments; } > > InlineCallFrame* inlineCallFrame() const > { >- return bitwise_cast<InlineCallFrame*>(static_cast<uintptr_t>(m_info)); >+ return bitwise_cast<InlineCallFrame*>(static_cast<uintptr_t>(m_info.get())); > } > > static MinifiedID getID(MinifiedNode* node) { return node->id(); } >@@ -85,14 +86,11 @@ class MinifiedNode { > return type == JSConstant || type == Int52Constant || type == DoubleConstant; > } > >- static bool hasInlineCallFrame(NodeType type) >- { >- return type == PhantomDirectArguments || type == PhantomClonedArguments; >- } >- >- uint64_t m_info; >+ Packed<uint64_t> m_info; > MinifiedID m_id; >- NodeType m_op; >+ bool m_hasConstant : 1; >+ bool m_isPhantomDirectArguments : 1; >+ bool m_isPhantomClonedArguments : 1; > }; > > } } // namespace JSC::DFG >diff --git a/Source/JavaScriptCore/dfg/DFGVariableEvent.h b/Source/JavaScriptCore/dfg/DFGVariableEvent.h >index ac25327d14e1c08d7e4b14572a7a106b22c3539b..2060d4a2fd27223dd6f699c6dbad6d22467c9834 100644 >--- a/Source/JavaScriptCore/dfg/DFGVariableEvent.h >+++ b/Source/JavaScriptCore/dfg/DFGVariableEvent.h >@@ -35,7 +35,7 @@ > > namespace JSC { namespace DFG { > >-enum VariableEventKind { >+enum VariableEventKind : uint8_t { > // Marks the beginning of a checkpoint. If you interpret the variable > // events starting at a Reset point then you'll get everything you need. > Reset, >@@ -101,10 +101,14 @@ class VariableEvent { > ASSERT(!(dataFormat & DataFormatJS)); > #endif > VariableEvent event; >- event.m_which.id = id.bits(); >- event.m_representation.gpr = gpr; >+ WhichType which; >+ which.id = id.bits(); >+ VariableRepresentation representation; >+ representation.gpr = gpr; > event.m_kind = kind; > event.m_dataFormat = dataFormat; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > >@@ -113,11 +117,15 @@ class VariableEvent { > { > ASSERT(kind == BirthToFill || kind == Fill); > VariableEvent event; >- event.m_which.id = id.bits(); >- event.m_representation.pair.tagGPR = tagGPR; >- event.m_representation.pair.payloadGPR = payloadGPR; >+ WhichType which; >+ which.id = id.bits(); >+ VariableRepresentation representation; >+ representation.pair.tagGPR = tagGPR; >+ representation.pair.payloadGPR = payloadGPR; > event.m_kind = kind; > event.m_dataFormat = DataFormatJS; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > #endif // USE(JSVALUE32_64) >@@ -126,18 +134,24 @@ class VariableEvent { > { > ASSERT(kind == BirthToFill || kind == Fill); > VariableEvent event; >- event.m_which.id = id.bits(); >- event.m_representation.fpr = fpr; >+ WhichType which; >+ which.id = id.bits(); >+ VariableRepresentation representation; >+ representation.fpr = fpr; > event.m_kind = kind; > event.m_dataFormat = DataFormatDouble; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > > static VariableEvent birth(MinifiedID id) > { > VariableEvent event; >- event.m_which.id = id.bits(); >+ WhichType which; >+ which.id = id.bits(); > event.m_kind = Birth; >+ event.m_which = WTFMove(which); > return event; > } > >@@ -145,18 +159,24 @@ class VariableEvent { > { > ASSERT(kind == BirthToSpill || kind == Spill); > VariableEvent event; >- event.m_which.id = id.bits(); >- event.m_representation.virtualReg = virtualRegister.offset(); >+ WhichType which; >+ which.id = id.bits(); >+ VariableRepresentation representation; >+ representation.virtualReg = virtualRegister.offset(); > event.m_kind = kind; > event.m_dataFormat = format; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > > static VariableEvent death(MinifiedID id) > { > VariableEvent event; >- event.m_which.id = id.bits(); >+ WhichType which; >+ which.id = id.bits(); > event.m_kind = Death; >+ event.m_which = WTFMove(which); > return event; > } > >@@ -164,19 +184,27 @@ class VariableEvent { > VirtualRegister bytecodeReg, VirtualRegister machineReg, DataFormat format) > { > VariableEvent event; >- event.m_which.virtualReg = machineReg.offset(); >- event.m_representation.virtualReg = bytecodeReg.offset(); >+ WhichType which; >+ which.virtualReg = machineReg.offset(); >+ VariableRepresentation representation; >+ representation.virtualReg = bytecodeReg.offset(); > event.m_kind = SetLocalEvent; > event.m_dataFormat = format; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > > static VariableEvent movHint(MinifiedID id, VirtualRegister bytecodeReg) > { > VariableEvent event; >- event.m_which.id = id.bits(); >- event.m_representation.virtualReg = bytecodeReg.offset(); >+ WhichType which; >+ which.id = id.bits(); >+ VariableRepresentation representation; >+ representation.virtualReg = bytecodeReg.offset(); > event.m_kind = MovHintEvent; >+ event.m_which = WTFMove(which); >+ event.m_representation = WTFMove(representation); > return event; > } > >@@ -190,7 +218,7 @@ class VariableEvent { > ASSERT( > m_kind == BirthToFill || m_kind == Fill || m_kind == BirthToSpill || m_kind == Spill > || m_kind == Death || m_kind == MovHintEvent || m_kind == Birth); >- return MinifiedID::fromBits(m_which.id); >+ return MinifiedID::fromBits(m_which.get().id); > } > > DataFormat dataFormat() const >@@ -209,7 +237,7 @@ class VariableEvent { > #if USE(JSVALUE32_64) > ASSERT(!(m_dataFormat & DataFormatJS)); > #endif >- return m_representation.gpr; >+ return m_representation.get().gpr; > } > > #if USE(JSVALUE32_64) >@@ -217,13 +245,13 @@ class VariableEvent { > { > ASSERT(m_kind == BirthToFill || m_kind == Fill); > ASSERT(m_dataFormat & DataFormatJS); >- return m_representation.pair.tagGPR; >+ return m_representation.get().pair.tagGPR; > } > MacroAssembler::RegisterID payloadGPR() const > { > ASSERT(m_kind == BirthToFill || m_kind == Fill); > ASSERT(m_dataFormat & DataFormatJS); >- return m_representation.pair.payloadGPR; >+ return m_representation.get().pair.payloadGPR; > } > #endif // USE(JSVALUE32_64) > >@@ -231,28 +259,28 @@ class VariableEvent { > { > ASSERT(m_kind == BirthToFill || m_kind == Fill); > ASSERT(m_dataFormat == DataFormatDouble); >- return m_representation.fpr; >+ return m_representation.get().fpr; > } > > VirtualRegister spillRegister() const > { > ASSERT(m_kind == BirthToSpill || m_kind == Spill); >- return VirtualRegister(m_representation.virtualReg); >+ return VirtualRegister(m_representation.get().virtualReg); > } > > VirtualRegister bytecodeRegister() const > { > ASSERT(m_kind == SetLocalEvent || m_kind == MovHintEvent); >- return VirtualRegister(m_representation.virtualReg); >+ return VirtualRegister(m_representation.get().virtualReg); > } > > VirtualRegister machineRegister() const > { > ASSERT(m_kind == SetLocalEvent); >- return VirtualRegister(m_which.virtualReg); >+ return VirtualRegister(m_which.get().virtualReg); > } > >- const VariableRepresentation& variableRepresentation() const { return m_representation; } >+ VariableRepresentation variableRepresentation() const { return m_representation.get(); } > > void dump(PrintStream&) const; > >@@ -260,10 +288,11 @@ class VariableEvent { > void dumpFillInfo(const char* name, PrintStream&) const; > void dumpSpillInfo(const char* name, PrintStream&) const; > >- union { >+ union WhichType { > int virtualReg; > unsigned id; >- } m_which; >+ }; >+ Packed<WhichType> m_which; > > // For BirthToFill, Fill: > // - The GPR or FPR, or a GPR pair. >@@ -273,9 +302,9 @@ class VariableEvent { > // - The bytecode operand. > // For Death: > // - Unused. >- VariableRepresentation m_representation; >+ Packed<VariableRepresentation> m_representation; > >- int8_t m_kind; >+ VariableEventKind m_kind; > DataFormat m_dataFormat { DataFormatNone }; > }; > >diff --git a/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp b/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp >index 4de11b4274df1353a3a9c5be22eb97cca7ec4184..6f8af42ce16594f4149f53c7a07383f6f1faa8bd 100644 >--- a/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp >+++ b/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp >@@ -101,12 +101,12 @@ static bool tryToSetConstantRecovery(ValueRecovery& recovery, MinifiedNode* node > return true; > } > >- if (node->op() == PhantomDirectArguments) { >+ if (node->isPhantomDirectArguments()) { > recovery = ValueRecovery::directArgumentsThatWereNotCreated(node->id()); > return true; > } > >- if (node->op() == PhantomClonedArguments) { >+ if (node->isPhantomClonedArguments()) { > recovery = ValueRecovery::clonedArgumentsThatWereNotCreated(node->id()); > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
saam
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197866
: 369811