@@ -3114,7 +3114,7 @@ ExecutionVisualizer.prototype.renderPrimitiveObject = function(obj, d3DomElement
31143114 d3DomElement . append ( '<span class="stringObj">' + literalStr + '</span>' ) ;
31153115 }
31163116 else if ( typ == "object" ) {
3117- assert ( obj [ 0 ] == 'SPECIAL_FLOAT' ) ;
3117+ assert ( obj [ 0 ] == 'SPECIAL_FLOAT' || obj [ 0 ] == 'JS_SPECIAL_VAL' ) ;
31183118 d3DomElement . append ( '<span class="numberObj">' + obj [ 1 ] + '</span>' ) ;
31193119 }
31203120 else {
@@ -3402,6 +3402,39 @@ function(objID, stepNum, d3DomElement, isTopLevel) {
34023402 d3DomElement . append ( '<div class="funcObj">' + funcPrefix + ' ' + funcName + '</div>' ) ;
34033403 }
34043404 }
3405+ else if ( obj [ 0 ] == 'JS_FUNCTION' ) { /* TODO: refactor me */
3406+ // JavaScript function
3407+ assert ( obj . length == 5 ) ;
3408+ var funcName = htmlspecialchars ( obj [ 1 ] ) ;
3409+ var funcCode = htmlspecialchars ( obj [ 2 ] ) ;
3410+ var prototype = obj [ 3 ] ;
3411+ var parentFrameID = obj [ 4 ] ;
3412+
3413+
3414+ if ( prototype || parentFrameID || myViz . showAllFrameLabels ) {
3415+ d3DomElement . append ( '<table class="classTbl"></table>' ) ;
3416+ var tbl = d3DomElement . children ( 'table' ) ;
3417+ tbl . append ( '<tr><td class="funcCod" colspan="2"><pre class="funcCode">' + funcCode + '</pre>' + '</td></tr>' ) ;
3418+
3419+ if ( prototype ) {
3420+ tbl . append ( '<tr class="classEntry"><td class="classKey">prototype</td><td class="classVal"></td></tr>' ) ;
3421+ var newRow = tbl . find ( 'tr:last' ) ;
3422+ var valTd = newRow . find ( 'td:last' ) ;
3423+ myViz . renderNestedObject ( prototype , stepNum , valTd ) ;
3424+ }
3425+
3426+ if ( parentFrameID ) {
3427+ tbl . append ( '<tr class="classEntry"><td class="classKey">parent</td><td class="classVal">' + 'f' + parentFrameID + '</td></tr>' ) ;
3428+ }
3429+ else if ( myViz . showAllFrameLabels ) {
3430+ tbl . append ( '<tr class="classEntry"><td class="classKey">parent</td><td class="classVal">' + 'global' + '</td></tr>' ) ;
3431+ }
3432+ }
3433+ else {
3434+ // compact form:
3435+ d3DomElement . append ( '<pre class="funcCode">' + funcCode + '</pre>' ) ;
3436+ }
3437+ }
34053438 else if ( obj [ 0 ] == 'HEAP_PRIMITIVE' ) {
34063439 assert ( obj . length == 3 ) ;
34073440
@@ -3526,7 +3559,11 @@ var rbRE = new RegExp('\\]|}|\\)|>', 'g');
35263559function varnameToCssID ( varname ) {
35273560 // make sure to REPLACE ALL (using the 'g' option)
35283561 // rather than just replacing the first entry
3529- return varname . replace ( lbRE , 'LeftB_' ) . replace ( rbRE , '_RightB' ) . replace ( / [ . ] / g, '_DOT_' ) . replace ( / / g, '_' ) ;
3562+ return varname . replace ( lbRE , 'LeftB_' )
3563+ . replace ( rbRE , '_RightB' )
3564+ . replace ( / [: ] / g, '_COLON_' )
3565+ . replace ( / [ . ] / g, '_DOT_' )
3566+ . replace ( / / g, '_' ) ;
35303567}
35313568
35323569
@@ -3587,13 +3624,13 @@ function isPrimitiveType(obj) {
35873624 if ( hook_result [ 0 ] ) return hook_result [ 1 ] ;
35883625
35893626 // null is a primitive
3590- if ( obj == null ) {
3627+ if ( obj === null ) {
35913628 return true ;
35923629 }
35933630
35943631 if ( typeof obj == "object" ) {
35953632 // kludge: only 'SPECIAL_FLOAT' objects count as primitives
3596- return ( obj [ 0 ] == 'SPECIAL_FLOAT' ) ;
3633+ return ( obj [ 0 ] == 'SPECIAL_FLOAT' || obj [ 0 ] == 'JS_SPECIAL_VAL' ) ;
35973634 }
35983635 else {
35993636 // non-objects are primitives
0 commit comments