Skip to content

Commit

Permalink
added
Browse files Browse the repository at this point in the history
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

change isPseudoGlobal to isScriptLocal
  • Loading branch information
ksen007 committed Dec 8, 2014
1 parent 24630c4 commit 595d85a
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ API compared to analysis.js of Jalangi1. An analysis in analysis.js can be writ
this.putField = function(iid, base, offset, val, isComputed, isOpAssign){return {result:val};};
this.read = function(iid, name, val, isGlobal, isPseudoGlobal){return {result:val};};
this.read = function(iid, name, val, isGlobal, isScriptLocal){return {result:val};};
this.write = function(iid, name, val, lhs, isGlobal, isPseudoGlobal) {return {result:val};};
this.write = function(iid, name, val, lhs, isGlobal, isScriptLocal) {return {result:val};};
this._return = function(iid, val){return {result:val};};
Expand Down
2 changes: 2 additions & 0 deletions src/js/Config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT
if (typeof J$ === 'undefined') {
J$ = {};
}
Expand Down
2 changes: 2 additions & 0 deletions src/js/Constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT
if (typeof J$ === 'undefined') {
J$ = {};
}
Expand Down
2 changes: 2 additions & 0 deletions src/js/headers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT
module.exports.headerSources = [
"src/js/Constants.js",
"src/js/Config.js",
Expand Down
3 changes: 3 additions & 0 deletions src/js/instrument/astUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
/*jslint node: true */
/*global window */

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

if (typeof J$ === 'undefined') {
J$ = {};
}
Expand Down
11 changes: 7 additions & 4 deletions src/js/instrument/esnstrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

/*jslint node: true browser: true */
/*global astUtil acorn escodegen J$ */

Expand Down Expand Up @@ -360,11 +363,11 @@ if (typeof J$ === 'undefined') {
}
}

function wrapRead(node, name, val, isReUseIid, isGlobal, isPseudoGlobal) {
function wrapRead(node, name, val, isReUseIid, isGlobal, isScriptLocal) {
if (!Config.INSTR_READ || Config.INSTR_READ(name, node)) {
printIidToLoc(node);
var ret = replaceInExpr(
logReadFunName + "(" + RP + "1, " + RP + "2, " + RP + "3," + (isGlobal ? "true" : "false") + "," + (isPseudoGlobal ? "true" : "false") + ")",
logReadFunName + "(" + RP + "1, " + RP + "2, " + RP + "3," + (isGlobal ? "true" : "false") + "," + (isScriptLocal ? "true" : "false") + ")",
isReUseIid ? getPrevIidNoInc() : getIid(),
name,
val
Expand Down Expand Up @@ -409,12 +412,12 @@ if (typeof J$ === 'undefined') {
return ret;
}

function wrapWrite(node, name, val, lhs, isGlobal, isPseudoGlobal, isDeclaration) {
function wrapWrite(node, name, val, lhs, isGlobal, isScriptLocal, isDeclaration) {
if (!Config.INSTR_WRITE || Config.INSTR_WRITE(name, node)) {
printIidToLoc(node);
var ret = replaceInExpr(
logWriteFunName + "(" + RP + "1, " + RP + "2, " + RP + "3, " + RP + "4," + (isGlobal ? "true" : "false") +
"," + (isPseudoGlobal ? "true" : "false") + "," + (isDeclaration ? "true" : "false") + ")",
"," + (isScriptLocal ? "true" : "false") + "," + (isDeclaration ? "true" : "false") + ")",
getIid(),
name,
val,
Expand Down
3 changes: 3 additions & 0 deletions src/js/instrument/instUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

// Author: Manu Sridharan

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

/*jslint node: true */
var fs = require('fs');
var path = require('path');
Expand Down
13 changes: 8 additions & 5 deletions src/js/runtime/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT


// wrap in anonymous function to create local namespace when in browser
// create / reset J$ global variable to hold analysis runtime
Expand Down Expand Up @@ -291,12 +294,12 @@ if (typeof J$ === 'undefined') {

// variable write
// isGlobal means that the variable is global and not declared as var
// isPseudoGlobal means that the variable is global and is declared as var
function R(iid, name, val, isGlobal, isPseudoGlobal) {
// isScriptLocal means that the variable is global and is declared as var
function R(iid, name, val, isGlobal, isScriptLocal) {
var aret;

if (sandbox.analysis && sandbox.analysis.read) {
aret = sandbox.analysis.read(iid, name, val, isGlobal, isPseudoGlobal);
aret = sandbox.analysis.read(iid, name, val, isGlobal, isScriptLocal);
if (aret) {
val = aret.result;
}
Expand All @@ -305,10 +308,10 @@ if (typeof J$ === 'undefined') {
}

// variable write
function W(iid, name, val, lhs, isGlobal, isPseudoGlobal, isDeclaration) {
function W(iid, name, val, lhs, isGlobal, isScriptLocal, isDeclaration) {
var aret;
if (sandbox.analysis && sandbox.analysis.write) {
aret = sandbox.analysis.write(iid, name, val, lhs, isGlobal, isPseudoGlobal);
aret = sandbox.analysis.write(iid, name, val, lhs, isGlobal, isScriptLocal);
if (aret) {
val = aret.result;
}
Expand Down
6 changes: 4 additions & 2 deletions src/js/runtime/analysisCallbackTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

// In the following callbacks one can choose to not return anything.
// If all of the callbacks return nothing, we get a passive analysis where the
Expand Down Expand Up @@ -53,9 +55,9 @@

this.putField = function(iid, base, offset, val, isComputed, isOpAssign){return {result:val};};

this.read = function(iid, name, val, isGlobal, isPseudoGlobal){return {result:val};};
this.read = function(iid, name, val, isGlobal, isScriptLocal){return {result:val};};

this.write = function(iid, name, val, lhs, isGlobal, isPseudoGlobal) {return {result:val};};
this.write = function(iid, name, val, lhs, isGlobal, isScriptLocal) {return {result:val};};

this._return = function(iid, val){return {result:val};};

Expand Down
2 changes: 2 additions & 0 deletions src/js/runtime/iidToLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/

// Author: Koushik Sen
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

if (typeof J$ === 'undefined') {
J$ = {};
Expand Down
5 changes: 5 additions & 0 deletions src/js/sample_analyses/ChainedAnalyses.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

(function (sandbox) {
function ChainedAnalyses() {

Expand Down
2 changes: 2 additions & 0 deletions src/js/sample_analyses/dlint/CheckNaN.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT


(function (sandbox) {
Expand Down
5 changes: 5 additions & 0 deletions src/js/sample_analyses/dlint/CompareFunctionWithPrimitives.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

// probably forgot to call a function before comparison
(function (sandbox) {
function MyAnalysis () {
Expand Down
6 changes: 6 additions & 0 deletions src/js/sample_analyses/dlint/ConcatUndefinedToString.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT


(function (sandbox) {
function MyAnalysis () {
var iidToLocation = sandbox.iidToLocation;
Expand Down
2 changes: 2 additions & 0 deletions src/js/sample_analyses/dlint/FunCalledWithMoreArguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

// In the following callbacks one can choose to not return anything.
// If all of the callbacks return nothing, we get a passive analysis where the
Expand Down
3 changes: 3 additions & 0 deletions src/js/sample_analyses/dlint/ShadowProtoProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT


// In the following callbacks one can choose to not return anything.
// If all of the callbacks return nothing, we get a passive analysis where the
Expand Down
3 changes: 3 additions & 0 deletions src/js/sample_analyses/dlint/UndefinedOffset.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT


(function (sandbox) {

Expand Down
3 changes: 3 additions & 0 deletions src/js/sample_analyses/dlint/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

(function (sandbox) {
function Utils () {
var Constants = sandbox.Constants;
Expand Down
5 changes: 5 additions & 0 deletions src/js/sample_analyses/dsjs/Dsjs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Author: Koushik Sen

// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

// run the following in the JALANGI_HOME directory
// python scripts/dsjs.py tests/octane/richards; open jalangi_tmp/index.html

Expand Down
3 changes: 3 additions & 0 deletions src/js/template.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// do not remove the following comment
// JALANGI DO NOT INSTRUMENT

// add relative path of this file in headers.js

if (typeof J$ === 'undefined') {
Expand Down

0 comments on commit 595d85a

Please sign in to comment.