[JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
https://bugs.webkit.org/show_bug.cgi?id=197833
Reviewed by Darin Adler.
JSTests:
* stress/generator-name.js: Added.
(shouldBe):
(gen):
(catch):
Source/JavaScriptCore:
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):
Source/WebCore:
* testing/Internals.cpp:
(WebCore::Internals::parserMetaData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog
index 21ecceb..e5d837e 100644
--- a/JSTests/ChangeLog
+++ b/JSTests/ChangeLog
@@ -1,3 +1,15 @@
+2019-05-14 Yusuke Suzuki <ysuzuki@apple.com>
+
+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
+ https://bugs.webkit.org/show_bug.cgi?id=197833
+
+ Reviewed by Darin Adler.
+
+ * 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 0000000..111625f
--- /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);
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index c20f93b..f341b2f 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,55 @@
+2019-05-14 Yusuke Suzuki <ysuzuki@apple.com>
+
+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
+ https://bugs.webkit.org/show_bug.cgi?id=197833
+
+ Reviewed by Darin Adler.
+
+ 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/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index bcb8a9d..bc9ed12 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -122,7 +122,7 @@
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 ad2e0b8..de672fe 100644
--- a/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp
+++ b/Source/JavaScriptCore/bytecode/InlineCallFrame.cpp
@@ -56,7 +56,7 @@
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 5e7148e..14a069c 100644
--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
@@ -84,34 +84,33 @@
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 8e0abed..0c7f89c 100644
--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
@@ -81,7 +81,6 @@
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 @@
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_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_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_isInStrictContext : 1;
- unsigned m_hasCapturedVariables : 1;
- unsigned m_isBuiltinFunction : 1;
- unsigned m_isBuiltinDefaultClassConstructor : 1;
- unsigned m_constructAbility: 1;
unsigned m_constructorKind : 2;
unsigned m_functionMode : 2; // FunctionMode
- unsigned m_scriptMode: 1; // JSParserScriptMode
- unsigned m_superBinding : 1;
unsigned m_derivedContextType: 2;
- bool m_isCached : 1;
union {
WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall;
@@ -245,7 +244,6 @@
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 104e59b..e321221 100644
--- a/Source/JavaScriptCore/parser/ASTBuilder.h
+++ b/Source/JavaScriptCore/parser/ASTBuilder.h
@@ -370,7 +370,6 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 6143efd..15bdb56 100644
--- a/Source/JavaScriptCore/parser/Nodes.cpp
+++ b/Source/JavaScriptCore/parser/Nodes.cpp
@@ -257,7 +257,6 @@
&& 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 @@
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 15ffc14..728f736 100644
--- a/Source/JavaScriptCore/parser/Nodes.h
+++ b/Source/JavaScriptCore/parser/Nodes.h
@@ -1994,8 +1994,6 @@
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 @@
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 22f3c2e..3b610a8 100644
--- a/Source/JavaScriptCore/runtime/CachedTypes.cpp
+++ b/Source/JavaScriptCore/runtime/CachedTypes.cpp
@@ -1641,7 +1641,6 @@
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); }
@@ -1651,33 +1650,32 @@
private:
CachedFunctionExecutableMetadata m_mutableMetadata;
- 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_firstLineOffset : 31;
+ unsigned m_isInStrictContext : 1;
+ unsigned m_lineCount : 31;
+ unsigned m_isBuiltinFunction : 1;
+ unsigned m_unlinkedFunctionNameStart : 31;
+ unsigned m_isBuiltinDefaultClassConstructor : 1;
+ unsigned m_unlinkedBodyStartColumn : 31;
+ unsigned m_constructAbility: 1;
+ unsigned m_unlinkedBodyEndColumn : 31;
+ unsigned m_startOffset : 31;
+ unsigned m_scriptMode: 1; // JSParserScriptMode
+ unsigned m_sourceLength : 31;
+ unsigned m_superBinding : 1;
+ unsigned m_parametersStartOffset : 31;
unsigned m_typeProfilingStartOffset;
unsigned m_typeProfilingEndOffset;
unsigned m_parameterCount;
SourceParseMode m_sourceParseMode;
- unsigned m_isInStrictContext : 1;
- unsigned m_isBuiltinFunction : 1;
- unsigned m_isBuiltinDefaultClassConstructor : 1;
- unsigned m_constructAbility: 1;
unsigned m_constructorKind : 2;
unsigned m_functionMode : 2; // FunctionMode
- unsigned m_scriptMode: 1; // JSParserScriptMode
- unsigned m_superBinding : 1;
unsigned m_derivedContextType: 2;
CachedPtr<CachedFunctionExecutableRareData> m_rareData;
CachedIdentifier m_name;
CachedIdentifier m_ecmaName;
- CachedIdentifier m_inferredName;
CachedWriteBarrier<CachedFunctionCodeBlock, UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall;
CachedWriteBarrier<CachedFunctionCodeBlock, UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForConstruct;
@@ -2044,7 +2042,6 @@
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::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 6fb5ccd..598803c 100644
--- a/Source/JavaScriptCore/runtime/FunctionExecutable.h
+++ b/Source/JavaScriptCore/runtime/FunctionExecutable.h
@@ -161,7 +161,6 @@
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 75845fa..9956b2b 100644
--- a/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp
+++ b/Source/JavaScriptCore/runtime/FunctionExecutableDump.cpp
@@ -34,7 +34,7 @@
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 37ff4c8..f3a96d8 100644
--- a/Source/JavaScriptCore/runtime/JSFunction.cpp
+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp
@@ -227,7 +227,7 @@
if (!actualName.isEmpty() || isHostOrBuiltinFunction())
return actualName;
- return jsExecutable()->inferredName().string();
+ return jsExecutable()->ecmaName().string();
}
const SourceCode* JSFunction::sourceCode() const
@@ -651,7 +651,7 @@
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 3c2fb6f..e4746ca 100644
--- a/Source/JavaScriptCore/runtime/SamplingProfiler.cpp
+++ b/Source/JavaScriptCore/runtime/SamplingProfiler.cpp
@@ -779,7 +779,7 @@
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 @@
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/ChangeLog b/Source/WebCore/ChangeLog
index e01a29c..767f327 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2019-05-14 Yusuke Suzuki <ysuzuki@apple.com>
+
+ [JSC] Shrink sizeof(UnlinkedFunctionExecutable) more
+ https://bugs.webkit.org/show_bug.cgi?id=197833
+
+ Reviewed by Darin Adler.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::parserMetaData):
+
2019-05-14 Antoine Quint <graouts@apple.com>
[Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS
diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp
index 49c0dba..eb94fed 100644
--- a/Source/WebCore/testing/Internals.cpp
+++ b/Source/WebCore/testing/Internals.cpp
@@ -2159,7 +2159,7 @@
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('"');