| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return this; | 96 return this; |
| 97 } | 97 } |
| 98 | 98 |
| 99 addBody(body) { | 99 addBody(body) { |
| 100 this.body = body; | 100 this.body = body; |
| 101 // Automatically add the end for the function block to the body. | 101 // Automatically add the end for the function block to the body. |
| 102 body.push(kExprEnd); | 102 body.push(kExprEnd); |
| 103 return this; | 103 return this; |
| 104 } | 104 } |
| 105 | 105 |
| 106 addBodyWithEnd(body) { |
| 107 this.body = body; |
| 108 return this; |
| 109 } |
| 110 |
| 106 addLocals(locals) { | 111 addLocals(locals) { |
| 107 this.locals = locals; | 112 this.locals = locals; |
| 108 return this; | 113 return this; |
| 109 } | 114 } |
| 110 | 115 |
| 111 end() { | 116 end() { |
| 112 return this.module; | 117 return this.module; |
| 113 } | 118 } |
| 114 } | 119 } |
| 115 | 120 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 569 } |
| 565 return buffer; | 570 return buffer; |
| 566 } | 571 } |
| 567 | 572 |
| 568 instantiate(ffi) { | 573 instantiate(ffi) { |
| 569 let module = new WebAssembly.Module(this.toBuffer()); | 574 let module = new WebAssembly.Module(this.toBuffer()); |
| 570 let instance = new WebAssembly.Instance(module, ffi); | 575 let instance = new WebAssembly.Instance(module, ffi); |
| 571 return instance; | 576 return instance; |
| 572 } | 577 } |
| 573 } | 578 } |
| OLD | NEW |