Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Flags: --expose-wasm |
| 6 | |
| 7 | (function TestCopyBug() { |
| 8 | // This was tickling a register allocation issue with |
| 9 | // idiv in embenchen/copy. |
| 10 | function asmModule(){ |
| 11 | 'use asm'; |
| 12 | function func() { |
| 13 | var ret = 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; |
| 16 | do { |
| 17 | y = (x + 0) | 0; |
| 18 | z = (y | 0) % 2 | 0; |
| 19 | ret = (y + z + a + b + c + d + e + f + g) | 0; |
| 20 | } while(0); |
| 21 | return ret | 0; |
| 22 | } |
| 23 | return { func: func }; |
| 24 | } |
| 25 | var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString()); |
| 26 | assertEquals(asmModule().func(), wasm.func()); |
| 27 | })(); |