runtime: allow GC drain whenever write barrier is enabled
runtime: allow GC drain whenever write barrier is enabled

Currently we hand-code a set of phases when draining is allowed.
However, this set of phases is conservative. The critical invariant is
simply that the write barrier must be enabled if we're draining.

Shortly we're going to enable mutator assists during the scan phase,
which means we may drain during the scan phase. In preparation, this
commit generalizes these assertions to check the fundamental condition
that the write barrier is enabled, rather than checking that we're in
any particular phase.

Change-Id: I0e1bec1ca823d4a697a0831ec4c50f5dd3f2a893
Reviewed-on: https://go-review.googlesource.com/12673
Reviewed-by: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>

jonasi/go,zcwfeng/go,donnel6809/go,rachtsingh/gogojuice,zhangg/go,xiaobodu/go,wangfakang/go-1,arschles/golang-go,jonahglover/go,zouchao2010/go,g522342435/go,danycoro/go,codestation/go,alash3al/go,Endika/go,Young55555/go,gdey/go,dterei/go,Charlesdong/go-1,slavau/go,honsiorovskyi/go,mikekap/go,wangfakang/go-1,Badredapple/go,JioCloud/go,qskycolor/go,sinuos/go,constantine001/go,XuYunnan/go,malvira/go,CodyGuo/go,jacobxk/go,WIZARD-CXY/go,andrewchambers/go,jmptrader/go,Endika/go,arschles/go-1,CiscoCloud/go,andrewchambers/go,jmptrader/go,slavau/go,alash3al/go,danielsoro/go,baiyunping333/go,beealone/go,ImJasonH/go,josharian/go,theass/go,samanalysis/go,honsiorovskyi/go,josharian/go,yuhengye/go,stormltf/go,springning/go,andrewchambers/go,alex-zhang/go,xiuzhifu/go,mikekap/go,alex-zhang/go,mwhudson/go,ImJasonH/go,kim-racktop/go,jonasi/go,samanalysis/go,kakuhiroshi/go,suncycheng/go,likesea/go,likesea/go,suncycheng/go,danielsoro/go,cloudflare/go,constantine001/go,yuhengye/go,deft-code/go,XuYunnan/go,vsdutka/go,ObjectiveJoe/go,jdhenke/go,yangzhongj/go,greyhwndz/go,fjballest/golang,jacobxk/go,yasarkunduz/go,cloudrain21/go,cloudrain21/go,fjballest/golang,nawawi/go,4ad/go,yasarkunduz/go,vishsingh/go,josharian/go,theif519/go,JioCloud/go,zouchao2010/go,josharian/go,shines77/go,golang/go,jameskumar/go,derekmarcotte/go,ganboing/go-esx,xinhuang327/go,mgyenik/go,samanalysis/go,nakedgc/go,christopher-henderson/Go,albertjin/golang-go,binarycrusader/go,CarterTsai/go,deft-code/go,ifagnosticism/go,binarycrusader/go,Young55555/go,CodyGuo/go,danielsoro/go,mbrukman/go,sndnvaps/go,skatsuta/go,NichoZhang/go,gohin/go,jonahglover/go,ObjectiveJoe/go,vanloswang/go,kakuhiroshi/go,mgyenik/go,Charlesdong/go-1,danielsoro/go,jonathanmarvens/go,monetate/go,gdey/go,beealone/go,honsiorovskyi/go,polyverse-security/go,AALEKH/go,NichoZhang/go,mikekap/go,CAFxX/go,lihuanghai/go,NunoEdgarGub1/go,zouchao2010/go,CarterTsai/go,theass/go,skotti/go,yuhengye/go,constantine001/go,rentongzhang/go,shazow/go,vsekhar/elastic-go,constantine001/go,yasarkunduz/go,baiyunping333/go,vanloswang/go,WIZARD-CXY/go,joshsammut/go,gdey/go,greyhwndz/go,snowsnail/go,akutz/go,ObjectiveJoe/go,CAFxX/go,polyverse-security/go,XuYunnan/go,mdp/go,devpadawan/go,alash3al/go,binarycrusader/go,kim-racktop/go,snowsnail/go,sosop/go,cloudflare/go,Endika/go,dafyddcrosby/go,goodlang/good,arschles/golang-go,greyhwndz/go,momchil-velikov/go,constantine001/go,rentongzhang/go,dafyddcrosby/go,dafyddcrosby/go,joshsammut/go,likesea/go,roth1002/go,NunoEdgarGub1/go,arschles/go-1,odeke-em/go,odeke-em/go,beealone/go,sndnvaps/go,ericsnowcurrently/go,monetate/go,cookerzhu/go,yuhengye/go,cyberroadie/go,famorted/go,danielsoro/go,jacobxk/go,joshsammut/go,xujianhai/go,g522342435/go,ericsnowcurrently/go,GeorgiCodes/go,jacobsa/go,jonathanmarvens/go,rachtsingh/gogojuice,nawawi/go,yangzhongj/go,dterei/go,zhangg/go,jefby/go,theif519/go,roth1002/go,jameskumar/go,wangfakang/go-1,AALEKH/go,danycoro/go,linux-on-ibm-z/go,xiuzhifu/go,gdey/go,josharian/go,josharian/go,myPublicGit/go,yasarkunduz/go,CarterTsai/go,CarterTsai/go,nawawi/go,Young55555/go,vishsingh/go,ErikDubbelboer/go,constantine001/go,mbrukman/go,alash3al/go,codestation/go,yuhengye/go,JioCloud/go,skotti/go,youprofit/go,malvira/go,Samurais/go,mbrukman/go,Jordanzuo/go,GeorgiCodes/go,jonasi/go,jdhenke/go,dpatel06/go,albertjin/golang-go,fjballest/golang,xujianhai/go,myPublicGit/go,CiscoCloud/go,jacobhaven/go,momchil-velikov/go,cainiaocome/go,zhangg/go,dpatel06/go,slavau/go,polyverse-security/go,Cofyc/go,cainiaocome/go,jameskumar/go,skotti/go,jonathanmarvens/go,goodlang/good,honsiorovskyi/go,dterei/go,samanalysis/go,jacobsa/go,miolini/go,stormltf/go,xiaobodu/go,jacobsa/go,undergrowthlinear/go,ericsnowcurrently/go,xiaobodu/go,jacobsa/go,sndnvaps/go,jonahglover/go,nakedgc/go,Pulgafree/go,CodyGuo/go,jmptrader/go,vsdutka/go,akutz/go,willjunspecial/go,jonathanmarvens/go,jacobhaven/go,dpatel06/go,samanalysis/go,deft-code/go,linux-on-ibm-z/go,golang/go,lihuanghai/go,springning/go,polyverse-security/go,chinanjjohn2012/go,ErikDubbelboer/go,theass/go,miolini/go,XuYunnan/go,NunoEdgarGub1/go,derekmarcotte/go,dafyddcrosby/go,AALEKH/go,rachtsingh/gogojuice,uileyar/go,donnel6809/go,devpadawan/go,ganboing/go-esx,Samurais/go,wangfakang/go-1,NunoEdgarGub1/go,stormltf/go,Badredapple/go,alex-zhang/go,cainiaocome/go,vsdutka/go,zhangg/go,xiaobodu/go,ganboing/go-esx,goodlang/good,Cofyc/go,albertjin/golang-go,parkdy/go,Pulgafree/go,suncycheng/go,jonahglover/go,dpatel06/go,kevinc0825/go,CiscoCloud/go,jdeng/go,xinhuang327/go,codestation/go,malvira/go,yangzhongj/go,sinuos/go,vsekhar/elastic-go,Charlesdong/go-1,JioCloud/go,cyberroadie/go,GeorgiCodes/go,arschles/golang-go,kakuhiroshi/go,xujianhai/go,danielsoro/go,dterei/go,cloudrain21/go,jasonxiong/go,youprofit/go,undergrowthlinear/go,nawawi/go,arschles/golang-go,lihuanghai/go,mdp/go,rentongzhang/go,wangfakang/go-1,ObjectiveJoe/go,nakedgc/go,arschles/golang-go,honsiorovskyi/go,kevinc0825/go,alex-zhang/go,joshsammut/go,springning/go,danycoro/go,nawawi/go,g522342435/go,akutz/go,jacobhaven/go,mgyenik/go,Badredapple/go,sinuos/go,ichu501/go,polyverse-security/go,cloudrain21/go,malvira/go,sinuos/go,slavau/go,springning/go,willjunspecial/go,yangzhongj/go,JioCloud/go,gohin/go,fjballest/golang,sosop/go,mwhudson/go,yasarkunduz/go,linux-on-ibm-z/go,samanalysis/go,zouchao2010/go,myPublicGit/go,fjballest/golang,famorted/go,Badredapple/go,mwhudson/go,joshsammut/go,yangzhongj/go,stormltf/go,jacobsa/go,jefby/go,kevinc0825/go,malvira/go,parkdy/go,CiscoCloud/go,mikekap/go,jonahglover/go,vishsingh/go,yasarkunduz/go,jdhenke/go,momchil-velikov/go,deft-code/go,4ad/go,nakedgc/go,sndnvaps/go,arschles/go-1,famorted/go,jonathanmarvens/go,shines77/go,miolini/go,likesea/go,mdp/go,deft-code/go,mwhudson/go,xiuzhifu/go,malvira/go,akutz/go,NichoZhang/go,likesea/go,shines77/go,linux-on-ibm-z/go,baiyunping333/go,chinanjjohn2012/go,jefby/go,rachtsingh/gogojuice,WIZARD-CXY/go,goodlang/good,codestation/go,skatsuta/go,vanloswang/go,nakedgc/go,CiscoCloud/go,jonathanmarvens/go,stormltf/go,mikekap/go,ErikDubbelboer/go,kakuhiroshi/go,derekmarcotte/go,shines77/go,ImJasonH/go,deft-code/go,snowsnail/go,ObjectiveJoe/go,albertjin/golang-go,jameskumar/go,slavau/go,honsiorovskyi/go,qskycolor/go,cookerzhu/go,xiuzhifu/go,undergrowthlinear/go,jasonxiong/go,GeorgiCodes/go,cookerzhu/go,Endika/go,snowsnail/go,ganboing/go-esx,willjunspecial/go,Samurais/go,chinanjjohn2012/go,greyhwndz/go,baiyunping333/go,Endika/go,jameskumar/go,AALEKH/go,jacobhaven/go,cloudflare/go,undergrowthlinear/go,snowsnail/go,CodyGuo/go,danycoro/go,youprofit/go,undergrowthlinear/go,NichoZhang/go,ichu501/go,sinuos/go,shazow/go,rentongzhang/go,vanloswang/go,nakedgc/go,cyberroadie/go,kevinc0825/go,parkdy/go,4ad/go,myPublicGit/go,b54898533/go,youprofit/go,b54898533/go,codestation/go,cainiaocome/go,Young55555/go,golang/go,yasarkunduz/go,Badredapple/go,samanalysis/go,mbrukman/go,vsdutka/go,mwhudson/go,chinanjjohn2012/go,4ad/go,gdey/go,fjballest/golang,parkdy/go,yangzhongj/go,golang/go,vsekhar/elastic-go,cyberroadie/go,skatsuta/go,jameskumar/go,leeric92/go,Cofyc/go,cloudrain21/go,shazow/go,leeric92/go,mdp/go,NichoZhang/go,leeric92/go,zouchao2010/go,shines77/go,suncycheng/go,momchil-velikov/go,jacobhaven/go,willjunspecial/go,devpadawan/go,qskycolor/go,NichoZhang/go,devpadawan/go,skatsuta/go,nawawi/go,malvira/go,Charlesdong/go-1,mdp/go,CiscoCloud/go,arschles/go-1,beealone/go,zcwfeng/go,theif519/go,sosop/go,zhangg/go,alash3al/go,famorted/go,cyberroadie/go,qskycolor/go,zhangg/go,suncycheng/go,jasonxiong/go,sosop/go,jdeng/go,stormltf/go,xinhuang327/go,theif519/go,mbrukman/go,WIZARD-CXY/go,greyhwndz/go,jdeng/go,akutz/go,jacobhaven/go,xiuzhifu/go,vsdutka/go,sosop/go,theass/go,theif519/go,goodlang/good,constantine001/go,vanloswang/go,xujianhai/go,vsekhar/elastic-go,yuhengye/go,qskycolor/go,XuYunnan/go,Samurais/go,stormltf/go,myPublicGit/go,g522342435/go,skatsuta/go,ErikDubbelboer/go,cookerzhu/go,rentongzhang/go,4ad/go,stormltf/go,snowsnail/go,roth1002/go,miolini/go,leeric92/go,cainiaocome/go,CAFxX/go,gdey/go,vanloswang/go,Endika/go,skotti/go,JioCloud/go,dterei/go,theass/go,dterei/go,mbrukman/go,gohin/go,Stan-Lin-/go,baiyunping333/go,josharian/go,springning/go,xinhuang327/go,g522342435/go,josharian/go,joshsammut/go,willjunspecial/go,ganboing/go-esx,linux-on-ibm-z/go,xiaobodu/go,kevinc0825/go,sosop/go,gohin/go,cookerzhu/go,goodlang/good,jefby/go,cloudflare/go,theass/go,ericsnowcurrently/go,derekmarcotte/go,GeorgiCodes/go,XuYunnan/go,dpatel06/go,snowsnail/go,dpatel06/go,binarycrusader/go,WIZARD-CXY/go,ImJasonH/go,rachtsingh/gogojuice,skatsuta/go,cookerzhu/go,Stan-Lin-/go,jacobsa/go,dafyddcrosby/go,gohin/go,jonathanmarvens/go,cloudflare/go,qskycolor/go,mgyenik/go,CAFxX/go,fjballest/golang,momchil-velikov/go,uileyar/go,ganboing/go-esx,youprofit/go,jdeng/go,zcwfeng/go,slavau/go,ifagnosticism/go,gohin/go,greyhwndz/go,xujianhai/go,yuhengye/go,danycoro/go,skotti/go,chinanjjohn2012/go,WIZARD-CXY/go,jonahglover/go,sosop/go,greyhwndz/go,springning/go,ErikDubbelboer/go,jacobhaven/go,baiyunping333/go,zcwfeng/go,skotti/go,ifagnosticism/go,XuYunnan/go,skotti/go,zhangg/go,CodyGuo/go,nawawi/go,yasarkunduz/go,AALEKH/go,cookerzhu/go,uileyar/go,danielsoro/go,codestation/go,dterei/go,alex-zhang/go,lihuanghai/go,donnel6809/go,donnel6809/go,cainiaocome/go,ifagnosticism/go,lihuanghai/go,GeorgiCodes/go,b54898533/go,kevinc0825/go,famorted/go,Stan-Lin-/go,slavau/go,CAFxX/go,ichu501/go,jmptrader/go,xinhuang327/go,dterei/go,rachtsingh/gogojuice,linux-on-ibm-z/go,myPublicGit/go,undergrowthlinear/go,miolini/go,samanalysis/go,JioCloud/go,xujianhai/go,linux-on-ibm-z/go,monetate/go,ImJasonH/go,uileyar/go,mikekap/go,derekmarcotte/go,gdey/go,ImJasonH/go,zcwfeng/go,Samurais/go,CarterTsai/go,shazow/go,mgyenik/go,jdhenke/go,rachtsingh/gogojuice,wangfakang/go-1,NunoEdgarGub1/go,andrewchambers/go,Cofyc/go,myPublicGit/go,cloudrain21/go,ObjectiveJoe/go,Pulgafree/go,AALEKH/go,momchil-velikov/go,leeric92/go,odeke-em/go,lihuanghai/go,jmptrader/go,danycoro/go,GeorgiCodes/go,xiuzhifu/go,sndnvaps/go,chinanjjohn2012/go,binarycrusader/go,leeric92/go,Charlesdong/go-1,skatsuta/go,Stan-Lin-/go,rentongzhang/go,alex-zhang/go,willjunspecial/go,jacobxk/go,skotti/go,leeric92/go,ericsnowcurrently/go,vishsingh/go,jonahglover/go,miolini/go,CarterTsai/go,suncycheng/go,Samurais/go,famorted/go,CarterTsai/go,NunoEdgarGub1/go,jonasi/go,ichu501/go,Charlesdong/go-1,golang/go,arschles/go-1,xiaobodu/go,rachtsingh/gogojuice,monetate/go,ericsnowcurrently/go,NunoEdgarGub1/go,albertjin/golang-go,monetate/go,jonahglover/go,undergrowthlinear/go,famorted/go,ErikDubbelboer/go,ichu501/go,xinhuang327/go,Samurais/go,jasonxiong/go,jasonxiong/go,willjunspecial/go,roth1002/go,akutz/go,jefby/go,uileyar/go,jdeng/go,b54898533/go,fjballest/golang,springning/go,jonasi/go,binarycrusader/go,Stan-Lin-/go,ericsnowcurrently/go,NichoZhang/go,vsekhar/elastic-go,honsiorovskyi/go,mbrukman/go,mgyenik/go,mwhudson/go,sndnvaps/go,nawawi/go,parkdy/go,arschles/golang-go,roth1002/go,skatsuta/go,Pulgafree/go,arschles/go-1,ifagnosticism/go,zouchao2010/go,greyhwndz/go,andrewchambers/go,Young55555/go,Young55555/go,CarterTsai/go,roth1002/go,jmptrader/go,myPublicGit/go,likesea/go,ganboing/go-esx,CAFxX/go,theif519/go,polyverse-security/go,danielsoro/go,yuhengye/go,Jordanzuo/go,xiaobodu/go,b54898533/go,ifagnosticism/go,rentongzhang/go,youprofit/go,codestation/go,jacobxk/go,Jordanzuo/go,jonathanmarvens/go,sndnvaps/go,dafyddcrosby/go,vanloswang/go,jmptrader/go,goodlang/good,Pulgafree/go,vishsingh/go,jonasi/go,jdeng/go,uileyar/go,ifagnosticism/go,kim-racktop/go,miolini/go,XuYunnan/go,Pulgafree/go,snowsnail/go,cookerzhu/go,Jordanzuo/go,WIZARD-CXY/go,Cofyc/go,beealone/go,CAFxX/go,NunoEdgarGub1/go,beealone/go,jdhenke/go,constantine001/go,vishsingh/go,arschles/golang-go,sosop/go,springning/go,NichoZhang/go,golang/go,Jordanzuo/go,kim-racktop/go,zhangg/go,albertjin/golang-go,odeke-em/go,willjunspecial/go,Young55555/go,cloudrain21/go,b54898533/go,mikekap/go,vsekhar/elastic-go,joshsammut/go,alash3al/go,theass/go,devpadawan/go,g522342435/go,derekmarcotte/go,mdp/go,xiuzhifu/go,jacobxk/go,jacobhaven/go,vsdutka/go,lihuanghai/go,deft-code/go,gohin/go,kakuhiroshi/go,yangzhongj/go,qskycolor/go,Samurais/go,4ad/go,jasonxiong/go,AALEKH/go,akutz/go,baiyunping333/go,cloudflare/go,wangfakang/go-1,g522342435/go,donnel6809/go,theif519/go,sinuos/go,shines77/go,devpadawan/go,jacobxk/go,golang/go,parkdy/go,Stan-Lin-/go,cyberroadie/go,sinuos/go,uileyar/go,jasonxiong/go,odeke-em/go,polyverse-security/go,momchil-velikov/go,monetate/go,xinhuang327/go,kakuhiroshi/go,gohin/go,vishsingh/go,youprofit/go,wangfakang/go-1,g522342435/go,arschles/go-1,donnel6809/go,alex-zhang/go,derekmarcotte/go,jefby/go,odeke-em/go,vsekhar/elastic-go,linux-on-ibm-z/go,Jordanzuo/go,ImJasonH/go,Stan-Lin-/go,jdeng/go,jameskumar/go,Pulgafree/go,AALEKH/go,CodyGuo/go,WIZARD-CXY/go,zcwfeng/go,vsdutka/go,likesea/go,shazow/go,cloudflare/go,derekmarcotte/go,binarycrusader/go,yangzhongj/go,akutz/go,shazow/go,ganboing/go-esx,shazow/go,rentongzhang/go,parkdy/go,GeorgiCodes/go,alash3al/go,mdp/go,golang/go,jonasi/go,dpatel06/go,monetate/go,Charlesdong/go-1,xiaobodu/go,Jordanzuo/go,zouchao2010/go,undergrowthlinear/go,Jordanzuo/go,odeke-em/go,albertjin/golang-go,goodlang/good,4ad/go,dpatel06/go,mbrukman/go,roth1002/go,vsekhar/elastic-go,kim-racktop/go,andrewchambers/go,parkdy/go,donnel6809/go,andrewchambers/go,xinhuang327/go,sinuos/go,ErikDubbelboer/go,mwhudson/go,slavau/go,shines77/go,odeke-em/go,leeric92/go,xujianhai/go,joshsammut/go,mdp/go,cloudrain21/go,youprofit/go,beealone/go,arschles/go-1,Endika/go,alash3al/go,cyberroadie/go,kevinc0825/go,kakuhiroshi/go,Badredapple/go,uileyar/go,roth1002/go,sndnvaps/go,malvira/go,b54898533/go,CiscoCloud/go,miolini/go,shines77/go,jacobsa/go,monetate/go,codestation/go,famorted/go,shazow/go,jdhenke/go,theass/go,zcwfeng/go,ObjectiveJoe/go,lihuanghai/go,CiscoCloud/go,mwhudson/go,dafyddcrosby/go,Cofyc/go,jonasi/go,ErikDubbelboer/go,Charlesdong/go-1,Young55555/go,arschles/golang-go,gdey/go,cloudflare/go,jdhenke/go,alex-zhang/go,ifagnosticism/go,ImJasonH/go,cainiaocome/go,albertjin/golang-go,jdeng/go,beealone/go,andrewchambers/go,mgyenik/go,Badredapple/go,Cofyc/go,jefby/go,nakedgc/go,suncycheng/go,jacobxk/go,mikekap/go,chinanjjohn2012/go,jasonxiong/go,kevinc0825/go,Endika/go,Pulgafree/go,honsiorovskyi/go,jacobsa/go,danycoro/go,devpadawan/go,Cofyc/go,polyverse-security/go,kim-racktop/go,xiuzhifu/go,binarycrusader/go,jdhenke/go,cyberroadie/go,mgyenik/go,zcwfeng/go,4ad/go,jameskumar/go,CodyGuo/go,nakedgc/go,kakuhiroshi/go,likesea/go,vishsingh/go,qskycolor/go,xujianhai/go,ObjectiveJoe/go,Badredapple/go,kim-racktop/go,cainiaocome/go,devpadawan/go,jmptrader/go,momchil-velikov/go,CAFxX/go,dafyddcrosby/go,ericsnowcurrently/go,donnel6809/go,baiyunping333/go,jefby/go,ichu501/go,CodyGuo/go,zouchao2010/go,b54898533/go,JioCloud/go,danycoro/go,theif519/go,vanloswang/go,Stan-Lin-/go,kim-racktop/go,ichu501/go,vsdutka/go,suncycheng/go,deft-code/go,chinanjjohn2012/go,ichu501/go