Optimize Program::resolveLink

The method has to be extremely fast as it's very frequently called. It
contributes about 2% cpu time in the DrawCall/gl_null benchmark. With
this optimization it can be decreased to less than 1%.

Bug: chromium:873724

Change-Id: I7fb376db73452dbdf6cb44c92815848e860867c9
Reviewed-on: https://chromium-review.googlesource.com/1179369
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 86c2dfa..168b994 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -890,6 +890,7 @@
     : mProgram(factory->createProgram(mState)),
       mValidated(false),
       mLinked(false),
+      mLinkResolved(true),
       mDeleteStatus(false),
       mRefCount(0),
       mResourceManager(manager),
@@ -1254,6 +1255,7 @@
     mLinkingState->programHash = programHash;
     mLinkingState->linkEvent   = mProgram->link(context, *resources, mInfoLog);
     mLinkingState->resources   = std::move(resources);
+    mLinkResolved              = false;
 
     return NoError();
 }
@@ -1269,19 +1271,12 @@
     return mLinked;
 }
 
-void Program::resolveLink() const
-{
-    if (mLinkingState.get())
-    {
-        return const_cast<Program *>(this)->resolveLinkImpl();
-    }
-}
-
 void Program::resolveLinkImpl()
 {
     ASSERT(mLinkingState.get());
 
     mLinked           = mLinkingState->linkEvent->wait();
+    mLinkResolved     = true;
     auto linkingState = std::move(mLinkingState);
     if (!mLinked)
     {