Commit dc5c7416 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[Runtime] Refactored Lookup/Construct to take function by ref

We don't need to copy the std::function because we don't modify it's
state.

Bug: v8:8015
Change-Id: I5320f78683fb7c1cca44b73e54312b3cc07b28cd
Reviewed-on: https://chromium-review.googlesource.com/1209782Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55708}
parent 10afbb7e
......@@ -38,7 +38,7 @@ uint32_t GetArgcForReplaceCallable(uint32_t num_captures,
// Looks up the capture of the given name. Returns the (1-based) numbered
// capture index or -1 on failure.
int LookupNamedCapture(std::function<bool(String*)> name_matches,
int LookupNamedCapture(const std::function<bool(String*)>& name_matches,
FixedArray* capture_name_map) {
// TODO(jgruber): Sort capture_name_map and do binary search via
// internalized strings.
......@@ -1097,7 +1097,7 @@ class VectorBackedMatch : public String::Match {
// RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo).
Handle<JSObject> ConstructNamedCaptureGroupsObject(
Isolate* isolate, Handle<FixedArray> capture_map,
std::function<Object*(int)> f_get_capture) {
const std::function<Object*(int)>& f_get_capture) {
Handle<JSObject> groups = isolate->factory()->NewJSObjectWithNullProto();
const int capture_count = capture_map->length() >> 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