| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-wasm | 5 // Flags: --validate-asm --allow-natives-syntax |
| 6 | 6 |
| 7 var __v_5 = {}; | 7 var __v_5 = {}; |
| 8 var __v_35 = {}; | 8 var __v_35 = {}; |
| 9 var __v_44 = {}; | 9 var __v_44 = {}; |
| 10 var __v_43 = {}; | 10 var __v_43 = {}; |
| 11 | 11 |
| 12 try { | 12 try { |
| 13 __v_1 = 1; | 13 __v_1 = 1; |
| 14 __v_2 = { | 14 __v_2 = { |
| 15 get: function() { return function() {} }, | 15 get: function() { return function() {} }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 29 var __v_2 = __v_1.replace(new RegExp("use asm"), ""); | 29 var __v_2 = __v_1.replace(new RegExp("use asm"), ""); |
| 30 var __v_39 = {Math: Math}; | 30 var __v_39 = {Math: Math}; |
| 31 var __v_4 = eval("(" + __v_2 + ")")(__v_3); | 31 var __v_4 = eval("(" + __v_2 + ")")(__v_3); |
| 32 print("Testing " + asmfunc.name + " (js)..."); | 32 print("Testing " + asmfunc.name + " (js)..."); |
| 33 __v_44.valueOf = __v_43; | 33 __v_44.valueOf = __v_43; |
| 34 expect(__v_4); | 34 expect(__v_4); |
| 35 print("Testing " + asmfunc.name + " (asm.js)..."); | 35 print("Testing " + asmfunc.name + " (asm.js)..."); |
| 36 var __v_5 = asmfunc(__v_3); | 36 var __v_5 = asmfunc(__v_3); |
| 37 expect(__v_5); | 37 expect(__v_5); |
| 38 print("Testing " + asmfunc.name + " (wasm)..."); | 38 print("Testing " + asmfunc.name + " (wasm)..."); |
| 39 var __v_6 = Wasm.instantiateModuleFromAsm(__v_1, {}, __v_3); | 39 var module_func = eval(__v_1); |
| 40 var __v_6 = module_func({}, __v_3); |
| 41 assertTrue(%IsAsmWasmCode(module_func)); |
| 40 expect(__v_6); | 42 expect(__v_6); |
| 41 } | 43 } |
| 42 function __f_2() { | 44 function __f_2() { |
| 43 "use asm"; | 45 "use asm"; |
| 44 function __f_3() { return 0; } | 46 function __f_3() { return 0; } |
| 45 function __f_4() { return 1; } | 47 function __f_4() { return 1; } |
| 46 function __f_5() { return 4; } | 48 function __f_5() { return 4; } |
| 47 function __f_6() { return 64; } | 49 function __f_6() { return 64; } |
| 48 function __f_7() { return 137; } | 50 function __f_7() { return 137; } |
| 49 function __f_8() { return 128; } | 51 function __f_8() { return 128; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 assertEquals(1, module.__f_4()); | 62 assertEquals(1, module.__f_4()); |
| 61 assertEquals(4, module.__f_5()); | 63 assertEquals(4, module.__f_5()); |
| 62 assertEquals(64, module.__f_6()); | 64 assertEquals(64, module.__f_6()); |
| 63 assertEquals(128, module.__f_8()); | 65 assertEquals(128, module.__f_8()); |
| 64 assertEquals(-1, module.__f_9()); | 66 assertEquals(-1, module.__f_9()); |
| 65 assertEquals(1000, module.__f_10()); | 67 assertEquals(1000, module.__f_10()); |
| 66 assertEquals(2000000, module.__f_11()); | 68 assertEquals(2000000, module.__f_11()); |
| 67 assertEquals(2147483647, module.__f_12()); | 69 assertEquals(2147483647, module.__f_12()); |
| 68 }); | 70 }); |
| 69 } catch(e) { print("Caught: " + e); } | 71 } catch(e) { print("Caught: " + e); } |
| OLD | NEW |