Adding back-off instead of busy-spinning

Also changed the total number of spinning similar to Cilk
Addressed code review comments.
auto merge of #3820 : cgaebel/servo/rebase-lalehs-patch, r=pcwalton

I addressed all but one of the code review comments, which was a request
for documentation on where a number came from (which I'm not qualified to
answer), and rebased this on to latest master.

xref: #3505 cc: @LalehB @larsbergstrom

r? @pcwalton
Fix a script -> layout race

When content changed, script used to immediately dirty the changed
nodes regardless of what layout was doing at the same time. The
correct thing to do in that situation is to queue the nodes, then
dirty them after layout is finished and re-run layout.

This patch makes that change.

There's also some extra debugging goodness in this patch that I found
useful when tracking down the bug.

r? @jdm @pcwalton