Bug 1340589 - Use JSScript::mainOffset() while checking JSTRY_CATCH in dis() output. r=luke
authorTooru Fujisawa <arai_a@mac.com>
Sat, 18 Feb 2017 07:59:58 +0900
changeset 486590 e319d3fd614a71056cce9deb07a530abe825bfba
parent 486589 e1850269c2e0f4509d5b82931a7c1a3feba5054b
child 486591 421a05b31eae5bbc0f49dbcd500da6a0da7cb2bd
push id46031
push userbmo:cam@mcc.id.au
push dateSun, 19 Feb 2017 01:42:46 +0000
reviewersluke
bugs1340589
milestone54.0a1
Bug 1340589 - Use JSScript::mainOffset() while checking JSTRY_CATCH in dis() output. r=luke
js/src/jsopcode.cpp
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -979,19 +979,20 @@ js::Disassemble1(JSContext* cx, HandleSc
       case JOF_BYTE:
           // Scan the trynotes to find the associated catch block
           // and make the try opcode look like a jump instruction
           // with an offset. This simplifies code coverage analysis
           // based on this disassembled output.
           if (op == JSOP_TRY) {
               TryNoteArray* trynotes = script->trynotes();
               uint32_t i;
+              size_t mainOffset = script->mainOffset();
               for(i = 0; i < trynotes->length; i++) {
                   JSTryNote note = trynotes->vector[i];
-                  if (note.kind == JSTRY_CATCH && note.start == loc + 1) {
+                  if (note.kind == JSTRY_CATCH && note.start + mainOffset == loc + 1) {
                       if (!sp->jsprintf(" %u (%+d)",
                                         unsigned(loc + note.length + 1),
                                         int(note.length + 1)))
                       {
                           return 0;
                       }
                       break;
                   }