Title: [170594] trunk/Source/_javascript_Core
- Revision
- 170594
- Author
- [email protected]
- Date
- 2014-06-30 11:48:56 -0700 (Mon, 30 Jun 2014)
Log Message
Avoid copying closed variables vector; actually use move semantics
Rubber-stamped by Oliver Hunt.
Currently we always copy the closed variables vector passed by Parser::closedVariables()
to ProgramNode::setClosedVariables() because these member functions return and take a const
rvalue reference, respectively. Instead, these member functions should take an return a non-
constant rvalue reference so that we actually move the closed variables vector from the Parser
object to the Node object.
* parser/Nodes.cpp:
(JSC::ProgramNode::setClosedVariables): Remove const qualifier for argument.
* parser/Nodes.h:
(JSC::ScopeNode::setClosedVariables): Ditto.
* parser/Parser.h:
(JSC::Parser::closedVariables): Remove const qualifier on return type.
(JSC::parse): Remove extraneous call to std::move(). Calling std::move() is unnecessary here
because Parser::closedVariables() returns an rvalue reference.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (170593 => 170594)
--- trunk/Source/_javascript_Core/ChangeLog 2014-06-30 18:27:22 UTC (rev 170593)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-06-30 18:48:56 UTC (rev 170594)
@@ -1,3 +1,24 @@
+2014-06-30 Daniel Bates <[email protected]>
+
+ Avoid copying closed variables vector; actually use move semantics
+
+ Rubber-stamped by Oliver Hunt.
+
+ Currently we always copy the closed variables vector passed by Parser::closedVariables()
+ to ProgramNode::setClosedVariables() because these member functions return and take a const
+ rvalue reference, respectively. Instead, these member functions should take an return a non-
+ constant rvalue reference so that we actually move the closed variables vector from the Parser
+ object to the Node object.
+
+ * parser/Nodes.cpp:
+ (JSC::ProgramNode::setClosedVariables): Remove const qualifier for argument.
+ * parser/Nodes.h:
+ (JSC::ScopeNode::setClosedVariables): Ditto.
+ * parser/Parser.h:
+ (JSC::Parser::closedVariables): Remove const qualifier on return type.
+ (JSC::parse): Remove extraneous call to std::move(). Calling std::move() is unnecessary here
+ because Parser::closedVariables() returns an rvalue reference.
+
2014-06-30 Joseph Pecoraro <[email protected]>
JSContext Inspection: Provide a way to use a non-Main RunLoop for Inspector _javascript_ Evaluations
Modified: trunk/Source/_javascript_Core/parser/Nodes.cpp (170593 => 170594)
--- trunk/Source/_javascript_Core/parser/Nodes.cpp 2014-06-30 18:27:22 UTC (rev 170593)
+++ trunk/Source/_javascript_Core/parser/Nodes.cpp 2014-06-30 18:48:56 UTC (rev 170594)
@@ -133,7 +133,7 @@
}
-void ProgramNode::setClosedVariables(const Vector<RefPtr<StringImpl>>&& closedVariables)
+void ProgramNode::setClosedVariables(Vector<RefPtr<StringImpl>>&& closedVariables)
{
m_closedVariables = std::move(closedVariables);
}
Modified: trunk/Source/_javascript_Core/parser/Nodes.h (170593 => 170594)
--- trunk/Source/_javascript_Core/parser/Nodes.h 2014-06-30 18:27:22 UTC (rev 170593)
+++ trunk/Source/_javascript_Core/parser/Nodes.h 2014-06-30 18:48:56 UTC (rev 170594)
@@ -1449,7 +1449,7 @@
void emitStatementsBytecode(BytecodeGenerator&, RegisterID* destination);
- void setClosedVariables(const Vector<RefPtr<StringImpl>>&&) { }
+ void setClosedVariables(Vector<RefPtr<StringImpl>>&&) { }
protected:
void setSource(const SourceCode& source) { m_source = source; }
@@ -1479,7 +1479,7 @@
static const bool scopeIsFunction = false;
- void setClosedVariables(const Vector<RefPtr<StringImpl>>&&);
+ void setClosedVariables(Vector<RefPtr<StringImpl>>&&);
const Vector<RefPtr<StringImpl>>& closedVariables() const { return m_closedVariables; }
private:
ProgramNode(VM*, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
Modified: trunk/Source/_javascript_Core/parser/Parser.h (170593 => 170594)
--- trunk/Source/_javascript_Core/parser/Parser.h 2014-06-30 18:27:22 UTC (rev 170593)
+++ trunk/Source/_javascript_Core/parser/Parser.h 2014-06-30 18:48:56 UTC (rev 170594)
@@ -401,7 +401,7 @@
PassRefPtr<ParsedNode> parse(ParserError&, bool needReparsingAdjustment);
JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); }
- const Vector<RefPtr<StringImpl>>&& closedVariables() { return std::move(m_closedVariables); }
+ Vector<RefPtr<StringImpl>>&& closedVariables() { return std::move(m_closedVariables); }
private:
struct AllowInOverride {
@@ -951,7 +951,7 @@
if (!result)
WTF::dataLog("Error compiling builtin: ", error.m_message, "\n");
RELEASE_ASSERT(result);
- result->setClosedVariables(std::move(parser.closedVariables()));
+ result->setClosedVariables(parser.closedVariables());
}
return result.release();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes