Bug 831459: use RawScript in JMChunkInfo::Convert() to prevent UnrootedScript construction in signal handler r=billm
authorIrving Reid <irving@mozilla.com>
Wed, 16 Jan 2013 23:10:46 -0500
changeset 119118 07f778300689d4c3fc4cf96939c455ee7c97cf10
parent 119117 da5cae51b8334f4597160fd74c9b823a621497f0
child 119119 e279a54371b701a692614611b3266357ce56f01e
push id24189
push useremorley@mozilla.com
push dateThu, 17 Jan 2013 10:42:06 +0000
treeherdermozilla-central@712eca11a04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs831459
milestone21.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 831459: use RawScript in JMChunkInfo::Convert() to prevent UnrootedScript construction in signal handler r=billm
js/src/vm/SPSProfiler.cpp
js/src/vm/SPSProfiler.h
--- a/js/src/vm/SPSProfiler.cpp
+++ b/js/src/vm/SPSProfiler.cpp
@@ -232,17 +232,17 @@ JMChunkInfo::JMChunkInfo(mjit::JSActiveF
     mainEnd(frame->mainCodeEnd),
     stubStart(frame->stubCodeStart),
     stubEnd(frame->stubCodeEnd),
     pcLengths(pcLengths),
     chunk(chunk)
 {}
 
 // Use RawScript instead of UnrootedScript because this may be called from a
-// signal handler
+// signal handler.
 jsbytecode*
 SPSProfiler::ipToPC(RawScript script, size_t ip)
 {
     if (!jminfo.initialized())
         return NULL;
 
     JITInfoMap::Ptr ptr = jminfo.lookup(script);
     if (!ptr)
@@ -261,18 +261,20 @@ SPSProfiler::ipToPC(RawScript script, si
         jsbytecode *pc = info->chunks[i].convert(script, ip);
         if (pc != NULL)
             return pc;
     }
 
     return NULL;
 }
 
+// Use RawScript instead of UnrootedScript because this may be called from a
+// signal handler.
 jsbytecode*
-JMChunkInfo::convert(UnrootedScript script, size_t ip)
+JMChunkInfo::convert(RawScript script, size_t ip)
 {
     if (mainStart <= ip && ip < mainEnd) {
         size_t offset = 0;
         uint32_t i;
         for (i = 0; i < script->length - 1; i++) {
             offset += (uint32_t) pcLengths[i].inlineLength;
             if (mainStart + offset > ip)
                 break;
--- a/js/src/vm/SPSProfiler.h
+++ b/js/src/vm/SPSProfiler.h
@@ -195,17 +195,17 @@ class SPSProfiler
         size_t stubEnd;
         mjit::PCLengthEntry *pcLengths; // pcLengths for this chunk
         mjit::JITChunk *chunk;          // stored to test when removing
 
         JMChunkInfo(mjit::JSActiveFrame *frame,
                     mjit::PCLengthEntry *pcLengths,
                     mjit::JITChunk *chunk);
 
-        jsbytecode *convert(UnrootedScript script, size_t ip);
+        jsbytecode *convert(RawScript script, size_t ip);
     };
 
     struct JMScriptInfo
     {
         Vector<ICInfo, 0, SystemAllocPolicy> ics;
         Vector<JMChunkInfo, 1, SystemAllocPolicy> chunks;
     };