if (isAsmJSCompilationAvailable()) { var m = newFunction('glob', 'ffi', 'heap', bodyOnly);
assertEq(isAsmJSModule(m), true);
assertEq(m.toSource(), "(function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n})");
}
})();
/* Modules in "use strict" context */
(function() {
var funcSource =
`function(glob, ffi, heap) { "use asm"; function g() {} return g;
}`;
var f4 = eval("\"use strict\";\n(" + funcSource + ")");
var expectedToString = funcSource; var expectedToSource = '(' + expectedToString + ')';
assertEq(f4.toSource(), expectedToSource);
if (isAsmJSCompilationAvailable()) { var f5 = eval("\"use strict\";\n(" + funcSource + ")");
assertEq(isAsmJSModule(f5), true);
assertEq(f5.toSource(), expectedToSource);
}
})();
/* Functions */
(function() {
var noSrc = "function noArgument() {\n\ return 42;\n\
}" var oneSrc = "function oneArgument(x) {\n\
x = x | 0;\n\ return x + 1 | 0;\n\
}"; var twoSrc = "function twoArguments(x, y) {\n\
x = x | 0;\n\
y = y | 0;\n\ return x + y | 0;\n\
}"; var threeSrc = "function threeArguments(a, b, c) {\n\
a = +a;\n\
b = +b;\n\
c = +c;\n\ return +(+(a * b) + c);\n\
}";
var f5 = eval(useStrict + ";\n(" + moduleCode + "())");
var expectedToString = funcCode; var expectedToSource = expectedToString
assertEq(f5.toSource(), expectedToSource);
if (isAsmJSCompilationAvailable()) { var mf5 = eval("\"use strict\";\n(" + moduleCode + ")");
assertEq(isAsmJSModule(mf5), true); var f5 = mf5();
assertEq(f5.toSource(), expectedToSource);
}
})();
/* Functions in "use strict" context with dynamic linking failure */
(function () {
var funcCode = 'function g(x) {\n\
x=x|0;\n\ return x + 1 | 0;}'; var moduleCode = 'function (glob) {\n\ "use asm";\n\ var fround = glob.Math.fround;\n\ ' + funcCode + '\n\ return g;\n\
}',
useStrict = '"use strict";';
var f6 = eval(useStrict + ";\n(" + moduleCode + "({Math:{}}))");
assertEq(f6.toSource(), funcCode);
if (isAsmJSCompilationAvailable()) { var mf6 = eval("\"use strict\";\n(" + moduleCode + ")");
assertEq(isAsmJSModule(mf6), true); var f6 = mf6({Math:{}});
assertEq(f6.toSource(), funcCode);
}
})();
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.17Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.