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-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class WasmFunctionBuilder : public ZoneObject { | 48 class WasmFunctionBuilder : public ZoneObject { |
49 public: | 49 public: |
50 uint16_t AddParam(LocalType type); | 50 uint16_t AddParam(LocalType type); |
51 uint16_t AddLocal(LocalType type); | 51 uint16_t AddLocal(LocalType type); |
52 void ReturnType(LocalType type); | 52 void ReturnType(LocalType type); |
53 void EmitCode(const byte* code, uint32_t code_size); | 53 void EmitCode(const byte* code, uint32_t code_size); |
54 void EmitCode(const byte* code, uint32_t code_size, | 54 void EmitCode(const byte* code, uint32_t code_size, |
55 const uint32_t* local_indices, uint32_t indices_size); | 55 const uint32_t* local_indices, uint32_t indices_size); |
56 void Emit(WasmOpcode opcode); | 56 void Emit(WasmOpcode opcode); |
57 void EmitWithU8(WasmOpcode opcode, const byte immediate); | 57 void EmitWithU8(WasmOpcode opcode, const byte immediate); |
58 uint32_t EmitEditableImmediate(const byte immediate); | 58 void EmitWithVarInt(WasmOpcode opcode, uint32_t immediate); |
59 void EditImmediate(uint32_t offset, const byte immediate); | 59 uint32_t EmitEditableVarIntImmediate(); |
| 60 void EditVarIntImmediate(uint32_t offset, const uint32_t immediate); |
60 void Exported(uint8_t flag); | 61 void Exported(uint8_t flag); |
61 void External(uint8_t flag); | 62 void External(uint8_t flag); |
62 void SetName(const unsigned char* name, int name_length); | 63 void SetName(const unsigned char* name, int name_length); |
63 WasmFunctionEncoder* Build(Zone* zone, WasmModuleBuilder* mb) const; | 64 WasmFunctionEncoder* Build(Zone* zone, WasmModuleBuilder* mb) const; |
64 | 65 |
65 private: | 66 private: |
66 explicit WasmFunctionBuilder(Zone* zone); | 67 explicit WasmFunctionBuilder(Zone* zone); |
67 friend class WasmModuleBuilder; | 68 friend class WasmModuleBuilder; |
68 LocalType return_type_; | 69 LocalType return_type_; |
69 struct Type; | 70 struct Type; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 SignatureMap signature_map_; | 146 SignatureMap signature_map_; |
146 int start_function_index_; | 147 int start_function_index_; |
147 }; | 148 }; |
148 | 149 |
149 std::vector<uint8_t> UnsignedLEB128From(uint32_t result); | 150 std::vector<uint8_t> UnsignedLEB128From(uint32_t result); |
150 } // namespace wasm | 151 } // namespace wasm |
151 } // namespace internal | 152 } // namespace internal |
152 } // namespace v8 | 153 } // namespace v8 |
153 | 154 |
154 #endif // V8_WASM_ENCODER_H_ | 155 #endif // V8_WASM_ENCODER_H_ |
OLD | NEW |