| 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 // Note that this test file contains tests that explicitly check modules are | 7 // Note that this test file contains tests that explicitly check modules are |
| 8 // valid asm.js and then break them with invalid instantiation arguments. If | 8 // valid asm.js and then break them with invalid instantiation arguments. If |
| 9 // this script is run more than once (e.g. --stress-opt) then modules remain | 9 // this script is run more than once (e.g. --stress-opt) then modules remain |
| 10 // broken in the second run and assertions would fail. We prevent re-runs. | 10 // broken in the second run and assertions would fail. We prevent re-runs. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 x = x | true; | 309 x = x | true; |
| 310 return x; | 310 return x; |
| 311 } | 311 } |
| 312 return { foo: foo }; | 312 return { foo: foo }; |
| 313 } | 313 } |
| 314 var m = Module(); | 314 var m = Module(); |
| 315 assertFalse(%IsAsmWasmCode(Module)); | 315 assertFalse(%IsAsmWasmCode(Module)); |
| 316 assertEquals(3, m.foo(3)); | 316 assertEquals(3, m.foo(3)); |
| 317 })(); | 317 })(); |
| 318 | 318 |
| 319 (function TestBadImport() { |
| 320 function Module(stdlib) { |
| 321 "use asm"; |
| 322 var set = 0; |
| 323 var foo = stdlib[set]; |
| 324 return {}; |
| 325 } |
| 326 var m = Module(this); |
| 327 assertFalse(%IsAsmWasmCode(Module)); |
| 328 })(); |
| 329 |
| 319 (function TestBadishBooleanExprAnnotation() { | 330 (function TestBadishBooleanExprAnnotation() { |
| 320 function Module() { | 331 function Module() { |
| 321 "use asm"; | 332 "use asm"; |
| 322 function foo(x) { | 333 function foo(x) { |
| 323 x = x | 0; | 334 x = x | 0; |
| 324 x = (x + 1) | false; | 335 x = (x + 1) | false; |
| 325 return x | 0; | 336 return x | 0; |
| 326 } | 337 } |
| 327 return { foo: foo }; | 338 return { foo: foo }; |
| 328 } | 339 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 345 return 43; | 356 return 43; |
| 346 } | 357 } |
| 347 return 0; | 358 return 0; |
| 348 } | 359 } |
| 349 return { foo: foo }; | 360 return { foo: foo }; |
| 350 } | 361 } |
| 351 var m = Module(); | 362 var m = Module(); |
| 352 assertFalse(%IsAsmWasmCode(Module)); | 363 assertFalse(%IsAsmWasmCode(Module)); |
| 353 assertEquals(43, m.foo(3)); | 364 assertEquals(43, m.foo(3)); |
| 354 })(); | 365 })(); |
| OLD | NEW |