| 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 // Used for encoding f32 and double constants to bits. | 5 // Used for encoding f32 and double constants to bits. |
| 6 let __buffer = new ArrayBuffer(8); | 6 let __buffer = new ArrayBuffer(8); |
| 7 let byte_view = new Int8Array(__buffer); | 7 let byte_view = new Int8Array(__buffer); |
| 8 let f32_view = new Float32Array(__buffer); | 8 let f32_view = new Float32Array(__buffer); |
| 9 let f64_view = new Float64Array(__buffer); | 9 let f64_view = new Float64Array(__buffer); |
| 10 | 10 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 let buffer = new ArrayBuffer(bytes.length); | 540 let buffer = new ArrayBuffer(bytes.length); |
| 541 let view = new Uint8Array(buffer); | 541 let view = new Uint8Array(buffer); |
| 542 for (let i = 0; i < bytes.length; i++) { | 542 for (let i = 0; i < bytes.length; i++) { |
| 543 let val = bytes[i]; | 543 let val = bytes[i]; |
| 544 if ((typeof val) == "string") val = val.charCodeAt(0); | 544 if ((typeof val) == "string") val = val.charCodeAt(0); |
| 545 view[i] = val | 0; | 545 view[i] = val | 0; |
| 546 } | 546 } |
| 547 return buffer; | 547 return buffer; |
| 548 } | 548 } |
| 549 | 549 |
| 550 instantiate(...args) { | 550 instantiate(ffi) { |
| 551 let module = new WebAssembly.Module(this.toBuffer()); | 551 let module = new WebAssembly.Module(this.toBuffer()); |
| 552 let instance = new WebAssembly.Instance(module, ...args); | 552 let instance = new WebAssembly.Instance(module, ffi); |
| 553 return instance; | 553 return instance; |
| 554 } | 554 } |
| 555 } | 555 } |
| OLD | NEW |