forked from mirrors/gecko-dev
		
	Bug 1301496 - Simplify runtime check when tracing helper threads r=terrence a=decoder
This commit is contained in:
		
							parent
							
								
									65d765221c
								
							
						
					
					
						commit
						1295093170
					
				
					 7 changed files with 22 additions and 3 deletions
				
			
		
							
								
								
									
										7
									
								
								js/src/jit-test/tests/gc/bug-1301496.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								js/src/jit-test/tests/gc/bug-1301496.js
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | if (helperThreadCount() == 0) | ||||||
|  |     quit(); | ||||||
|  | startgc(1, 'shrinking'); | ||||||
|  | offThreadCompileScript(""); | ||||||
|  | // Adapted from randomly chosen test: js/src/jit-test/tests/parser/bug-1263355-13.js
 | ||||||
|  | gczeal(9); | ||||||
|  | newGlobal(); | ||||||
|  | @ -188,6 +188,12 @@ CompileRuntime::setMinorGCShouldCancelIonCompilations() | ||||||
|     runtime()->gc.storeBuffer.setShouldCancelIonCompilations(); |     runtime()->gc.storeBuffer.setShouldCancelIonCompilations(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool | ||||||
|  | CompileRuntime::runtimeMatches(JSRuntime* rt) | ||||||
|  | { | ||||||
|  |     return rt == runtime(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| Zone* | Zone* | ||||||
| CompileZone::zone() | CompileZone::zone() | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -86,6 +86,8 @@ class CompileRuntime | ||||||
| 
 | 
 | ||||||
|     const Nursery& gcNursery(); |     const Nursery& gcNursery(); | ||||||
|     void setMinorGCShouldCancelIonCompilations(); |     void setMinorGCShouldCancelIonCompilations(); | ||||||
|  | 
 | ||||||
|  |     bool runtimeMatches(JSRuntime* rt); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class CompileZone | class CompileZone | ||||||
|  |  | ||||||
|  | @ -14622,7 +14622,7 @@ IonBuilder::convertToBoolean(MDefinition* input) | ||||||
| void | void | ||||||
| IonBuilder::trace(JSTracer* trc) | IonBuilder::trace(JSTracer* trc) | ||||||
| { | { | ||||||
|     if (script_->zoneFromAnyThread()->runtimeFromAnyThread() != trc->runtime()) |     if (!compartment->runtime()->runtimeMatches(trc->runtime())) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     TraceManuallyBarrieredEdge(trc, &script_, "IonBuiler::script_"); |     TraceManuallyBarrieredEdge(trc, &script_, "IonBuiler::script_"); | ||||||
|  |  | ||||||
|  | @ -162,6 +162,10 @@ class ExclusiveContext : public ContextFriendFields, | ||||||
|         return options_; |         return options_; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     bool runtimeMatches(JSRuntime* rt) const { | ||||||
|  |         return runtime_ == rt; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|   protected: |   protected: | ||||||
|     js::gc::ArenaLists* arenas_; |     js::gc::ArenaLists* arenas_; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -345,7 +345,7 @@ ParseTask::~ParseTask() | ||||||
| void | void | ||||||
| ParseTask::trace(JSTracer* trc) | ParseTask::trace(JSTracer* trc) | ||||||
| { | { | ||||||
|     if (exclusiveContextGlobal->zoneFromAnyThread()->runtimeFromAnyThread() != trc->runtime()) |     if (!cx->runtimeMatches(trc->runtime())) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     TraceManuallyBarrieredEdge(trc, &exclusiveContextGlobal, "ParseTask::exclusiveContextGlobal"); |     TraceManuallyBarrieredEdge(trc, &exclusiveContextGlobal, "ParseTask::exclusiveContextGlobal"); | ||||||
|  |  | ||||||
|  | @ -568,7 +568,7 @@ struct ParseTask | ||||||
|     bool finish(JSContext* cx); |     bool finish(JSContext* cx); | ||||||
| 
 | 
 | ||||||
|     bool runtimeMatches(JSRuntime* rt) { |     bool runtimeMatches(JSRuntime* rt) { | ||||||
|         return exclusiveContextGlobal->runtimeFromAnyThread() == rt; |         return cx->runtimeMatches(rt); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     virtual ~ParseTask(); |     virtual ~ParseTask(); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Jon Coppeard
						Jon Coppeard