Commit 995c9fe3 authored by titzer's avatar titzer Committed by Commit bot

[wasm] Rename the WASM object to _WASMEXP_.

R=ahaas@chromium.org,bradnelson@chromium.org
LOG=Y
BUG=chromium:575167

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

Cr-Commit-Position: refs/heads/master@{#33251}
parent d3fe473b
......@@ -314,7 +314,7 @@ void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) {
// Bind the WASM object.
Factory* factory = isolate->factory();
Handle<String> name = v8_str(isolate, "WASM");
Handle<String> name = v8_str(isolate, "_WASMEXP_");
Handle<JSFunction> cons = factory->NewFunction(name);
JSFunction::SetInstancePrototype(
cons, Handle<Object>(global->native_context()->initial_object_prototype(),
......
......@@ -8,4 +8,5 @@ function f() {
"use asm";
}
assertThrows(function() { WASM.asmCompileRun(f.toString()); });
assertFalse(_WASMEXP_ == undefined);
assertThrows(function() { _WASMEXP_.asmCompileRun(f.toString()); });
......@@ -35,7 +35,7 @@ function IntTest() {
return {caller: caller};
}
assertEquals(101, WASM.asmCompileRun(IntTest.toString()));
assertEquals(101, _WASMEXP_.asmCompileRun(IntTest.toString()));
function Float64Test() {
"use asm";
......@@ -59,7 +59,7 @@ function Float64Test() {
return {caller: caller};
}
assertEquals(1, WASM.asmCompileRun(Float64Test.toString()));
assertEquals(1, _WASMEXP_.asmCompileRun(Float64Test.toString()));
function BadModule() {
"use asm";
......@@ -78,7 +78,7 @@ function BadModule() {
}
assertThrows(function() {
WASM.asmCompileRun(BadModule.toString())
_WASMEXP_.asmCompileRun(BadModule.toString())
});
function TestReturnInBlock() {
......@@ -98,7 +98,7 @@ function TestReturnInBlock() {
return {caller: caller};
}
assertEquals(1, WASM.asmCompileRun(TestReturnInBlock.toString()));
assertEquals(1, _WASMEXP_.asmCompileRun(TestReturnInBlock.toString()));
function TestWhileSimple() {
"use asm";
......@@ -114,7 +114,7 @@ function TestWhileSimple() {
return {caller: caller};
}
assertEquals(5, WASM.asmCompileRun(TestWhileSimple.toString()));
assertEquals(5, _WASMEXP_.asmCompileRun(TestWhileSimple.toString()));
function TestWhileWithoutBraces() {
"use asm";
......@@ -129,7 +129,7 @@ function TestWhileWithoutBraces() {
return {caller: caller};
}
assertEquals(4, WASM.asmCompileRun(TestWhileWithoutBraces.toString()));
assertEquals(4, _WASMEXP_.asmCompileRun(TestWhileWithoutBraces.toString()));
function TestReturnInWhile() {
"use asm";
......@@ -146,7 +146,7 @@ function TestReturnInWhile() {
return {caller: caller};
}
assertEquals(6, WASM.asmCompileRun(TestReturnInWhile.toString()));
assertEquals(6, _WASMEXP_.asmCompileRun(TestReturnInWhile.toString()));
function TestReturnInWhileWithoutBraces() {
"use asm";
......@@ -161,7 +161,7 @@ function TestReturnInWhileWithoutBraces() {
return {caller: caller};
}
assertEquals(7, WASM.asmCompileRun(TestReturnInWhileWithoutBraces.toString()));
assertEquals(7, _WASMEXP_.asmCompileRun(TestReturnInWhileWithoutBraces.toString()));
function TestBreakInWhile() {
"use asm";
......@@ -176,7 +176,7 @@ function TestBreakInWhile() {
return {caller: caller};
}
assertEquals(8, WASM.asmCompileRun(TestBreakInWhile.toString()));
assertEquals(8, _WASMEXP_.asmCompileRun(TestBreakInWhile.toString()));
function TestBreakInNestedWhile() {
"use asm";
......@@ -198,7 +198,7 @@ function TestBreakInNestedWhile() {
return {caller: caller};
}
assertEquals(9, WASM.asmCompileRun(TestBreakInNestedWhile.toString()));
assertEquals(9, _WASMEXP_.asmCompileRun(TestBreakInNestedWhile.toString()));
function TestBreakInBlock() {
"use asm";
......@@ -218,7 +218,7 @@ function TestBreakInBlock() {
return {caller: caller};
}
assertEquals(10, WASM.asmCompileRun(TestBreakInBlock.toString()));
assertEquals(10, _WASMEXP_.asmCompileRun(TestBreakInBlock.toString()));
function TestBreakInNamedWhile() {
"use asm";
......@@ -237,7 +237,7 @@ function TestBreakInNamedWhile() {
return {caller: caller};
}
assertEquals(11, WASM.asmCompileRun(TestBreakInNamedWhile.toString()));
assertEquals(11, _WASMEXP_.asmCompileRun(TestBreakInNamedWhile.toString()));
function TestContinue() {
"use asm";
......@@ -258,7 +258,7 @@ function TestContinue() {
return {caller: caller};
}
assertEquals(-5, WASM.asmCompileRun(TestContinue.toString()));
assertEquals(-5, _WASMEXP_.asmCompileRun(TestContinue.toString()));
function TestContinueInNamedWhile() {
"use asm";
......@@ -284,7 +284,7 @@ function TestContinueInNamedWhile() {
return {caller: caller};
}
assertEquals(20, WASM.asmCompileRun(TestContinueInNamedWhile.toString()));
assertEquals(20, _WASMEXP_.asmCompileRun(TestContinueInNamedWhile.toString()));
function TestNot() {
"use asm";
......@@ -297,7 +297,7 @@ function TestNot() {
return {caller:caller};
}
assertEquals(1, WASM.asmCompileRun(TestNot.toString()));
assertEquals(1, _WASMEXP_.asmCompileRun(TestNot.toString()));
function TestNotEquals() {
"use asm";
......@@ -313,7 +313,7 @@ function TestNotEquals() {
return {caller:caller};
}
assertEquals(21, WASM.asmCompileRun(TestNotEquals.toString()));
assertEquals(21, _WASMEXP_.asmCompileRun(TestNotEquals.toString()));
function TestUnsignedComparison() {
"use asm";
......@@ -329,7 +329,7 @@ function TestUnsignedComparison() {
return {caller:caller};
}
assertEquals(22, WASM.asmCompileRun(TestUnsignedComparison.toString()));
assertEquals(22, _WASMEXP_.asmCompileRun(TestUnsignedComparison.toString()));
function TestMixedAdd() {
"use asm";
......@@ -350,7 +350,7 @@ function TestMixedAdd() {
return {caller:caller};
}
assertEquals(23, WASM.asmCompileRun(TestMixedAdd.toString()));
assertEquals(23, _WASMEXP_.asmCompileRun(TestMixedAdd.toString()));
function TestInt32HeapAccess(stdlib, foreign, buffer) {
"use asm";
......@@ -368,7 +368,7 @@ function TestInt32HeapAccess(stdlib, foreign, buffer) {
return {caller: caller};
}
assertEquals(7, WASM.asmCompileRun(TestInt32HeapAccess.toString()));
assertEquals(7, _WASMEXP_.asmCompileRun(TestInt32HeapAccess.toString()));
function TestHeapAccessIntTypes() {
var types = [
......@@ -383,7 +383,7 @@ function TestHeapAccessIntTypes() {
var code = TestInt32HeapAccess.toString();
code = code.replace('Int32Array', types[i][0]);
code = code.replace(/>> 2/g, types[i][1]);
assertEquals(7, WASM.asmCompileRun(code));
assertEquals(7, _WASMEXP_.asmCompileRun(code));
}
}
......@@ -411,7 +411,7 @@ function TestFloatHeapAccess(stdlib, foreign, buffer) {
return {caller: caller};
}
assertEquals(1, WASM.asmCompileRun(TestFloatHeapAccess.toString()));
assertEquals(1, _WASMEXP_.asmCompileRun(TestFloatHeapAccess.toString()));
function TestConvertI32() {
"use asm";
......@@ -427,7 +427,7 @@ function TestConvertI32() {
return {caller:caller};
}
assertEquals(24, WASM.asmCompileRun(TestConvertI32.toString()));
assertEquals(24, _WASMEXP_.asmCompileRun(TestConvertI32.toString()));
function TestConvertF64FromInt() {
"use asm";
......@@ -443,7 +443,7 @@ function TestConvertF64FromInt() {
return {caller:caller};
}
assertEquals(25, WASM.asmCompileRun(TestConvertF64FromInt.toString()));
assertEquals(25, _WASMEXP_.asmCompileRun(TestConvertF64FromInt.toString()));
function TestConvertF64FromUnsigned() {
"use asm";
......@@ -461,7 +461,7 @@ function TestConvertF64FromUnsigned() {
return {caller:caller};
}
assertEquals(26, WASM.asmCompileRun(TestConvertF64FromUnsigned.toString()));
assertEquals(26, _WASMEXP_.asmCompileRun(TestConvertF64FromUnsigned.toString()));
function TestModInt() {
"use asm";
......@@ -475,7 +475,7 @@ function TestModInt() {
return {caller:caller};
}
assertEquals(-27, WASM.asmCompileRun(TestModInt.toString()));
assertEquals(-27, _WASMEXP_.asmCompileRun(TestModInt.toString()));
function TestModUnsignedInt() {
"use asm";
......@@ -489,7 +489,7 @@ function TestModUnsignedInt() {
return {caller:caller};
}
assertEquals(8, WASM.asmCompileRun(TestModUnsignedInt.toString()));
assertEquals(8, _WASMEXP_.asmCompileRun(TestModUnsignedInt.toString()));
function TestModDouble() {
"use asm";
......@@ -506,7 +506,7 @@ function TestModDouble() {
return {caller:caller};
}
assertEquals(28, WASM.asmCompileRun(TestModDouble.toString()));
assertEquals(28, _WASMEXP_.asmCompileRun(TestModDouble.toString()));
/*
TODO: Fix parsing of negative doubles
......@@ -526,7 +526,7 @@ function TestModDoubleNegative() {
return {caller:caller};
}
assertEquals(28, WASM.asmCompileRun(TestModDoubleNegative.toString()));
assertEquals(28, _WASMEXP_.asmCompileRun(TestModDoubleNegative.toString()));
*/
function TestNamedFunctions() {
......@@ -548,7 +548,7 @@ function TestNamedFunctions() {
add:add};
}
var module = WASM.instantiateModuleFromAsm(TestNamedFunctions.toString());
var module = _WASMEXP_.instantiateModuleFromAsm(TestNamedFunctions.toString());
module.init();
assertEquals(77.5, module.add());
......@@ -565,7 +565,7 @@ function TestGlobalsWithInit() {
return {add:add};
}
var module = WASM.instantiateModuleFromAsm(TestGlobalsWithInit.toString());
var module = _WASMEXP_.instantiateModuleFromAsm(TestGlobalsWithInit.toString());
module.__init__();
assertEquals(77.5, module.add());
......@@ -584,7 +584,7 @@ function TestForLoop() {
return {caller:caller};
}
assertEquals(54, WASM.asmCompileRun(TestForLoop.toString()));
assertEquals(54, _WASMEXP_.asmCompileRun(TestForLoop.toString()));
function TestForLoopWithoutInit() {
"use asm"
......@@ -601,7 +601,7 @@ function TestForLoopWithoutInit() {
return {caller:caller};
}
assertEquals(100, WASM.asmCompileRun(TestForLoopWithoutInit.toString()));
assertEquals(100, _WASMEXP_.asmCompileRun(TestForLoopWithoutInit.toString()));
function TestForLoopWithoutCondition() {
"use asm"
......@@ -621,7 +621,7 @@ function TestForLoopWithoutCondition() {
return {caller:caller};
}
assertEquals(66, WASM.asmCompileRun(TestForLoopWithoutCondition.toString()));
assertEquals(66, _WASMEXP_.asmCompileRun(TestForLoopWithoutCondition.toString()));
function TestForLoopWithoutNext() {
"use asm"
......@@ -637,7 +637,7 @@ function TestForLoopWithoutNext() {
return {caller:caller};
}
assertEquals(41, WASM.asmCompileRun(TestForLoopWithoutNext.toString()));
assertEquals(41, _WASMEXP_.asmCompileRun(TestForLoopWithoutNext.toString()));
function TestForLoopWithoutBody() {
"use asm"
......@@ -652,7 +652,7 @@ function TestForLoopWithoutBody() {
return {caller:caller};
}
assertEquals(45, WASM.asmCompileRun(TestForLoopWithoutBody.toString()));
assertEquals(45, _WASMEXP_.asmCompileRun(TestForLoopWithoutBody.toString()));
function TestDoWhile() {
"use asm"
......@@ -670,7 +670,7 @@ function TestDoWhile() {
return {caller:caller};
}
assertEquals(84, WASM.asmCompileRun(TestDoWhile.toString()));
assertEquals(84, _WASMEXP_.asmCompileRun(TestDoWhile.toString()));
function TestConditional() {
"use asm"
......
......@@ -10,7 +10,7 @@ var module = (function () {
var kBodySize = 5;
var kNameOffset = 21 + kBodySize + 1;
return WASM.instantiateModule(bytes(
return _WASMEXP_.instantiateModule(bytes(
// -- memory
kDeclMemory,
12, 12, 1,
......@@ -64,7 +64,7 @@ var module = (function() {
var kBodySize = 1;
var kNameOffset2 = 19 + kBodySize + 1;
return WASM.instantiateModule(bytes(
return _WASMEXP_.instantiateModule(bytes(
// -- memory
kDeclMemory,
12, 12, 1,
......@@ -136,7 +136,7 @@ assertEquals(undefined, module.nop());
'f', 'l', 't', 0 // name
);
var module = WASM.instantiateModule(data);
var module = _WASMEXP_.instantiateModule(data);
assertEquals("function", typeof module.flt);
assertEquals(1, module.flt(-2, -1));
......
......@@ -28,4 +28,4 @@ var data = bytes(
'm', 'a', 'i', 'n', 0 // name
);
assertEquals(kReturnValue, WASM.compileRun(data));
assertEquals(kReturnValue, _WASMEXP_.compileRun(data));
......@@ -52,7 +52,7 @@ function makeDivRem(opcode) {
'm', 'a', 'i', 'n', 0 // --
);
var module = WASM.instantiateModule(data);
var module = _WASMEXP_.instantiateModule(data);
assertEquals("function", typeof module.main);
......
......@@ -38,7 +38,7 @@ function testCallFFI(ffi) {
);
print("instantiate FFI");
var module = WASM.instantiateModule(data, ffi);
var module = _WASMEXP_.instantiateModule(data, ffi);
}
// everything is good.
......
......@@ -38,7 +38,7 @@ function testCallFFI(func, check) {
'm', 'a', 'i', 'n', 0 // --
);
var module = WASM.instantiateModule(data, ffi);
var module = _WASMEXP_.instantiateModule(data, ffi);
assertEquals("function", typeof module.main);
......@@ -236,7 +236,7 @@ function testCallBinopVoid(type, func, check) {
'm', 'a', 'i', 'n', 0 // --
);
var module = WASM.instantiateModule(data, ffi);
var module = _WASMEXP_.instantiateModule(data, ffi);
assertEquals("function", typeof module.main);
......@@ -320,7 +320,7 @@ function testCallPrint() {
'm', 'a', 'i', 'n', 0 // --
);
var module = WASM.instantiateModule(data, ffi);
var module = _WASMEXP_.instantiateModule(data, ffi);
assertEquals("function", typeof module.main);
......
......@@ -19,7 +19,7 @@ var module = (function () {
var ffi = new Object();
ffi.add = (function(a, b) { return a + b | 0; });
return WASM.instantiateModule(bytes(
return _WASMEXP_.instantiateModule(bytes(
// -- signatures
kDeclSignatures, 2,
2, kAstI32, kAstI32, kAstI32, // int, int -> int
......
......@@ -31,7 +31,7 @@ var data = bytes(
'm', 'a', 'i', 'n', 0 // name
);
var module = WASM.instantiateModule(data);
var module = _WASMEXP_.instantiateModule(data);
// Check the module exists.
assertFalse(module === undefined);
......
......@@ -45,7 +45,7 @@ function genModule(memory) {
'm', 'a', 'i', 'n', 0 // --
);
return WASM.instantiateModule(data, null, memory);
return _WASMEXP_.instantiateModule(data, null, memory);
}
function testPokeMemory() {
......@@ -159,7 +159,7 @@ function testOOBThrows() {
);
var memory = null;
var module = WASM.instantiateModule(data, null, memory);
var module = _WASMEXP_.instantiateModule(data, null, memory);
var offset;
......
......@@ -35,7 +35,7 @@ function testSelect2(type) {
's','e','l','e','c','t',0 // name
);
var module = WASM.instantiateModule(data);
var module = _WASMEXP_.instantiateModule(data);
assertEquals("function", typeof module.select);
runSelect2(module, which, 99, 97);
......@@ -111,7 +111,7 @@ function testSelect10(type) {
's','e','l','e','c','t',0 // name
);
var module = WASM.instantiateModule(data);
var module = _WASMEXP_.instantiateModule(data);
assertEquals("function", typeof module.select);
runSelect10(module, which, 99, 97);
......
......@@ -38,7 +38,7 @@ function makeFFI(func) {
'm', 'a', 'i', 'n', 0 // --
);
var module = WASM.instantiateModule(data, ffi);
var module = _WASMEXP_.instantiateModule(data, ffi);
assertEquals("function", typeof module.main);
......
......@@ -15,7 +15,7 @@ var module = (function () {
var ffi = new Object();
ffi.add = (function(a, b) { return a + b | 0; });
return WASM.instantiateModule(bytes(
return _WASMEXP_.instantiateModule(bytes(
// -- signatures
kDeclSignatures, 1,
0, kAstStmt, // void -> void
......
......@@ -6,13 +6,13 @@
function Foo() { }
assertThrows(function() { WASM.verifyFunction(); })
assertThrows(function() { WASM.verifyFunction(0); })
assertThrows(function() { WASM.verifyFunction("s"); })
assertThrows(function() { WASM.verifyFunction(undefined); })
assertThrows(function() { WASM.verifyFunction(1.1); })
assertThrows(function() { WASM.verifyFunction(1/0); })
assertThrows(function() { WASM.verifyFunction(null); })
assertThrows(function() { WASM.verifyFunction(new Foo()); })
assertThrows(function() { WASM.verifyFunction(new ArrayBuffer(0)); })
assertThrows(function() { WASM.verifyFunction(new ArrayBuffer(140000)); })
assertThrows(function() { _WASMEXP_.verifyFunction(); })
assertThrows(function() { _WASMEXP_.verifyFunction(0); })
assertThrows(function() { _WASMEXP_.verifyFunction("s"); })
assertThrows(function() { _WASMEXP_.verifyFunction(undefined); })
assertThrows(function() { _WASMEXP_.verifyFunction(1.1); })
assertThrows(function() { _WASMEXP_.verifyFunction(1/0); })
assertThrows(function() { _WASMEXP_.verifyFunction(null); })
assertThrows(function() { _WASMEXP_.verifyFunction(new Foo()); })
assertThrows(function() { _WASMEXP_.verifyFunction(new ArrayBuffer(0)); })
assertThrows(function() { _WASMEXP_.verifyFunction(new ArrayBuffer(140000)); })
......@@ -16,7 +16,7 @@ try {
kExprNop // body
);
WASM.verifyFunction(data);
_WASMEXP_.verifyFunction(data);
print("ok");
} catch (e) {
assertTrue(false);
......@@ -34,7 +34,7 @@ try {
kExprBlock, 2, kExprNop, kExprNop // body
);
WASM.verifyFunction(data);
_WASMEXP_.verifyFunction(data);
print("not ok");
} catch (e) {
print("ok: " + e);
......
......@@ -6,13 +6,13 @@
function Foo() { }
assertThrows(function() { WASM.verifyModule(); })
assertThrows(function() { WASM.verifyModule(0); })
assertThrows(function() { WASM.verifyModule("s"); })
assertThrows(function() { WASM.verifyModule(undefined); })
assertThrows(function() { WASM.verifyModule(1.1); })
assertThrows(function() { WASM.verifyModule(1/0); })
assertThrows(function() { WASM.verifyModule(null); })
assertThrows(function() { WASM.verifyModule(new Foo()); })
assertThrows(function() { WASM.verifyModule(new ArrayBuffer(0)); })
assertThrows(function() { WASM.verifyModule(new ArrayBuffer(7)); })
assertThrows(function() { _WASMEXP_.verifyModule(); })
assertThrows(function() { _WASMEXP_.verifyModule(0); })
assertThrows(function() { _WASMEXP_.verifyModule("s"); })
assertThrows(function() { _WASMEXP_.verifyModule(undefined); })
assertThrows(function() { _WASMEXP_.verifyModule(1.1); })
assertThrows(function() { _WASMEXP_.verifyModule(1/0); })
assertThrows(function() { _WASMEXP_.verifyModule(null); })
assertThrows(function() { _WASMEXP_.verifyModule(new Foo()); })
assertThrows(function() { _WASMEXP_.verifyModule(new ArrayBuffer(0)); })
assertThrows(function() { _WASMEXP_.verifyModule(new ArrayBuffer(7)); })
......@@ -4,8 +4,8 @@
// Flags: --expose-wasm
assertFalse(undefined === WASM);
assertFalse(undefined == WASM);
assertEquals("function", typeof WASM.verifyModule);
assertEquals("function", typeof WASM.verifyFunction);
assertEquals("function", typeof WASM.compileRun);
assertFalse(undefined === _WASMEXP_);
assertFalse(undefined == _WASMEXP_);
assertEquals("function", typeof _WASMEXP_.verifyModule);
assertEquals("function", typeof _WASMEXP_.verifyFunction);
assertEquals("function", typeof _WASMEXP_.compileRun);
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