Bug 1192572 - Add id to each opcode section in SpiderMonkey Bytecode documentation. r=Waldo
authorTooru Fujisawa <arai_a@mac.com>
Sun, 09 Aug 2015 09:17:15 +0900
changeset 257392 9e979108667ed6ffae0586239b292e02813b4ea6
parent 257391 2c3c8a927e3fcc3c7d63c2ecf5ff9a189d1cbd96
child 257393 05f838caf0761e9f9d0beecdd49d1c93d98d8e75
push id63614
push userarai_a@mac.com
push dateWed, 12 Aug 2015 12:42:24 +0000
treeherdermozilla-inbound@a8493abd3c62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1192572
milestone43.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 1192572 - Add id to each opcode section in SpiderMonkey Bytecode documentation. r=Waldo
js/src/vm/make_opcode_doc.py
--- a/js/src/vm/make_opcode_doc.py
+++ b/js/src/vm/make_opcode_doc.py
@@ -287,48 +287,49 @@ def override(value, override_value):
 def format_flags(flags):
     if flags == '':
         return ''
 
     return ' ({flags})'.format(flags=flags)
 
 def print_opcode(opcode):
     names_template = '{name} [-{nuses}, +{ndefs}]{flags}'
+    opcodes = sorted([opcode] + opcode.group,
+                     key=lambda opcode: opcode.name)
     names = map(lambda code: names_template.format(name=escape(code.name),
                                                    nuses=override(code.nuses,
                                                                   opcode.nuses_override),
                                                    ndefs=override(code.ndefs,
                                                                   opcode.ndefs_override),
                                                    flags=format_flags(code.flags)),
-                sorted([opcode] + opcode.group,
-                       key=lambda opcode: opcode.name))
-    if len(opcode.group) == 0:
+                opcodes)
+    if len(opcodes) == 1:
         values = ['{value} (0x{value:02x})'.format(value=opcode.value)]
     else:
         values_template = '{name}: {value} (0x{value:02x})'
         values = map(lambda code: values_template.format(name=escape(code.name),
                                                          value=code.value),
-                    sorted([opcode] + opcode.group,
-                           key=lambda opcode: opcode.name))
+                    opcodes)
 
-    print("""<dt>{names}</dt>
+    print("""<dt id="{id}">{names}</dt>
 <dd>
 <table class="standard-table">
 <tbody>
 <tr><th>Value</th><td><code>{values}</code></td></tr>
 <tr><th>Operands</th><td><code>{operands}</code></td></tr>
 <tr><th>Length</th><td><code>{length}</code></td></tr>
 <tr><th>Stack Uses</th><td><code>{stack_uses}</code></td></tr>
 <tr><th>Stack Defs</th><td><code>{stack_defs}</code></td></tr>
 </tbody>
 </table>
 
 {desc}
 </dd>
-""".format(names='<br>'.join(names),
+""".format(id=opcodes[0].name,
+           names='<br>'.join(names),
            values='<br>'.join(values),
            operands=escape(opcode.operands) or "&nbsp;",
            length=escape(override(opcode.length,
                                   opcode.length_override)),
            stack_uses=escape(opcode.stack_uses) or "&nbsp;",
            stack_defs=escape(opcode.stack_defs) or "&nbsp;",
            desc=opcode.desc)) # desc is already escaped