| 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 | 
|    6  |    6  | 
|    7 function WrapInAsmModule(func) { |    7 function WrapInAsmModule(func) { | 
|    8   function MODULE_NAME(stdlib) { |    8   function MODULE_NAME(stdlib) { | 
|    9     "use asm"; |    9     "use asm"; | 
|   10     var imul = stdlib.Math.imul; |   10     var imul = stdlib.Math.imul; | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   60  |   60  | 
|   61 function i32_mul(a, b) { |   61 function i32_mul(a, b) { | 
|   62   a = a | 0; |   62   a = a | 0; | 
|   63   b = b | 0; |   63   b = b | 0; | 
|   64   return imul(a, b) | 0; |   64   return imul(a, b) | 0; | 
|   65 } |   65 } | 
|   66  |   66  | 
|   67 function i32_div(a, b) { |   67 function i32_div(a, b) { | 
|   68   a = a | 0; |   68   a = a | 0; | 
|   69   b = b | 0; |   69   b = b | 0; | 
|   70   return (a / b) | 0; |   70   return ((a | 0) / (b | 0)) | 0; | 
|   71 } |   71 } | 
|   72  |   72  | 
|   73 function i32_mod(a, b) { |   73 function i32_mod(a, b) { | 
|   74   a = a | 0; |   74   a = a | 0; | 
|   75   b = b | 0; |   75   b = b | 0; | 
|   76   return (a % b) | 0; |   76   return ((a | 0) % (b | 0)) | 0; | 
|   77 } |   77 } | 
|   78  |   78  | 
|   79 function i32_and(a, b) { |   79 function i32_and(a, b) { | 
|   80   a = a | 0; |   80   a = a | 0; | 
|   81   b = b | 0; |   81   b = b | 0; | 
|   82   return (a & b) | 0; |   82   return (a & b) | 0; | 
|   83 } |   83 } | 
|   84  |   84  | 
|   85 function i32_or(a, b) { |   85 function i32_or(a, b) { | 
|   86   a = a | 0; |   86   a = a | 0; | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  243         for (a of inputs) { |  243         for (a of inputs) { | 
|  244           for (b of inputs) { |  244           for (b of inputs) { | 
|  245             assertEquals(func(a, b), module.main(a, b)); |  245             assertEquals(func(a, b), module.main(a, b)); | 
|  246           } |  246           } | 
|  247         } |  247         } | 
|  248       } |  248       } | 
|  249     }); |  249     }); | 
|  250   } |  250   } | 
|  251  |  251  | 
|  252 })(); |  252 })(); | 
| OLD | NEW |