Add BCC support for rs_object_slots metadata.

This is added to support proper cleanup of RS resources. We were leaking some
global resources because there was no way to tell which slots to clear.

Change-Id: I3e01ff4f7105444b7610d514f10dd56cb1b359b8
b: 3381615
diff --git a/lib/bcc/Script.cpp b/lib/bcc/Script.cpp
index 74b4793..23e8f41 100644
--- a/lib/bcc/Script.cpp
+++ b/lib/bcc/Script.cpp
@@ -367,6 +367,17 @@
 }
 
 
+size_t Script::getObjectSlotCount() const {
+  switch (mStatus) {
+  case ScriptStatus::Compiled:  return mCompiled->getObjectSlotCount();
+#if USE_CACHE
+  case ScriptStatus::Cached:    return mCached->getObjectSlotCount();
+#endif
+  default:                      return 0;
+  }
+}
+
+
 void Script::getExportVarList(size_t varListSize, void **varList) {
   switch (mStatus) {
 #define DELEGATE(STATUS) \
@@ -434,7 +445,7 @@
   switch (mStatus) {
 #define DELEGATE(STATUS) \
   case ScriptStatus::STATUS: \
-    m##STATUS->getFuncInfoList(funcInfoListSize, funcInfoList);
+    m##STATUS->getFuncInfoList(funcInfoListSize, funcInfoList); \
     break;
 
 #if USE_CACHE
@@ -449,6 +460,28 @@
   }
 }
 
+
+void Script::getObjectSlotList(size_t objectSlotListSize,
+                               uint32_t *objectSlotList) {
+  switch (mStatus) {
+#define DELEGATE(STATUS) \
+  case ScriptStatus::STATUS: \
+    m##STATUS->getObjectSlotList(objectSlotListSize, objectSlotList); \
+    break;
+
+#if USE_CACHE
+  DELEGATE(Cached);
+#endif
+
+  DELEGATE(Compiled);
+#undef DELEGATE
+
+  default:
+    mErrorCode = BCC_INVALID_OPERATION;
+  }
+}
+
+
 char *Script::getContext() {
   switch (mStatus) {
 #if USE_CACHE