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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 EnsureSpace(4); | 42 EnsureSpace(4); |
43 WriteLittleEndianValue<uint32_t>(pos_, x); | 43 WriteLittleEndianValue<uint32_t>(pos_, x); |
44 pos_ += 4; | 44 pos_ += 4; |
45 } | 45 } |
46 | 46 |
47 void write_u32v(uint32_t val) { | 47 void write_u32v(uint32_t val) { |
48 EnsureSpace(kMaxVarInt32Size); | 48 EnsureSpace(kMaxVarInt32Size); |
49 LEBHelper::write_u32v(&pos_, val); | 49 LEBHelper::write_u32v(&pos_, val); |
50 } | 50 } |
51 | 51 |
| 52 void write_i32v(int32_t val) { |
| 53 EnsureSpace(kMaxVarInt32Size); |
| 54 LEBHelper::write_i32v(&pos_, val); |
| 55 } |
| 56 |
52 void write_size(size_t val) { | 57 void write_size(size_t val) { |
53 EnsureSpace(kMaxVarInt32Size); | 58 EnsureSpace(kMaxVarInt32Size); |
54 DCHECK_EQ(val, static_cast<uint32_t>(val)); | 59 DCHECK_EQ(val, static_cast<uint32_t>(val)); |
55 LEBHelper::write_u32v(&pos_, static_cast<uint32_t>(val)); | 60 LEBHelper::write_u32v(&pos_, static_cast<uint32_t>(val)); |
56 } | 61 } |
57 | 62 |
58 void write(const byte* data, size_t size) { | 63 void write(const byte* data, size_t size) { |
59 EnsureSpace(size); | 64 EnsureSpace(size); |
60 memcpy(pos_, data, size); | 65 memcpy(pos_, data, size); |
61 pos_ += size; | 66 pos_ += size; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 269 |
265 inline FunctionSig* WasmFunctionBuilder::signature() { | 270 inline FunctionSig* WasmFunctionBuilder::signature() { |
266 return builder_->signatures_[signature_index_]; | 271 return builder_->signatures_[signature_index_]; |
267 } | 272 } |
268 | 273 |
269 } // namespace wasm | 274 } // namespace wasm |
270 } // namespace internal | 275 } // namespace internal |
271 } // namespace v8 | 276 } // namespace v8 |
272 | 277 |
273 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ | 278 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ |
OLD | NEW |