Commit bdf5d1d4 authored by akling@apple.com's avatar akling@apple.com

JSC Parser: Shrink BindingNode.

<https://webkit.org/b/127253>

The "divot" and "end" source locations are always identical for
BindingNodes, so store only "start" and "end" instead.

1.19 MB progression on Membuster3.

Reviewed by Geoff Garen.

* bytecompiler/NodesCodegen.cpp:
(JSC::BindingNode::bindValue):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createBindingLocation):
* parser/NodeConstructors.h:
(JSC::BindingNode::create):
(JSC::BindingNode::BindingNode):
* parser/Nodes.h:
(JSC::BindingNode::divotStart):
(JSC::BindingNode::divotEnd):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::createBindingPattern):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 067afd26
2014-01-19 Andreas Kling <akling@apple.com>
JSC Parser: Shrink BindingNode.
<https://webkit.org/b/127253>
The "divot" and "end" source locations are always identical for
BindingNodes, so store only "start" and "end" instead.
1.19 MB progression on Membuster3.
Reviewed by Geoff Garen.
* bytecompiler/NodesCodegen.cpp:
(JSC::BindingNode::bindValue):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createBindingLocation):
* parser/NodeConstructors.h:
(JSC::BindingNode::create):
(JSC::BindingNode::BindingNode):
* parser/Nodes.h:
(JSC::BindingNode::divotStart):
(JSC::BindingNode::divotEnd):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::createBindingPattern):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):
2014-01-20 Filip Pizlo <fpizlo@apple.com>
op_captured_mov and op_new_captured_func in UnlinkedCodeBlocks should use the IdentifierMap instead of the strings directly
......
......@@ -2475,9 +2475,9 @@ void BindingNode::bindValue(BytecodeGenerator& generator, RegisterID* value) con
return;
}
if (generator.isStrictMode())
generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
generator.emitExpressionInfo(divotEnd(), divotStart(), divotEnd());
RegisterID* scope = generator.emitResolveScope(generator.newTemporary(), m_boundProperty);
generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
generator.emitExpressionInfo(divotEnd(), divotStart(), divotEnd());
generator.emitPutToScope(scope, m_boundProperty, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound);
return;
}
......
......@@ -674,9 +674,9 @@ public:
node->appendEntry(location, identifier, wasString, pattern.get());
}
BindingPattern createBindingLocation(const JSTokenLocation&, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
BindingPattern createBindingLocation(const JSTokenLocation&, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end)
{
return BindingNode::create(m_vm, boundProperty, divot, start, end);
return BindingNode::create(m_vm, boundProperty, start, end);
}
private:
......
......@@ -888,14 +888,15 @@ inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifie
return adoptRef(new ObjectPatternNode(vm));
}
inline PassRefPtr<BindingNode> BindingNode::create(VM* vm, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
inline PassRefPtr<BindingNode> BindingNode::create(VM* vm, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end)
{
return adoptRef(new BindingNode(vm, boundProperty, divot, start, end));
return adoptRef(new BindingNode(vm, boundProperty, start, end));
}
inline BindingNode::BindingNode(VM* vm, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end)
inline BindingNode::BindingNode(VM* vm, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end)
: DeconstructionPatternNode(vm)
, ThrowableExpressionData(divot, start, end)
, m_divotStart(start)
, m_divotEnd(end)
, m_boundProperty(boundProperty)
{
}
......
......@@ -1641,13 +1641,16 @@ namespace JSC {
Vector<Entry> m_targetPatterns;
};
class BindingNode : public DeconstructionPatternNode, ThrowableExpressionData {
class BindingNode : public DeconstructionPatternNode {
public:
static PassRefPtr<BindingNode> create(VM*, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end);
static PassRefPtr<BindingNode> create(VM*, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end);
const Identifier& boundProperty() const { return m_boundProperty; }
const JSTextPosition& divotStart() const { return m_divotStart; }
const JSTextPosition& divotEnd() const { return m_divotEnd; }
private:
BindingNode(VM*, const Identifier& boundProperty, const JSTextPosition& divot, const JSTextPosition& start, const JSTextPosition& end);
BindingNode(VM*, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end);
virtual void collectBoundIdentifiers(Vector<Identifier>&) const override;
virtual void bindValue(BytecodeGenerator&, RegisterID*) const override;
......@@ -1655,6 +1658,8 @@ namespace JSC {
virtual bool isBindingNode() const override { return true; }
JSTextPosition m_divotStart;
JSTextPosition m_divotEnd;
Identifier m_boundProperty;
};
......
......@@ -518,7 +518,7 @@ template <class TreeBuilder> TreeDeconstructionPattern Parser<LexerType>::create
}
}
}
return context.createBindingLocation(m_token.m_location, name, m_token.m_endPosition, m_token.m_startPosition, m_token.m_endPosition);
return context.createBindingLocation(m_token.m_location, name, m_token.m_startPosition, m_token.m_endPosition);
}
template <typename LexerType>
......
......@@ -280,7 +280,7 @@ public:
void appendObjectPatternEntry(ArrayPattern, const JSTokenLocation&, bool, const Identifier&, DeconstructionPattern)
{
}
DeconstructionPattern createBindingLocation(const JSTokenLocation&, const Identifier&, const JSTextPosition&, const JSTextPosition&, const JSTextPosition&)
DeconstructionPattern createBindingLocation(const JSTokenLocation&, const Identifier&, const JSTextPosition&, const JSTextPosition&)
{
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment