From 385f89ce09a5c9aed6ed0a3c865ae7a27351980d Mon Sep 17 00:00:00 2001 From: mwilliams Date: Sat, 4 Oct 2014 15:25:46 -0700 Subject: [PATCH] Don't keep copying the sourceLocTable Summary: There doesn't seem to be any point Reviewed By: @jdelong Differential Revision: D1596565 --- hphp/runtime/vm/unit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hphp/runtime/vm/unit.cpp b/hphp/runtime/vm/unit.cpp index ee6ccbee711..3416a39dfed 100644 --- a/hphp/runtime/vm/unit.cpp +++ b/hphp/runtime/vm/unit.cpp @@ -226,10 +226,10 @@ static SourceLocTable loadSourceLocTable(const Unit* unit) { } /* - * Return a copy of the Unit's SourceLocTable, extracting it from the repo if + * Return the Unit's SourceLocTable, extracting it from the repo if * necessary. */ -SourceLocTable getSourceLocTable(const Unit* unit) { +const SourceLocTable& getSourceLocTable(const Unit* unit) { { ExtendedLineInfoCache::const_accessor acc; if (s_extendedLineInfo.find(acc, unit)) { @@ -259,7 +259,7 @@ static LineToOffsetRangeVecMap getLineToOffsetRangeVecMap(const Unit* unit) { } } - auto const srcLoc = getSourceLocTable(unit); + auto const& srcLoc = getSourceLocTable(unit); LineToOffsetRangeVecMap map; Offset baseOff = 0; @@ -318,7 +318,7 @@ bool getSourceLoc(const SourceLocTable& table, Offset pc, SourceLoc& sLoc) { } bool Unit::getSourceLoc(Offset pc, SourceLoc& sLoc) const { - auto sourceLocTable = getSourceLocTable(this); + auto const& sourceLocTable = getSourceLocTable(this); return HPHP::getSourceLoc(sourceLocTable, pc, sLoc); } -- 2.11.4.GIT