Commit 6027ec03 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[builtins] Refactored methods to take the std::function by ref

In these cases the std::function state does not change, hence, it can be
a const ref. Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: I221b0c3e18c5c1f54d35d671445d2e947cf64c02
Reviewed-on: https://chromium-review.googlesource.com/1209822
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55712}
parent 8da9dbbb
......@@ -354,12 +354,10 @@ TF_BUILTIN(SubString, StringBuiltinsAssembler) {
Return(SubString(string, SmiUntag(from), SmiUntag(to)));
}
void StringBuiltinsAssembler::GenerateStringAt(char const* method_name,
TNode<Context> context,
Node* receiver,
TNode<Object> maybe_position,
TNode<Object> default_return,
StringAtAccessor accessor) {
void StringBuiltinsAssembler::GenerateStringAt(
char const* method_name, TNode<Context> context, Node* receiver,
TNode<Object> maybe_position, TNode<Object> default_return,
const StringAtAccessor& accessor) {
// Check that {receiver} is coercible to Object and convert it to a String.
TNode<String> string = ToThisString(context, receiver, method_name);
......@@ -817,7 +815,7 @@ TF_BUILTIN(StringPrototypeConcat, CodeStubAssembler) {
void StringBuiltinsAssembler::StringIndexOf(
Node* const subject_string, Node* const search_string, Node* const position,
std::function<void(Node*)> f_return) {
const std::function<void(Node*)>& f_return) {
CSA_ASSERT(this, IsString(subject_string));
CSA_ASSERT(this, IsString(search_string));
CSA_ASSERT(this, TaggedIsSmi(position));
......@@ -2303,10 +2301,10 @@ void StringTrimAssembler::ScanForNonWhiteSpaceOrLineTerminator(
BIND(&out);
}
void StringTrimAssembler::BuildLoop(Variable* const var_index, Node* const end,
int increment, Label* const if_none_found,
Label* const out,
std::function<Node*(Node*)> get_character) {
void StringTrimAssembler::BuildLoop(
Variable* const var_index, Node* const end, int increment,
Label* const if_none_found, Label* const out,
const std::function<Node*(Node*)>& get_character) {
Label loop(this, var_index);
Goto(&loop);
BIND(&loop);
......
......@@ -64,7 +64,7 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
void GenerateStringAt(const char* method_name, TNode<Context> context,
Node* receiver, TNode<Object> maybe_position,
TNode<Object> default_return,
StringAtAccessor accessor);
const StringAtAccessor& accessor);
TNode<Int32T> LoadSurrogatePairAt(SloppyTNode<String> string,
SloppyTNode<IntPtrT> length,
......@@ -72,7 +72,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
UnicodeEncoding encoding);
void StringIndexOf(Node* const subject_string, Node* const search_string,
Node* const position, std::function<void(Node*)> f_return);
Node* const position,
const std::function<void(Node*)>& f_return);
TNode<Smi> IndexOfDollarChar(Node* const context, Node* const string);
......@@ -145,7 +146,7 @@ class StringTrimAssembler : public StringBuiltinsAssembler {
void BuildLoop(Variable* const var_index, Node* const end, int increment,
Label* const if_none_found, Label* const out,
std::function<Node*(Node*)> get_character);
const std::function<Node*(Node*)>& get_character);
};
} // namespace internal
......
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