Restructure CheckProgramUnrolledSize to support cycle detection.

The previous version of the code would actually end up skipping over
recursive code silently. (In fact, CheckProgramUnrolledSize is always
called immediately after Analysis::DetectStaticRecursion regardless of
whether or not any cycles were found, and the "cycle detected" assert
was not firing.) The code now actually detects cycles correctly; this
can be verified by uncommenting the call to error().

In a followup CL, I will improve the error reporting so that the cycle
is tracked and can be reported. Right now, we can detect a cycle but
don't keep a copy of the stack.

Change-Id: I9eb7b6333522d334657af4aa8d09fd6ad371ad69
Bug: skia:12396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445112
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
1 file changed