Commit 090bf558 authored by bradnelson's avatar bradnelson Committed by Commit bot

Reformat asm-wasm.js for increased readability.

BUG= https://code.google.com/p/v8/issues/detail?id=4203
TEST=asm-wasm
R=aseemgarg@chromium.org,titzer@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/1587213003

Cr-Commit-Position: refs/heads/master@{#33315}
parent 4faa262e
......@@ -17,6 +17,7 @@ function EmptyTest() {
assertEquals(11, _WASMEXP_.asmCompileRun(EmptyTest.toString()));
function IntTest() {
"use asm";
function sum(a, b) {
......@@ -37,6 +38,7 @@ function IntTest() {
assertEquals(101, _WASMEXP_.asmCompileRun(IntTest.toString()));
function Float64Test() {
"use asm";
function sum(a, b) {
......@@ -61,6 +63,7 @@ function Float64Test() {
assertEquals(1, _WASMEXP_.asmCompileRun(Float64Test.toString()));
function BadModule() {
"use asm";
function caller(a, b) {
......@@ -81,6 +84,7 @@ assertThrows(function() {
_WASMEXP_.asmCompileRun(BadModule.toString())
});
function TestReturnInBlock() {
"use asm";
......@@ -100,6 +104,7 @@ function TestReturnInBlock() {
assertEquals(1, _WASMEXP_.asmCompileRun(TestReturnInBlock.toString()));
function TestWhileSimple() {
"use asm";
......@@ -116,6 +121,7 @@ function TestWhileSimple() {
assertEquals(5, _WASMEXP_.asmCompileRun(TestWhileSimple.toString()));
function TestWhileWithoutBraces() {
"use asm";
......@@ -131,6 +137,7 @@ function TestWhileWithoutBraces() {
assertEquals(4, _WASMEXP_.asmCompileRun(TestWhileWithoutBraces.toString()));
function TestReturnInWhile() {
"use asm";
......@@ -148,6 +155,7 @@ function TestReturnInWhile() {
assertEquals(6, _WASMEXP_.asmCompileRun(TestReturnInWhile.toString()));
function TestReturnInWhileWithoutBraces() {
"use asm";
......@@ -161,7 +169,9 @@ function TestReturnInWhileWithoutBraces() {
return {caller: caller};
}
assertEquals(7, _WASMEXP_.asmCompileRun(TestReturnInWhileWithoutBraces.toString()));
assertEquals(
7, _WASMEXP_.asmCompileRun(TestReturnInWhileWithoutBraces.toString()));
function TestBreakInWhile() {
"use asm";
......@@ -178,6 +188,7 @@ function TestBreakInWhile() {
assertEquals(8, _WASMEXP_.asmCompileRun(TestBreakInWhile.toString()));
function TestBreakInNestedWhile() {
"use asm";
......@@ -200,6 +211,7 @@ function TestBreakInNestedWhile() {
assertEquals(9, _WASMEXP_.asmCompileRun(TestBreakInNestedWhile.toString()));
function TestBreakInBlock() {
"use asm";
......@@ -220,6 +232,7 @@ function TestBreakInBlock() {
assertEquals(10, _WASMEXP_.asmCompileRun(TestBreakInBlock.toString()));
function TestBreakInNamedWhile() {
"use asm";
......@@ -239,6 +252,7 @@ function TestBreakInNamedWhile() {
assertEquals(11, _WASMEXP_.asmCompileRun(TestBreakInNamedWhile.toString()));
function TestContinue() {
"use asm";
......@@ -260,6 +274,7 @@ function TestContinue() {
assertEquals(-5, _WASMEXP_.asmCompileRun(TestContinue.toString()));
function TestContinueInNamedWhile() {
"use asm";
......@@ -286,6 +301,7 @@ function TestContinueInNamedWhile() {
assertEquals(20, _WASMEXP_.asmCompileRun(TestContinueInNamedWhile.toString()));
function TestNot() {
"use asm";
......@@ -299,6 +315,7 @@ function TestNot() {
assertEquals(1, _WASMEXP_.asmCompileRun(TestNot.toString()));
function TestNotEquals() {
"use asm";
......@@ -315,6 +332,7 @@ function TestNotEquals() {
assertEquals(21, _WASMEXP_.asmCompileRun(TestNotEquals.toString()));
function TestUnsignedComparison() {
"use asm";
......@@ -331,6 +349,7 @@ function TestUnsignedComparison() {
assertEquals(22, _WASMEXP_.asmCompileRun(TestUnsignedComparison.toString()));
function TestMixedAdd() {
"use asm";
......@@ -352,6 +371,7 @@ function TestMixedAdd() {
assertEquals(23, _WASMEXP_.asmCompileRun(TestMixedAdd.toString()));
function TestInt32HeapAccess(stdlib, foreign, buffer) {
"use asm";
......@@ -370,6 +390,7 @@ function TestInt32HeapAccess(stdlib, foreign, buffer) {
assertEquals(7, _WASMEXP_.asmCompileRun(TestInt32HeapAccess.toString()));
function TestHeapAccessIntTypes() {
var types = [
['Int8Array', '>> 0'],
......@@ -389,6 +410,7 @@ function TestHeapAccessIntTypes() {
TestHeapAccessIntTypes();
function TestFloatHeapAccess(stdlib, foreign, buffer) {
"use asm";
......@@ -413,6 +435,7 @@ function TestFloatHeapAccess(stdlib, foreign, buffer) {
assertEquals(1, _WASMEXP_.asmCompileRun(TestFloatHeapAccess.toString()));
function TestConvertI32() {
"use asm";
......@@ -429,6 +452,7 @@ function TestConvertI32() {
assertEquals(24, _WASMEXP_.asmCompileRun(TestConvertI32.toString()));
function TestConvertF64FromInt() {
"use asm";
......@@ -445,6 +469,7 @@ function TestConvertF64FromInt() {
assertEquals(25, _WASMEXP_.asmCompileRun(TestConvertF64FromInt.toString()));
function TestConvertF64FromUnsigned() {
"use asm";
......@@ -463,6 +488,7 @@ function TestConvertF64FromUnsigned() {
assertEquals(26, _WASMEXP_.asmCompileRun(TestConvertF64FromUnsigned.toString()));
function TestModInt() {
"use asm";
......@@ -477,6 +503,7 @@ function TestModInt() {
assertEquals(-27, _WASMEXP_.asmCompileRun(TestModInt.toString()));
function TestModUnsignedInt() {
"use asm";
......@@ -491,6 +518,7 @@ function TestModUnsignedInt() {
assertEquals(8, _WASMEXP_.asmCompileRun(TestModUnsignedInt.toString()));
function TestModDouble() {
"use asm";
......@@ -508,6 +536,7 @@ function TestModDouble() {
assertEquals(28, _WASMEXP_.asmCompileRun(TestModDouble.toString()));
/*
TODO: Fix parsing of negative doubles
Fix code to use trunc instead of casts
......@@ -529,6 +558,7 @@ function TestModDoubleNegative() {
assertEquals(28, _WASMEXP_.asmCompileRun(TestModDoubleNegative.toString()));
*/
function TestNamedFunctions() {
"use asm";
......@@ -552,6 +582,7 @@ var module = _WASMEXP_.instantiateModuleFromAsm(TestNamedFunctions.toString());
module.init();
assertEquals(77.5, module.add());
function TestGlobalsWithInit() {
"use asm";
......@@ -569,6 +600,7 @@ var module = _WASMEXP_.instantiateModuleFromAsm(TestGlobalsWithInit.toString());
module.__init__();
assertEquals(77.5, module.add());
function TestForLoop() {
"use asm"
......@@ -586,6 +618,7 @@ function TestForLoop() {
assertEquals(54, _WASMEXP_.asmCompileRun(TestForLoop.toString()));
function TestForLoopWithoutInit() {
"use asm"
......@@ -603,6 +636,7 @@ function TestForLoopWithoutInit() {
assertEquals(100, _WASMEXP_.asmCompileRun(TestForLoopWithoutInit.toString()));
function TestForLoopWithoutCondition() {
"use asm"
......@@ -623,6 +657,7 @@ function TestForLoopWithoutCondition() {
assertEquals(66, _WASMEXP_.asmCompileRun(TestForLoopWithoutCondition.toString()));
function TestForLoopWithoutNext() {
"use asm"
......@@ -639,6 +674,7 @@ function TestForLoopWithoutNext() {
assertEquals(41, _WASMEXP_.asmCompileRun(TestForLoopWithoutNext.toString()));
function TestForLoopWithoutBody() {
"use asm"
......@@ -654,6 +690,7 @@ function TestForLoopWithoutBody() {
assertEquals(45, _WASMEXP_.asmCompileRun(TestForLoopWithoutBody.toString()));
function TestDoWhile() {
"use asm"
......@@ -672,6 +709,7 @@ function TestDoWhile() {
assertEquals(84, _WASMEXP_.asmCompileRun(TestDoWhile.toString()));
function TestConditional() {
"use asm"
......@@ -685,6 +723,7 @@ function TestConditional() {
assertEquals(41, _WASMEXP_.asmCompileRun(TestConditional.toString()));
function TestSwitch() {
"use asm"
......@@ -712,6 +751,7 @@ function TestSwitch() {
assertEquals(23, _WASMEXP_.asmCompileRun(TestSwitch.toString()));
function TestSwitchFallthrough() {
"use asm"
......@@ -733,6 +773,7 @@ function TestSwitchFallthrough() {
assertEquals(42, _WASMEXP_.asmCompileRun(TestSwitchFallthrough.toString()));
function TestNestedSwitch() {
"use asm"
......@@ -758,6 +799,7 @@ function TestNestedSwitch() {
assertEquals(43, _WASMEXP_.asmCompileRun(TestNestedSwitch.toString()));
function TestInitFunctionWithNoGlobals() {
"use asm";
function caller() {
......@@ -771,6 +813,7 @@ var module = _WASMEXP_.instantiateModuleFromAsm(
module.__init__();
assertEquals(51, module.caller());
function TestExportNameDifferentFromFunctionName() {
"use asm";
function caller() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment