Test only once for stack overflow at function prolog

  Now instead of checking if an overflow will happen, will check if
an overflow can happen, as the code that would cause an overflow may
not be executed.