Avoid mangled name comparisons of 3-parameter functions

The hash values used for looking up built-ins now encode whether the
mangled name contains arrays, structs or interface blocks in its
parameters list. This is written in the most significant bit of the
hash value.

We check this bit at the start of built-in lookup and if the bit is
set we exit early. After that we know that the lookup name doesn't
contain array, struct or interface block parameters.

When we find a hash that matches a hash of a built-in function, we now
know 3 things:
1) the length of the mangled name matches
2) the open parentheses in the mangled name matches
3) the lookup doesn't contain array, struct or block parameters.

Additionally, we have an if statement checking whether the function
name matches. Collisions are only possible with functions that
1) have the same name
2) have the same number of parameters

With these preconditions we can check beforehand whether collisions
are possible for 3-parameter functions. If there are no collisions, we
don't need to compare the full mangled name. This is similar to what
was already being done with functions that had 0 to 2 parameters.

This reduces shader_translator binary size by around 4 KB on Windows.

Besides increased complexity, the tradeoff is that an exhaustive
search of hash values for possible 3-parameter combinations is costly,
so the gen_builtin_functions.py code generation script now takes
around one minute to run on a high-end workstation. Due to this, the
script now exits early if it detects it has already been run with the
same inputs based on a hash value stored in
builtin_symbols_hash_autogen.txt.

BUG=angleproject:2267
BUG=chromium:823856
TEST=angle_unittests

Change-Id: I3ff8c6eb85b90d3c4971ac8d73ee171a07a7e55f
Reviewed-on: https://chromium-review.googlesource.com/973372
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/scripts/run_code_generation.py b/scripts/run_code_generation.py
index 910df18..bd073f3 100755
--- a/scripts/run_code_generation.py
+++ b/scripts/run_code_generation.py
@@ -163,6 +163,7 @@
         ],
         'outputs': [
             'src/compiler/translator/tree_util/BuiltIn_autogen.h',
+            'src/compiler/translator/builtin_symbols_hash_autogen.txt',
             'src/compiler/translator/ParseContext_autogen.h',
             'src/compiler/translator/SymbolTable_autogen.cpp',
             'src/compiler/translator/SymbolTable_autogen.h',