| 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_ENCODER_H_ | 5 #ifndef V8_WASM_ENCODER_H_ |
| 6 #define V8_WASM_ENCODER_H_ | 6 #define V8_WASM_ENCODER_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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 Zone* zone_; | 106 Zone* zone_; |
| 107 byte* buffer_; | 107 byte* buffer_; |
| 108 byte* pos_; | 108 byte* pos_; |
| 109 byte* end_; | 109 byte* end_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 class WasmModuleBuilder; | 112 class WasmModuleBuilder; |
| 113 | 113 |
| 114 class WasmFunctionBuilder : public ZoneObject { | 114 class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject { |
| 115 public: | 115 public: |
| 116 // Building methods. | 116 // Building methods. |
| 117 void SetSignature(FunctionSig* sig); | 117 void SetSignature(FunctionSig* sig); |
| 118 uint32_t AddLocal(LocalType type); | 118 uint32_t AddLocal(LocalType type); |
| 119 void EmitVarInt(uint32_t val); | 119 void EmitVarInt(uint32_t val); |
| 120 void EmitCode(const byte* code, uint32_t code_size); | 120 void EmitCode(const byte* code, uint32_t code_size); |
| 121 void Emit(WasmOpcode opcode); | 121 void Emit(WasmOpcode opcode); |
| 122 void EmitGetLocal(uint32_t index); | 122 void EmitGetLocal(uint32_t index); |
| 123 void EmitSetLocal(uint32_t index); | 123 void EmitSetLocal(uint32_t index); |
| 124 void EmitI32Const(int32_t val); | 124 void EmitI32Const(int32_t val); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 ZoneVector<byte> data_; | 200 ZoneVector<byte> data_; |
| 201 uint32_t dest_; | 201 uint32_t dest_; |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 struct WasmFunctionImport { | 204 struct WasmFunctionImport { |
| 205 uint32_t sig_index; | 205 uint32_t sig_index; |
| 206 const char* name; | 206 const char* name; |
| 207 int name_length; | 207 int name_length; |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 class WasmModuleBuilder : public ZoneObject { | 210 class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject { |
| 211 public: | 211 public: |
| 212 explicit WasmModuleBuilder(Zone* zone); | 212 explicit WasmModuleBuilder(Zone* zone); |
| 213 | 213 |
| 214 // Building methods. | 214 // Building methods. |
| 215 uint32_t AddFunction(); | 215 uint32_t AddFunction(); |
| 216 uint32_t AddGlobal(LocalType type, bool exported); | 216 uint32_t AddGlobal(LocalType type, bool exported); |
| 217 WasmFunctionBuilder* FunctionAt(size_t index); | 217 WasmFunctionBuilder* FunctionAt(size_t index); |
| 218 void AddDataSegment(WasmDataSegmentEncoder* data); | 218 void AddDataSegment(WasmDataSegmentEncoder* data); |
| 219 uint32_t AddSignature(FunctionSig* sig); | 219 uint32_t AddSignature(FunctionSig* sig); |
| 220 void AddIndirectFunction(uint32_t index); | 220 void AddIndirectFunction(uint32_t index); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 241 ZoneVector<std::pair<LocalType, bool>> globals_; | 241 ZoneVector<std::pair<LocalType, bool>> globals_; |
| 242 SignatureMap signature_map_; | 242 SignatureMap signature_map_; |
| 243 int start_function_index_; | 243 int start_function_index_; |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 } // namespace wasm | 246 } // namespace wasm |
| 247 } // namespace internal | 247 } // namespace internal |
| 248 } // namespace v8 | 248 } // namespace v8 |
| 249 | 249 |
| 250 #endif // V8_WASM_ENCODER_H_ | 250 #endif // V8_WASM_ENCODER_H_ |
| OLD | NEW |