WebKit Bugzilla
Attachment 369821 Details for
Bug 197833
: [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197833-20190513221639.patch (text/plain), 27.55 KB, created by
Yusuke Suzuki
on 2019-05-13 22:16:40 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-05-13 22:16:40 PDT
Size:
27.55 KB
patch
obsolete
>Subversion Revision: 245272 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index c20f93b297301d070bcd59226ec0bcb8c89a6c11..20902bce3e422c82ff5c4551274759e9426b08da 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,55 @@ >+2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more >+ https://bugs.webkit.org/show_bug.cgi?id=197833 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It turns out that Gmail creates so many JSFunctions, FunctionExecutables, and UnlinkedFunctionExecutables. >+ So we should shrink size of them to save memory. As a first step, this patch reduces the sizeof(UnlinkedFunctionExecutable) more by 16 bytes. >+ >+ 1. We reorder some fields to get 8 bytes. And we use 31 bits for xxx offset things since their maximum size should be within 31 bits due to >+ String's length & int32_t representation in our parser. >+ >+ 2. We drop m_inferredName and prefer m_ecmaName. The inferred name is used to offer better function name when the function expression lacks >+ the name, but now ECMAScript has a specified semantics to name those functions with intuitive names. We should use ecmaName consistently, >+ and should not eat 8 bytes for inferred names in UnlinkedFunctionExecutable. >+ >+ We also fix generator ecma name. >+ >+ * bytecode/CodeBlock.cpp: >+ (JSC::CodeBlock::inferredName const): >+ * bytecode/InlineCallFrame.cpp: >+ (JSC::InlineCallFrame::inferredName const): >+ * bytecode/UnlinkedFunctionExecutable.cpp: >+ (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): >+ * bytecode/UnlinkedFunctionExecutable.h: >+ * parser/ASTBuilder.h: >+ (JSC::ASTBuilder::createAssignResolve): >+ (JSC::ASTBuilder::createGeneratorFunctionBody): >+ (JSC::ASTBuilder::createGetterOrSetterProperty): >+ (JSC::ASTBuilder::createProperty): >+ (JSC::ASTBuilder::tryInferNameInPatternWithIdentifier): >+ (JSC::ASTBuilder::makeAssignNode): >+ * parser/Nodes.cpp: >+ (JSC::FunctionMetadataNode::operator== const): >+ (JSC::FunctionMetadataNode::dump const): >+ * parser/Nodes.h: >+ * runtime/CachedTypes.cpp: >+ (JSC::CachedFunctionExecutable::ecmaName const): >+ (JSC::CachedFunctionExecutable::encode): >+ (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): >+ (JSC::CachedFunctionExecutable::inferredName const): Deleted. >+ * runtime/FunctionExecutable.h: >+ * runtime/FunctionExecutableDump.cpp: >+ (JSC::FunctionExecutableDump::dump const): >+ * runtime/JSFunction.cpp: >+ (JSC::JSFunction::calculatedDisplayName): >+ (JSC::getCalculatedDisplayName): >+ * runtime/SamplingProfiler.cpp: >+ (JSC::SamplingProfiler::StackFrame::displayName): >+ (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): >+ > 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] Compress JIT related data more by using Packed<> >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ec1fd0759b74f1f95d3094c89cca1bacff95fbfe..31095ea800881dcc95c745c8626b96ca3230a4a9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,13 @@ >+2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more >+ https://bugs.webkit.org/show_bug.cgi?id=197833 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * testing/Internals.cpp: >+ (WebCore::Internals::parserMetaData): >+ > 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> > > Unreviewed, build fix after 245258, missing ThreadSpecific.h include >diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >index bcb8a9d212c40e27fc30d3cb58a45ea558dd01e0..bc9ed129def31a37d4f78451c3a167a71b8dee09 100644 >--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp >+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >@@ -122,7 +122,7 @@ CString CodeBlock::inferredName() const > case EvalCode: > return "<eval>"; > case FunctionCode: >- return jsCast<FunctionExecutable*>(ownerExecutable())->inferredName().utf8(); >+ return jsCast<FunctionExecutable*>(ownerExecutable())->ecmaName().utf8(); > case ModuleCode: > return "<module>"; > default: >diff --git a/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp b/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp >index ad2e0b89d2a6f63b7060c563ae2fde1302356794..de672fe1aa8b8591afbd2d6c0a800aa96a8f9c76 100644 >--- a/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp >+++ b/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp >@@ -56,7 +56,7 @@ CString InlineCallFrame::hashAsStringIfPossible() const > > CString InlineCallFrame::inferredName() const > { >- return jsCast<FunctionExecutable*>(baselineCodeBlock->ownerExecutable())->inferredName().utf8(); >+ return jsCast<FunctionExecutable*>(baselineCodeBlock->ownerExecutable())->ecmaName().utf8(); > } > > void InlineCallFrame::dumpBriefFunctionInformation(PrintStream& out) const >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >index 5e7148ebbc853c576b8bbb1c5a6f8ed669be7a08..14a069c5e07608d309182293656eb2187fd97fd6 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >@@ -84,34 +84,33 @@ static UnlinkedFunctionCodeBlock* generateUnlinkedFunctionCodeBlock( > UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& parentSource, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, JSParserScriptMode scriptMode, Optional<CompactVariableMap::Handle> parentScopeTDZVariables, DerivedContextType derivedContextType, bool isBuiltinDefaultClassConstructor) > : Base(*vm, structure) > , m_firstLineOffset(node->firstLine() - parentSource.firstLine().oneBasedInt()) >+ , m_isInStrictContext(node->isInStrictContext()) > , m_lineCount(node->lastLine() - node->firstLine()) >+ , m_hasCapturedVariables(false) > , m_unlinkedFunctionNameStart(node->functionNameStart() - parentSource.startOffset()) >+ , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction) > , m_unlinkedBodyStartColumn(node->startColumn()) >+ , m_isBuiltinDefaultClassConstructor(isBuiltinDefaultClassConstructor) > , m_unlinkedBodyEndColumn(m_lineCount ? node->endColumn() : node->endColumn() - node->startColumn()) >+ , m_constructAbility(static_cast<unsigned>(constructAbility)) > , m_startOffset(node->source().startOffset() - parentSource.startOffset()) >+ , m_scriptMode(static_cast<unsigned>(scriptMode)) > , m_sourceLength(node->source().length()) >+ , m_superBinding(static_cast<unsigned>(node->superBinding())) > , m_parametersStartOffset(node->parametersStart()) >+ , m_isCached(false) > , m_typeProfilingStartOffset(node->functionKeywordStart()) > , m_typeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1) > , m_parameterCount(node->parameterCount()) > , m_features(0) > , m_sourceParseMode(node->parseMode()) >- , m_isInStrictContext(node->isInStrictContext()) >- , m_hasCapturedVariables(false) >- , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction) >- , m_isBuiltinDefaultClassConstructor(isBuiltinDefaultClassConstructor) >- , m_constructAbility(static_cast<unsigned>(constructAbility)) > , m_constructorKind(static_cast<unsigned>(node->constructorKind())) > , m_functionMode(static_cast<unsigned>(node->functionMode())) >- , m_scriptMode(static_cast<unsigned>(scriptMode)) >- , m_superBinding(static_cast<unsigned>(node->superBinding())) > , m_derivedContextType(static_cast<unsigned>(derivedContextType)) >- , m_isCached(false) > , m_unlinkedCodeBlockForCall() > , m_unlinkedCodeBlockForConstruct() > , m_name(node->ident()) > , m_ecmaName(node->ecmaName()) >- , m_inferredName(node->inferredName()) > { > // Make sure these bitfields are adequately wide. > ASSERT(m_constructAbility == static_cast<unsigned>(constructAbility)); >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >index 8e0abed5c26ae5c66acf941eb0429b6fbe3f0cc0..0c7f89cd4eb024fcf80d78836c3f43c0a7cd23c3 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >@@ -81,7 +81,6 @@ class UnlinkedFunctionExecutable final : public JSCell { > const Identifier& name() const { return m_name; } > const Identifier& ecmaName() const { return m_ecmaName; } > void setEcmaName(const Identifier& name) { m_ecmaName = name; } >- const Identifier& inferredName() const { return m_inferredName; } > unsigned parameterCount() const { return m_parameterCount; }; // Excluding 'this'! > SourceParseMode parseMode() const { return static_cast<SourceParseMode>(m_sourceParseMode); }; > >@@ -205,30 +204,30 @@ class UnlinkedFunctionExecutable final : public JSCell { > > void decodeCachedCodeBlocks(); > >- unsigned m_firstLineOffset; >- unsigned m_lineCount; >- unsigned m_unlinkedFunctionNameStart; >- unsigned m_unlinkedBodyStartColumn; >- unsigned m_unlinkedBodyEndColumn; >- unsigned m_startOffset; >- unsigned m_sourceLength; >- unsigned m_parametersStartOffset; >- unsigned m_typeProfilingStartOffset; >- unsigned m_typeProfilingEndOffset; >- unsigned m_parameterCount; >- CodeFeatures m_features; >- SourceParseMode m_sourceParseMode; >+ unsigned m_firstLineOffset : 31; > unsigned m_isInStrictContext : 1; >+ unsigned m_lineCount : 31; > unsigned m_hasCapturedVariables : 1; >+ unsigned m_unlinkedFunctionNameStart : 31; > unsigned m_isBuiltinFunction : 1; >+ unsigned m_unlinkedBodyStartColumn : 31; > unsigned m_isBuiltinDefaultClassConstructor : 1; >+ unsigned m_unlinkedBodyEndColumn : 31; > unsigned m_constructAbility: 1; >- unsigned m_constructorKind : 2; >- unsigned m_functionMode : 2; // FunctionMode >+ unsigned m_startOffset : 31; > unsigned m_scriptMode: 1; // JSParserScriptMode >+ unsigned m_sourceLength : 31; > unsigned m_superBinding : 1; >+ unsigned m_parametersStartOffset : 31; >+ unsigned m_isCached : 1; >+ unsigned m_typeProfilingStartOffset; >+ unsigned m_typeProfilingEndOffset; >+ unsigned m_parameterCount; >+ CodeFeatures m_features; >+ SourceParseMode m_sourceParseMode; >+ unsigned m_constructorKind : 2; >+ unsigned m_functionMode : 2; // FunctionMode > unsigned m_derivedContextType: 2; >- bool m_isCached : 1; > > union { > WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall; >@@ -245,7 +244,6 @@ class UnlinkedFunctionExecutable final : public JSCell { > > Identifier m_name; > Identifier m_ecmaName; >- Identifier m_inferredName; > > RareData& ensureRareData() > { >diff --git a/Source/JavaScriptCore/parser/ASTBuilder.h b/Source/JavaScriptCore/parser/ASTBuilder.h >index 104e59bac45d55c81f5cdf87ed754ddfcdf6168e..e321221070823369d7648858502919a042981eec 100644 >--- a/Source/JavaScriptCore/parser/ASTBuilder.h >+++ b/Source/JavaScriptCore/parser/ASTBuilder.h >@@ -370,7 +370,6 @@ class ASTBuilder { > if (rhs->isBaseFuncExprNode()) { > auto metadata = static_cast<BaseFuncExprNode*>(rhs)->metadata(); > metadata->setEcmaName(ident); >- metadata->setInferredName(ident); > } else if (rhs->isClassExprNode()) > static_cast<ClassExprNode*>(rhs)->setEcmaName(ident); > AssignResolveNode* node = new (m_parserArena) AssignResolveNode(location, ident, rhs, assignmentContext); >@@ -417,7 +416,7 @@ class ASTBuilder { > { > FuncExprNode* result = static_cast<FuncExprNode*>(createFunctionExpr(location, functionInfo)); > if (!name.isNull()) >- result->metadata()->setInferredName(name); >+ result->metadata()->setEcmaName(name); > return result; > } > >@@ -475,7 +474,6 @@ class ASTBuilder { > ASSERT(name); > functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset); > functionInfo.body->setEcmaName(*name); >- functionInfo.body->setInferredName(*name); > SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.parametersStartColumn); > MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source); > return new (m_parserArena) PropertyNode(*name, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, tag); >@@ -507,7 +505,6 @@ class ASTBuilder { > if (node->isBaseFuncExprNode()) { > auto metadata = static_cast<BaseFuncExprNode*>(node)->metadata(); > metadata->setEcmaName(*propertyName); >- metadata->setInferredName(*propertyName); > } else if (node->isClassExprNode()) > static_cast<ClassExprNode*>(node)->setEcmaName(*propertyName); > } >@@ -1115,7 +1112,6 @@ class ASTBuilder { > if (defaultValue->isBaseFuncExprNode()) { > auto metadata = static_cast<BaseFuncExprNode*>(defaultValue)->metadata(); > metadata->setEcmaName(ident); >- metadata->setInferredName(ident); > } else if (defaultValue->isClassExprNode()) > static_cast<ClassExprNode*>(defaultValue)->setEcmaName(ident); > } >@@ -1480,7 +1476,6 @@ ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, Expr > if (expr->isBaseFuncExprNode()) { > auto metadata = static_cast<BaseFuncExprNode*>(expr)->metadata(); > metadata->setEcmaName(resolve->identifier()); >- metadata->setInferredName(resolve->identifier()); > } else if (expr->isClassExprNode()) > static_cast<ClassExprNode*>(expr)->setEcmaName(resolve->identifier()); > AssignResolveNode* node = new (m_parserArena) AssignResolveNode(location, resolve->identifier(), expr, AssignmentContext::AssignmentExpression); >@@ -1499,14 +1494,8 @@ ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, Expr > } > ASSERT(loc->isDotAccessorNode()); > DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc); >- if (op == OpEqual) { >- if (expr->isBaseFuncExprNode()) { >- // We don't also set the ecma name here because ES6 specifies that the >- // function should not pick up the name of the dot->identifier(). >- static_cast<BaseFuncExprNode*>(expr)->metadata()->setInferredName(dot->identifier()); >- } >+ if (op == OpEqual) > return new (m_parserArena) AssignDotNode(location, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), start, end); >- } > > ReadModifyDotNode* node = new (m_parserArena) ReadModifyDotNode(location, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, start, end); > node->setSubexpressionInfo(dot->divot(), dot->divotEnd().offset); >diff --git a/Source/JavaScriptCore/parser/Nodes.cpp b/Source/JavaScriptCore/parser/Nodes.cpp >index 6143efd6233ae25d453d6149a1ce26d6d0bd68da..15bdb56dab60e7fe435c2c4adad742a1e79fe351 100644 >--- a/Source/JavaScriptCore/parser/Nodes.cpp >+++ b/Source/JavaScriptCore/parser/Nodes.cpp >@@ -257,7 +257,6 @@ bool FunctionMetadataNode::operator==(const FunctionMetadataNode& other) const > && m_isArrowFunctionBodyExpression == other.m_isArrowFunctionBodyExpression > && m_ident == other.m_ident > && m_ecmaName == other.m_ecmaName >- && m_inferredName == other.m_inferredName > && m_functionMode== other.m_functionMode > && m_startColumn== other.m_startColumn > && m_endColumn== other.m_endColumn >@@ -281,7 +280,6 @@ void FunctionMetadataNode::dump(PrintStream& stream) const > stream.println("m_isArrowFunctionBodyExpression ", m_isArrowFunctionBodyExpression); > stream.println("m_ident ", m_ident); > stream.println("m_ecmaName ", m_ecmaName); >- stream.println("m_inferredName ", m_inferredName); > stream.println("m_functionMode ", static_cast<uint32_t>(m_functionMode)); > stream.println("m_startColumn ", m_startColumn); > stream.println("m_endColumn ", m_endColumn); >diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h >index 15ffc14df1e7062b466234a798228e072f005413..728f736e7ad5f1a82091303ac091342e7e1e3fe5 100644 >--- a/Source/JavaScriptCore/parser/Nodes.h >+++ b/Source/JavaScriptCore/parser/Nodes.h >@@ -1994,8 +1994,6 @@ namespace JSC { > const Identifier& ident() { return m_ident; } > void setEcmaName(const Identifier& ecmaName) { m_ecmaName = ecmaName; } > const Identifier& ecmaName() { return m_ident.isEmpty() ? m_ecmaName : m_ident; } >- void setInferredName(const Identifier& inferredName) { ASSERT(!inferredName.isNull()); m_inferredName = inferredName; } >- const Identifier& inferredName() { return m_inferredName.isEmpty() ? m_ident : m_inferredName; } > > FunctionMode functionMode() { return m_functionMode; } > >@@ -2042,7 +2040,6 @@ namespace JSC { > FunctionMode m_functionMode; > Identifier m_ident; > Identifier m_ecmaName; >- Identifier m_inferredName; > unsigned m_startColumn; > unsigned m_endColumn; > int m_functionKeywordStart; >diff --git a/Source/JavaScriptCore/runtime/CachedTypes.cpp b/Source/JavaScriptCore/runtime/CachedTypes.cpp >index 22f3c2ed21f15480392879f436ea5bafb7e7446b..a2a6fdbfacf863b8b75e5221dbe34eea77459f43 100644 >--- a/Source/JavaScriptCore/runtime/CachedTypes.cpp >+++ b/Source/JavaScriptCore/runtime/CachedTypes.cpp >@@ -1641,7 +1641,6 @@ class CachedFunctionExecutable : public CachedObject<UnlinkedFunctionExecutable> > > Identifier name(Decoder& decoder) const { return m_name.decode(decoder); } > Identifier ecmaName(Decoder& decoder) const { return m_ecmaName.decode(decoder); } >- Identifier inferredName(Decoder& decoder) const { return m_inferredName.decode(decoder); } > > UnlinkedFunctionExecutable::RareData* rareData(Decoder& decoder) const { return m_rareData.decode(decoder); } > >@@ -1677,7 +1676,6 @@ class CachedFunctionExecutable : public CachedObject<UnlinkedFunctionExecutable> > > CachedIdentifier m_name; > CachedIdentifier m_ecmaName; >- CachedIdentifier m_inferredName; > > CachedWriteBarrier<CachedFunctionCodeBlock, UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall; > CachedWriteBarrier<CachedFunctionCodeBlock, UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForConstruct; >@@ -2044,7 +2042,6 @@ ALWAYS_INLINE void CachedFunctionExecutable::encode(Encoder& encoder, const Unli > > m_name.encode(encoder, executable.name()); > m_ecmaName.encode(encoder, executable.ecmaName()); >- m_inferredName.encode(encoder, executable.inferredName()); > > m_unlinkedCodeBlockForCall.encode(encoder, executable.m_unlinkedCodeBlockForCall); > m_unlinkedCodeBlockForConstruct.encode(encoder, executable.m_unlinkedCodeBlockForConstruct); >@@ -2063,35 +2060,34 @@ ALWAYS_INLINE UnlinkedFunctionExecutable* CachedFunctionExecutable::decode(Decod > ALWAYS_INLINE UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(Decoder& decoder, const CachedFunctionExecutable& cachedExecutable) > : Base(decoder.vm(), decoder.vm().unlinkedFunctionExecutableStructure.get()) > , m_firstLineOffset(cachedExecutable.firstLineOffset()) >+ , m_isInStrictContext(cachedExecutable.isInStrictContext()) > , m_lineCount(cachedExecutable.lineCount()) >+ , m_hasCapturedVariables(cachedExecutable.hasCapturedVariables()) > , m_unlinkedFunctionNameStart(cachedExecutable.unlinkedFunctionNameStart()) >+ , m_isBuiltinFunction(cachedExecutable.isBuiltinFunction()) > , m_unlinkedBodyStartColumn(cachedExecutable.unlinkedBodyStartColumn()) >+ , m_isBuiltinDefaultClassConstructor(cachedExecutable.isBuiltinDefaultClassConstructor()) > , m_unlinkedBodyEndColumn(cachedExecutable.unlinkedBodyEndColumn()) >+ , m_constructAbility(cachedExecutable.constructAbility()) > , m_startOffset(cachedExecutable.startOffset()) >+ , m_scriptMode(cachedExecutable.scriptMode()) > , m_sourceLength(cachedExecutable.sourceLength()) >+ , m_superBinding(cachedExecutable.superBinding()) > , m_parametersStartOffset(cachedExecutable.parametersStartOffset()) >+ , m_isCached(false) > , m_typeProfilingStartOffset(cachedExecutable.typeProfilingStartOffset()) > , m_typeProfilingEndOffset(cachedExecutable.typeProfilingEndOffset()) > , m_parameterCount(cachedExecutable.parameterCount()) > , m_features(cachedExecutable.features()) > , m_sourceParseMode(cachedExecutable.sourceParseMode()) >- , m_isInStrictContext(cachedExecutable.isInStrictContext()) >- , m_hasCapturedVariables(cachedExecutable.hasCapturedVariables()) >- , m_isBuiltinFunction(cachedExecutable.isBuiltinFunction()) >- , m_isBuiltinDefaultClassConstructor(cachedExecutable.isBuiltinDefaultClassConstructor()) >- , m_constructAbility(cachedExecutable.constructAbility()) > , m_constructorKind(cachedExecutable.constructorKind()) > , m_functionMode(cachedExecutable.functionMode()) >- , m_scriptMode(cachedExecutable.scriptMode()) >- , m_superBinding(cachedExecutable.superBinding()) > , m_derivedContextType(cachedExecutable.derivedContextType()) >- , m_isCached(false) > , m_unlinkedCodeBlockForCall() > , m_unlinkedCodeBlockForConstruct() > > , m_name(cachedExecutable.name(decoder)) > , m_ecmaName(cachedExecutable.ecmaName(decoder)) >- , m_inferredName(cachedExecutable.inferredName(decoder)) > > , m_rareData(cachedExecutable.rareData(decoder)) > { >diff --git a/Source/JavaScriptCore/runtime/FunctionExecutable.h b/Source/JavaScriptCore/runtime/FunctionExecutable.h >index 6fb5ccd119ab8f93c4bbaeca0cadc1ec8df8a700..598803ce2afe08f5ecbb08268da466db4815ffa5 100644 >--- a/Source/JavaScriptCore/runtime/FunctionExecutable.h >+++ b/Source/JavaScriptCore/runtime/FunctionExecutable.h >@@ -161,7 +161,6 @@ class FunctionExecutable final : public ScriptExecutable { > bool isClassConstructorFunction() const { return m_unlinkedExecutable->isClassConstructorFunction(); } > const Identifier& name() { return m_unlinkedExecutable->name(); } > const Identifier& ecmaName() { return m_unlinkedExecutable->ecmaName(); } >- const Identifier& inferredName() { return m_unlinkedExecutable->inferredName(); } > unsigned parameterCount() const { return m_unlinkedExecutable->parameterCount(); } // Excluding 'this'! > SourceParseMode parseMode() const { return m_unlinkedExecutable->parseMode(); } > JSParserScriptMode scriptMode() const { return m_unlinkedExecutable->scriptMode(); } >diff --git a/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp b/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp >index 75845fad0ace33a9ce655696a5408c305cdad578..9956b2b185892b51447f859bbeda830a17a3c540 100644 >--- a/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp >+++ b/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp >@@ -34,7 +34,7 @@ namespace JSC { > > void FunctionExecutableDump::dump(PrintStream& out) const > { >- out.print(m_executable->inferredName().string(), "#"); >+ out.print(m_executable->ecmaName().string(), "#"); > if (m_executable->isGeneratedForCall()) > out.print(m_executable->codeBlockForCall()->hashAsStringIfPossible()); > else >diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp >index 37ff4c8d6391284703fc2e7d3835e2799aca1043..f3a96d8556b76a18b7c1b413bd711c767d9f1721 100644 >--- a/Source/JavaScriptCore/runtime/JSFunction.cpp >+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp >@@ -227,7 +227,7 @@ const String JSFunction::calculatedDisplayName(VM& vm) > if (!actualName.isEmpty() || isHostOrBuiltinFunction()) > return actualName; > >- return jsExecutable()->inferredName().string(); >+ return jsExecutable()->ecmaName().string(); > } > > const SourceCode* JSFunction::sourceCode() const >@@ -651,7 +651,7 @@ String getCalculatedDisplayName(VM& vm, JSObject* object) > if (!actualName.isEmpty() || function->isHostOrBuiltinFunction()) > return actualName; > >- return function->jsExecutable()->inferredName().string(); >+ return function->jsExecutable()->ecmaName().string(); > } > if (auto* function = jsDynamicCast<InternalFunction*>(vm, object)) > return function->name(); >diff --git a/Source/JavaScriptCore/runtime/SamplingProfiler.cpp b/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >index 3c2fb6f65d7ddd29d47bc84a22c05781effbbe71..e4746ca405c4c9f01f1d139ef4646524f7ac71e0 100644 >--- a/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >+++ b/Source/JavaScriptCore/runtime/SamplingProfiler.cpp >@@ -779,7 +779,7 @@ String SamplingProfiler::StackFrame::displayName(VM& vm) > return static_cast<NativeExecutable*>(executable)->name(); > > if (executable->isFunctionExecutable()) >- return static_cast<FunctionExecutable*>(executable)->inferredName().string(); >+ return static_cast<FunctionExecutable*>(executable)->ecmaName().string(); > if (executable->isProgramExecutable() || executable->isEvalExecutable()) > return "(program)"_s; > if (executable->isModuleProgramExecutable()) >@@ -806,7 +806,7 @@ String SamplingProfiler::StackFrame::displayNameForJSONTests(VM& vm) > return static_cast<NativeExecutable*>(executable)->name(); > > if (executable->isFunctionExecutable()) { >- String result = static_cast<FunctionExecutable*>(executable)->inferredName().string(); >+ String result = static_cast<FunctionExecutable*>(executable)->ecmaName().string(); > if (result.isEmpty()) > return "(anonymous function)"_s; > return result; >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 524e3b321dc381d949d130c46476b202bdf5b8e9..6c4737e155c6d750ae8e2ff829dbdf0be012aaa0 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -2147,7 +2147,7 @@ String Internals::parserMetaData(JSC::JSValue code) > > if (executable->isFunctionExecutable()) { > FunctionExecutable* funcExecutable = reinterpret_cast<FunctionExecutable*>(executable); >- String inferredName = funcExecutable->inferredName().string(); >+ String inferredName = funcExecutable->ecmaName().string(); > result.appendLiteral("function \""); > result.append(inferredName); > result.append('"'); >diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog >index 21ecceb1152c1bdfc94e0aed1ff5c82d8682d19d..c3b6856cafaf0d57ede33656b26c700e6260abfd 100644 >--- a/JSTests/ChangeLog >+++ b/JSTests/ChangeLog >@@ -1,3 +1,15 @@ >+2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more >+ https://bugs.webkit.org/show_bug.cgi?id=197833 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * stress/generator-name.js: Added. >+ (shouldBe): >+ (gen): >+ (catch): >+ > 2019-05-13 Tadeu Zagallo <tzagallo@apple.com> > > JSObject::getOwnPropertyDescriptor is missing an exception check >diff --git a/JSTests/stress/generator-name.js b/JSTests/stress/generator-name.js >new file mode 100644 >index 0000000000000000000000000000000000000000..111625ffb2a10c2ddd423b3d316106d8dd4a4771 >--- /dev/null >+++ b/JSTests/stress/generator-name.js >@@ -0,0 +1,16 @@ >+function shouldBe(actual, expected) { >+ if (actual !== expected) >+ throw new Error('bad value: ' + actual); >+} >+ >+function*gen() { throw new Error(); } >+ >+var flag = true; >+var g = gen(); >+try { >+ g.next(); >+ flag = false; >+} catch (error) { >+ shouldBe(error.stack.startsWith("gen@"), true); >+} >+shouldBe(flag, 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:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197833
:
369710
|
369712
|
369721
|
369722
|
369723
|
369814
| 369821