| 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: --expose-wasm --validate-asm --fast-validate-asm |
| 6 | 6 |
| 7 (function TestCopyBug() { | 7 (function TestCopyBug() { |
| 8 // This was tickling a register allocation issue with | 8 // This was tickling a register allocation issue with |
| 9 // idiv in embenchen/copy. | 9 // idiv in embenchen/copy. |
| 10 function asmModule(){ | 10 function asmModule(){ |
| 11 'use asm'; | 11 'use asm'; |
| 12 function func() { | 12 function func() { |
| 13 var ret = 0; | 13 var ret = 0; |
| 14 var x = 1, y = 0, z = 0; | 14 var x = 1, y = 0, z = 0; |
| 15 var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0; | 15 var a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0; |
| 16 do { | 16 do { |
| 17 y = (x + 0) | 0; | 17 y = (x + 0) | 0; |
| 18 z = (y | 0) % 2 | 0; | 18 z = (y | 0) % 2 | 0; |
| 19 ret = (y + z + a + b + c + d + e + f + g) | 0; | 19 ret = (y + z + a + b + c + d + e + f + g) | 0; |
| 20 } while(0); | 20 } while(0); |
| 21 return ret | 0; | 21 return ret | 0; |
| 22 } | 22 } |
| 23 return { func: func }; | 23 return { func: func }; |
| 24 } | 24 } |
| 25 var wasm = asmModule(); | 25 var wasm = asmModule(); |
| 26 var js = eval('(' + asmModule.toString().replace('use asm', '') + ')')(); | 26 var js = eval('(' + asmModule.toString().replace('use asm', '') + ')')(); |
| 27 assertEquals(js.func(), wasm.func()); | 27 assertEquals(js.func(), wasm.func()); |
| 28 })(); | 28 })(); |
| OLD | NEW |