Bug 1041079 - IonMonkey: guard against there being no TLS PerThreadData when flushing the icache. r=luke
authorDouglas Crosher <dtc-moz@scieneer.com>
Tue, 12 Aug 2014 11:17:49 +1000
changeset 223526 66a14139b597ba9b92c286803b400b3812050cf9
parent 223525 a99f3b29c4a85c03e782951dc43f0ab05a17edc2
child 223527 a7e4ef74441d2531e3be0003a655f364ccc92737
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1041079
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1041079 - IonMonkey: guard against there being no TLS PerThreadData when flushing the icache. r=luke
js/src/jit/Ion.cpp
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2976,21 +2976,26 @@ AutoFlushICache::setRange(uintptr_t star
 //
 // Updates outside the current code object are typically the exception so they are flushed
 // immediately rather than attempting to merge them.
 //
 // For efficiency it is expected that all large ranges will be flushed within an
 // AutoFlushICache, so check.  If this assertion is hit then it does not necessarily
 // indicate a progam fault but it might indicate a lost opportunity to merge cache
 // flushing.  It can be corrected by wrapping the call in an AutoFlushICache to context.
+//
+// Note this can be called without TLS PerThreadData defined so this case needs
+// to be guarded against. E.g. when patching instructions from the exception
+// handler on MacOS running the ARM simulator.
 void
 AutoFlushICache::flush(uintptr_t start, size_t len)
 {
 #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
-    AutoFlushICache *afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache();
+    PerThreadData *pt = TlsPerThreadData.get();
+    AutoFlushICache *afc = pt ? pt->PerThreadData::autoFlushICache() : nullptr;
     if (!afc) {
         IonSpewCont(IonSpew_CacheFlush, "#");
         ExecutableAllocator::cacheFlush((void*)start, len);
         JS_ASSERT(len <= 16);
         return;
     }
 
     uintptr_t stop = start + len;