AST: Fix performance regression in lookupDirect()
Every call to lookupDirect() was calling prepareLookupTable() followed
by addLoadedExtensions(). While prepareLookupTable() only did its work
once, addLoadedExtensions() would walk all currently-loaded members of
all extensions every time.
However, just merging it with prepareLookupTable() was not enough,
because other places call prepareLookupTable(), which ends up loading
extensions too early after this change.
Instead, separate out the lazy allocation of the lookup table from
initialization. getLookupTable() returns a potentially-uninitialized
lookup table, and prepareLookupTable() now does what it did before
as well as what was formerly in addLoadedExtensions().
With this new split, getLookupTable() can be used instead of
prepareLookupTable() to avoid request cycles in a couple of places.