[pulse][1/4] use same hack everywhere to detect is_restricted
[pulse][1/4] use same hack everywhere to detect is_restricted

Summary:
No reason to pay O(n) when O(log n) suffices thanks to the hack
described just a few lines below.

Reviewed By: skcho

Differential Revision: D39310643

fbshipit-source-id: 83bd85967f5e22c5d295a9fa3ebe60d2d9e36efe

facebook/infer,facebook/infer,facebook/infer,facebook/infer,facebook/infer,facebook/infer,facebook/infer