Modify NaCl bitstream reader to allow parallel parses.

Fixes class NaClBitstreamReader to allow parallel parses. In
particular, it makes the global abbreviations a shared object, so that
it can be shared by other bitstream readers.

To make the overhead small, the lookup map of the global abbreviations
is initialized up front with all known block ids, rather than
incrementally updating. This reduces the locking considerably in that
the block lookup no longer needs a lock.

Finally, it adds a constructor to class NaClBitstreamReader that
allows one to construct a new (parallel) bitstream reader from an
existing bistream reader.

This code assumes that parallel parsing is done with 1 driver parse
thread, and n helper parse threads to parse function blocks. The
driver thread is responsible for parsing the memory object, and
spawning off parallel parses for each function block. To guarantee
correctness (since memory objects may be dynamically filled), the
driver parser should build a buffer and copy the corresponding bytes
of the function block into that buffer, before spawning off the
parallel parser to parse it.

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4363
R=jpp@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/1838203002 .
2 files changed