Ignore:
Timestamp:
Jun 30, 2014, 11:48:56 AM (11 years ago)
Author:
[email protected]
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Nodes.cpp

    r163960 r170594  
    134134
    135135
    136 void ProgramNode::setClosedVariables(const Vector<RefPtr<StringImpl>>&& closedVariables)
     136void ProgramNode::setClosedVariables(Vector<RefPtr<StringImpl>>&& closedVariables)
    137137{
    138138    m_closedVariables = std::move(closedVariables);
Note: See TracChangeset for help on using the changeset viewer.