Fixed look of the green flag over the HTML5 player. Moved some styles into compare.css from compare.html. Implemented debug logs for Javascript and Actionscript to compare the operation of both virtual machines. Moved start and stop buttons above the players.

This commit is contained in:
Shane M. Clements 2013-11-04 06:11:05 +00:00
parent b2644c0365
commit 374c3ccf19
4 changed files with 65 additions and 21 deletions

View file

@ -54,6 +54,9 @@ var Interpreter = function() {
this.yield = false;
this.doRedraw = false;
this.opCount = 0; // used to benchmark the interpreter
this.debugOps = false;
this.debugFunc = null;
this.opCount2 = 0;
};
// Utilities for building blocks and sequences of blocks
@ -136,6 +139,14 @@ Interpreter.prototype.stepActiveThread = function() {
// Advance the "program counter" to the next block before running the primitive.
// Control flow primitives (e.g. if) may change activeThread.nextBlock.
this.activeThread.nextBlock = b.nextBlock;
if(this.debugOps && this.debugFunc) {
var finalArgs = new Array(b.args.length);
for(var i=0; i<b.args.length; ++i)
finalArgs[i] = this.arg(b, i);
this.debugFunc(this.opCount2, b.op, finalArgs);
++this.opCount2;
}
b.primFcn(b);
if (this.yield) { this.activeThread.nextBlock = b; return; }
b = this.activeThread.nextBlock; // refresh local variable b in case primitive did some control flow