Index: lnt/server/ui/static/lnt_profile.js =================================================================== --- lnt/server/ui/static/lnt_profile.js +++ lnt/server/ui/static/lnt_profile.js @@ -15,7 +15,7 @@ this.instructions = instructions; this.address = instructions[0].address; var gjt = this.instructionParser - .getJumpTargets(instructions[instructions.length-1], fallThruInstruction, this.cfg); + .getJumpTargets(instructions[instructions.length-1], fallThruInstruction); this.targets = gjt[1]; this.noFallThru = gjt[0]; this.weight = this.instructions @@ -100,7 +100,13 @@ // TODO: add all control-flow-changing instructions. ], - getJumpTargets: function(instruction, nextInstruction, cfg) { + // The following method will have different implementations depending + // on the profiler, or kind of profiling input. + convertToAddress: function (addressString) { + return parseInt(addressString, 16); + }, + + getJumpTargets: function(instruction, nextInstruction) { for(var i=0; i 1) - targets.push(cfg.convertToAddress(match[1])); + targets.push(this.convertToAddress(match[1])); return [noFallThru, targets]; } } @@ -120,12 +126,6 @@ CFG.prototype = { - // The following method will have different implementations depending - // on the profiler, or kind of profiling input. - convertToAddress: function (addressString) { - return parseInt(addressString, 16); - }, - parseDisassembly: function() { var instructions = []; for (var i=0; i 0) { for(var j=0; j"); + var jt = instructionSetParser.getJumpTargets(i, null); + var noFallThru=jt[0]; + expect(noFallThru).toBe(false); + }); + it("extracts the jump target for 'b.'", function() { + var i = new CFGInstruction("0.0%", "4b09d8", "b.ne 4b09fc "); + var jt = instructionSetParser.getJumpTargets(i, null); + var jumpTargets=jt[1]; + expect(jumpTargets).toEqual([0x4b09fc]); + }); + }); +}); Index: tests/spec/javascripts/support/jasmine.yml =================================================================== --- /dev/null +++ tests/spec/javascripts/support/jasmine.yml @@ -0,0 +1,99 @@ + +# src_files +# +# Return an array of filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# src_files: +# - lib/source1.js +# - lib/source2.js +# - dist/**/*.js +# +src_files: + - lnt_profile.js + +# stylesheets +# +# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# stylesheets: +# - css/style.css +# - stylesheets/*.css +# +stylesheets: + - lnt_profile.css + +# helpers +# +# Return an array of filepaths relative to spec_dir to include before jasmine specs. +# Default: ["helpers/**/*.js"] +# +# EXAMPLE: +# +# helpers: +# - helpers/**/*.js +# +helpers: + - "helpers/**/*.js" + +# spec_files +# +# Return an array of filepaths relative to spec_dir to include. +# Default: ["**/*[sS]pec.js"] +# +# EXAMPLE: +# +# spec_files: +# - **/*[sS]pec.js +# +spec_files: + - "**/*[Ss]pec.js" + +# src_dir +# +# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. +# Default: project root +# +# EXAMPLE: +# +# src_dir: public +# +src_dir: ../lnt/server/ui/static + +# spec_dir +# +# Spec directory path. Your spec_files must be returned relative to this path. +# Default: spec/javascripts +# +# EXAMPLE: +# +# spec_dir: spec/javascripts +# +spec_dir: spec/javascripts + +# stop_spec_on_expectation_failure +# +# Stop executing each spec on the first expectation failure. +# Default: false +# +# EXAMPLE: +# +# stop_spec_on_expectation_failure: true +# +stop_spec_on_expectation_failure: + +# random +# +# Run specs in semi-random order. +# Default: false +# +# EXAMPLE: +# +# random: true +# +random: