| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_WASM_WASM_MODULE_BUILDER_H_ | 5 #ifndef V8_WASM_WASM_MODULE_BUILDER_H_ |
| 6 #define V8_WASM_WASM_MODULE_BUILDER_H_ | 6 #define V8_WASM_WASM_MODULE_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/signature.h" | 8 #include "src/signature.h" |
| 9 #include "src/zone/zone-containers.h" | 9 #include "src/zone/zone-containers.h" |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 byte* end_; | 114 byte* end_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 class WasmModuleBuilder; | 117 class WasmModuleBuilder; |
| 118 | 118 |
| 119 class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject { | 119 class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject { |
| 120 public: | 120 public: |
| 121 // Building methods. | 121 // Building methods. |
| 122 void SetSignature(FunctionSig* sig); | 122 void SetSignature(FunctionSig* sig); |
| 123 uint32_t AddLocal(ValueType type); | 123 uint32_t AddLocal(ValueType type); |
| 124 void EmitVarInt(int32_t val); |
| 124 void EmitVarUint(uint32_t val); | 125 void EmitVarUint(uint32_t val); |
| 125 void EmitCode(const byte* code, uint32_t code_size); | 126 void EmitCode(const byte* code, uint32_t code_size); |
| 126 void Emit(WasmOpcode opcode); | 127 void Emit(WasmOpcode opcode); |
| 127 void EmitGetLocal(uint32_t index); | 128 void EmitGetLocal(uint32_t index); |
| 128 void EmitSetLocal(uint32_t index); | 129 void EmitSetLocal(uint32_t index); |
| 129 void EmitTeeLocal(uint32_t index); | 130 void EmitTeeLocal(uint32_t index); |
| 130 void EmitI32Const(int32_t val); | 131 void EmitI32Const(int32_t val); |
| 131 void EmitWithU8(WasmOpcode opcode, const byte immediate); | 132 void EmitWithU8(WasmOpcode opcode, const byte immediate); |
| 132 void EmitWithU8U8(WasmOpcode opcode, const byte imm1, const byte imm2); | 133 void EmitWithU8U8(WasmOpcode opcode, const byte imm1, const byte imm2); |
| 134 void EmitWithVarInt(WasmOpcode opcode, int32_t immediate); |
| 133 void EmitWithVarUint(WasmOpcode opcode, uint32_t immediate); | 135 void EmitWithVarUint(WasmOpcode opcode, uint32_t immediate); |
| 134 void EmitDirectCallIndex(uint32_t index); | 136 void EmitDirectCallIndex(uint32_t index); |
| 135 void ExportAs(Vector<const char> name); | 137 void ExportAs(Vector<const char> name); |
| 136 void SetName(Vector<const char> name); | 138 void SetName(Vector<const char> name); |
| 137 void AddAsmWasmOffset(int call_position, int to_number_position); | 139 void AddAsmWasmOffset(int call_position, int to_number_position); |
| 138 void SetAsmFunctionStartPosition(int position); | 140 void SetAsmFunctionStartPosition(int position); |
| 139 | 141 |
| 140 void WriteSignature(ZoneBuffer& buffer) const; | 142 void WriteSignature(ZoneBuffer& buffer) const; |
| 141 void WriteExports(ZoneBuffer& buffer) const; | 143 void WriteExports(ZoneBuffer& buffer) const; |
| 142 void WriteBody(ZoneBuffer& buffer) const; | 144 void WriteBody(ZoneBuffer& buffer) const; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 283 |
| 282 inline FunctionSig* WasmFunctionBuilder::signature() { | 284 inline FunctionSig* WasmFunctionBuilder::signature() { |
| 283 return builder_->signatures_[signature_index_]; | 285 return builder_->signatures_[signature_index_]; |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace wasm | 288 } // namespace wasm |
| 287 } // namespace internal | 289 } // namespace internal |
| 288 } // namespace v8 | 290 } // namespace v8 |
| 289 | 291 |
| 290 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ | 292 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ |
| OLD | NEW |