[coverage] Add a static cache

Speeds up Roboto by around 5%; costs 2kb globally.
diff --git a/src/OT/Layout/Common/CoverageFormat1.hh b/src/OT/Layout/Common/CoverageFormat1.hh
index 5d68e3d..e8a082d 100644
--- a/src/OT/Layout/Common/CoverageFormat1.hh
+++ b/src/OT/Layout/Common/CoverageFormat1.hh
@@ -30,6 +30,8 @@
 #ifndef OT_LAYOUT_COMMON_COVERAGEFORMAT1_HH
 #define OT_LAYOUT_COMMON_COVERAGEFORMAT1_HH
 
+#include "../../../hb-cache.hh"
+
 namespace OT {
 namespace Layout {
 namespace Common {
@@ -57,8 +59,18 @@
 
   unsigned int get_coverage (hb_codepoint_t glyph_id) const
   {
+    static hb_cache_t<16, 8, 9, true> cache;
+
+    unsigned v;
+    if (cache.get ((glyph_id + (uintptr_t) this) & 0xFFFF, &v))
+    {
+      if (glyphArray[v] == glyph_id)
+        return v;
+    }
+
     unsigned int i;
     glyphArray.bfind (glyph_id, &i, HB_NOT_FOUND_STORE, NOT_COVERED);
+    cache.set ((glyph_id + (uintptr_t) this) & 0xFFFF, i);
     return i;
   }
 
diff --git a/src/OT/Layout/Common/CoverageFormat2.hh b/src/OT/Layout/Common/CoverageFormat2.hh
index d7fcc35..64af599 100644
--- a/src/OT/Layout/Common/CoverageFormat2.hh
+++ b/src/OT/Layout/Common/CoverageFormat2.hh
@@ -31,6 +31,8 @@
 
 #include "RangeRecord.hh"
 
+#include "../../../hb-cache.hh"
+
 namespace OT {
 namespace Layout {
 namespace Common {
@@ -59,7 +61,18 @@
 
   unsigned int get_coverage (hb_codepoint_t glyph_id) const
   {
+    static hb_cache_t<16, 8, 9, true> cache;
+
+    unsigned v;
+    if (cache.get ((glyph_id + (uintptr_t) this) & 0xFFFF, &v))
+    {
+      const RangeRecord<Types> &range = rangeRecord[v];
+      if (range.first <= glyph_id && glyph_id <= range.last)
+        return (unsigned int) range.value + (glyph_id - range.first);
+    }
+
     const RangeRecord<Types> &range = rangeRecord.bsearch (glyph_id);
+    cache.set ((glyph_id + (uintptr_t) this) & 0xFFFF, &range - &rangeRecord[0]);
     return likely (range.first <= range.last)
          ? (unsigned int) range.value + (glyph_id - range.first)
          : NOT_COVERED;