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: --validate-asm --allow-natives-syntax | 5 // Flags: --validate-asm --allow-natives-syntax |
6 | 6 |
7 function assertValidAsm(func) { | 7 function assertValidAsm(func) { |
8 assertTrue(%IsAsmWasmCode(func)); | 8 assertTrue(%IsAsmWasmCode(func)); |
9 } | 9 } |
10 | 10 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 "use asm"; | 276 "use asm"; |
277 function foo() { return 123; } | 277 function foo() { return 123; } |
278 return { foo: foo }; | 278 return { foo: foo }; |
279 } | 279 } |
280 var heap = new ArrayBuffer(1024 * 1024); | 280 var heap = new ArrayBuffer(1024 * 1024); |
281 var ModuleBound = Module.bind(this, {}, {}, heap); | 281 var ModuleBound = Module.bind(this, {}, {}, heap); |
282 var m = ModuleBound(); | 282 var m = ModuleBound(); |
283 assertValidAsm(Module); | 283 assertValidAsm(Module); |
284 assertEquals(123, m.foo()); | 284 assertEquals(123, m.foo()); |
285 })(); | 285 })(); |
| 286 |
| 287 (function TestBadConstUnsignedReturn() { |
| 288 function Module() { |
| 289 "use asm"; |
| 290 const i = 0xffffffff; |
| 291 function foo() { return i; } |
| 292 return { foo: foo }; |
| 293 } |
| 294 var m = Module(); |
| 295 assertTrue(%IsNotAsmWasmCode(Module)); |
| 296 assertEquals(0xffffffff, m.foo()); |
| 297 })(); |
OLD | NEW |