Implement GLB algorithm. (Issue #2263)

r=brson