@@ -1900,25 +1900,30 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
19001900
19011901 function renderCompoundObject ( objID , d3DomElement , isTopLevel ) {
19021902 if ( ! isTopLevel && renderedObjectIDs . has ( objID ) ) {
1903- // render jsPlumb arrow source since this heap object has already been rendered
1904- // (or will be rendered soon)
1903+ if ( myViz . textualMemoryLabels ) {
1904+ d3DomElement . append ( '<div class="objectIdLabel">id' + objID + '</div>' ) ;
1905+ }
1906+ else {
1907+ // render jsPlumb arrow source since this heap object has already been rendered
1908+ // (or will be rendered soon)
19051909
1906- // add a stub so that we can connect it with a connector later.
1907- // IE needs this div to be NON-EMPTY in order to properly
1908- // render jsPlumb endpoints, so that's why we add an " "!
1910+ // add a stub so that we can connect it with a connector later.
1911+ // IE needs this div to be NON-EMPTY in order to properly
1912+ // render jsPlumb endpoints, so that's why we add an " "!
19091913
1910- var srcDivID = myViz . generateID ( 'heap_pointer_src_' + heap_pointer_src_id ) ;
1911- heap_pointer_src_id ++ ; // just make sure each source has a UNIQUE ID
1912- d3DomElement . append ( '<div id="' + srcDivID + '"> </div>' ) ;
1914+ var srcDivID = myViz . generateID ( 'heap_pointer_src_' + heap_pointer_src_id ) ;
1915+ heap_pointer_src_id ++ ; // just make sure each source has a UNIQUE ID
1916+ d3DomElement . append ( '<div id="' + srcDivID + '"> </div>' ) ;
19131917
1914- var dstDivID = myViz . generateID ( 'heap_object_' + objID ) ;
1918+ var dstDivID = myViz . generateID ( 'heap_object_' + objID ) ;
19151919
1916- assert ( ! connectionEndpointIDs . has ( srcDivID ) ) ;
1917- connectionEndpointIDs . set ( srcDivID , dstDivID ) ;
1918- //console.log('HEAP->HEAP', srcDivID, dstDivID);
1920+ assert ( ! connectionEndpointIDs . has ( srcDivID ) ) ;
1921+ connectionEndpointIDs . set ( srcDivID , dstDivID ) ;
1922+ //console.log('HEAP->HEAP', srcDivID, dstDivID);
19191923
1920- assert ( ! heapConnectionEndpointIDs . has ( srcDivID ) ) ;
1921- heapConnectionEndpointIDs . set ( srcDivID , dstDivID ) ;
1924+ assert ( ! heapConnectionEndpointIDs . has ( srcDivID ) ) ;
1925+ heapConnectionEndpointIDs . set ( srcDivID , dstDivID ) ;
1926+ }
19221927
19231928 return ; // early return!
19241929 }
@@ -1932,6 +1937,9 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
19321937 d3DomElement . append ( '<div class="heapObject" id="' + heapObjID + '"></div>' ) ;
19331938 d3DomElement = myViz . domRoot . find ( '#' + heapObjID ) ;
19341939
1940+ if ( myViz . textualMemoryLabels ) {
1941+ d3DomElement . append ( '<div class="objectIdLabel">id' + objID + '</div>' ) ;
1942+ }
19351943
19361944 renderedObjectIDs . set ( objID , 1 ) ;
19371945
@@ -2208,15 +2216,20 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
22082216 renderPrimitiveObject ( val , $ ( this ) ) ;
22092217 }
22102218 else {
2211- // add a stub so that we can connect it with a connector later.
2212- // IE needs this div to be NON-EMPTY in order to properly
2213- // render jsPlumb endpoints, so that's why we add an " "!
2214- $ ( this ) . append ( '<div class="stack_pointer" id="' + varDivID + '"> </div>' ) ;
2215-
2216- assert ( ! connectionEndpointIDs . has ( varDivID ) ) ;
2217- var heapObjID = myViz . generateID ( 'heap_object_' + getRefID ( val ) ) ;
2218- connectionEndpointIDs . set ( varDivID , heapObjID ) ;
2219- //console.log('STACK->HEAP', varDivID, heapObjID);
2219+ if ( myViz . textualMemoryLabels ) {
2220+ $ ( this ) . append ( '<div class="objectIdLabel">id' + getRefID ( val ) + '</div>' ) ;
2221+ }
2222+ else {
2223+ // add a stub so that we can connect it with a connector later.
2224+ // IE needs this div to be NON-EMPTY in order to properly
2225+ // render jsPlumb endpoints, so that's why we add an " "!
2226+ $ ( this ) . append ( '<div class="stack_pointer" id="' + varDivID + '"> </div>' ) ;
2227+
2228+ assert ( ! connectionEndpointIDs . has ( varDivID ) ) ;
2229+ var heapObjID = myViz . generateID ( 'heap_object_' + getRefID ( val ) ) ;
2230+ connectionEndpointIDs . set ( varDivID , heapObjID ) ;
2231+ //console.log('STACK->HEAP', varDivID, heapObjID);
2232+ }
22202233 }
22212234 }
22222235 } ) ;
@@ -2410,15 +2423,20 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
24102423 renderPrimitiveObject ( val , $ ( this ) ) ;
24112424 }
24122425 else {
2413- // add a stub so that we can connect it with a connector later.
2414- // IE needs this div to be NON-EMPTY in order to properly
2415- // render jsPlumb endpoints, so that's why we add an " "!
2416- $ ( this ) . append ( '<div class="stack_pointer" id="' + varDivID + '"> </div>' ) ;
2417-
2418- assert ( ! connectionEndpointIDs . has ( varDivID ) ) ;
2419- var heapObjID = myViz . generateID ( 'heap_object_' + getRefID ( val ) ) ;
2420- connectionEndpointIDs . set ( varDivID , heapObjID ) ;
2421- //console.log('STACK->HEAP', varDivID, heapObjID);
2426+ if ( myViz . textualMemoryLabels ) {
2427+ $ ( this ) . append ( '<div class="objectIdLabel">id' + getRefID ( val ) + '</div>' ) ;
2428+ }
2429+ else {
2430+ // add a stub so that we can connect it with a connector later.
2431+ // IE needs this div to be NON-EMPTY in order to properly
2432+ // render jsPlumb endpoints, so that's why we add an " "!
2433+ $ ( this ) . append ( '<div class="stack_pointer" id="' + varDivID + '"> </div>' ) ;
2434+
2435+ assert ( ! connectionEndpointIDs . has ( varDivID ) ) ;
2436+ var heapObjID = myViz . generateID ( 'heap_object_' + getRefID ( val ) ) ;
2437+ connectionEndpointIDs . set ( varDivID , heapObjID ) ;
2438+ //console.log('STACK->HEAP', varDivID, heapObjID);
2439+ }
24222440 }
24232441 }
24242442 } ) ;
@@ -2514,15 +2532,15 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
25142532 totalParentPointersRendered ++ ;
25152533 }
25162534
2517- // re-render existing connectors ...
2518- existingConnectionEndpointIDs . forEach ( renderVarValueConnector ) ;
2519- if ( myViz . drawParentPointers ) {
2520- existingParentPointerConnectionEndpointIDs . forEach ( renderParentPointerConnector ) ;
2535+ if ( ! myViz . textualMemoryLabels ) {
2536+ // re-render existing connectors and then ...
2537+ existingConnectionEndpointIDs . forEach ( renderVarValueConnector ) ;
2538+ // add all the NEW connectors that have arisen in this call to renderDataStructures
2539+ connectionEndpointIDs . forEach ( renderVarValueConnector ) ;
25212540 }
2522-
2523- // finally add all the NEW connectors that have arisen in this call to renderDataStructures
2524- connectionEndpointIDs . forEach ( renderVarValueConnector ) ;
2541+ // do the same for environment parent pointers
25252542 if ( myViz . drawParentPointers ) {
2543+ existingParentPointerConnectionEndpointIDs . forEach ( renderParentPointerConnector ) ;
25262544 parentPointerConnectionEndpointIDs . forEach ( renderParentPointerConnector ) ;
25272545 }
25282546
0 commit comments