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 #include "src/signature.h" | 5 #include "src/signature.h" |
6 | 6 |
7 #include "src/handles.h" | 7 #include "src/handles.h" |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "src/zone/zone-containers.h" | 9 #include "src/zone/zone-containers.h" |
10 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (pos != signature_map_.end()) { | 233 if (pos != signature_map_.end()) { |
234 return pos->second; | 234 return pos->second; |
235 } else { | 235 } else { |
236 uint32_t index = static_cast<uint32_t>(signatures_.size()); | 236 uint32_t index = static_cast<uint32_t>(signatures_.size()); |
237 signature_map_[sig] = index; | 237 signature_map_[sig] = index; |
238 signatures_.push_back(sig); | 238 signatures_.push_back(sig); |
239 return index; | 239 return index; |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 void WasmModuleBuilder::AddIndirectFunction(uint32_t index) { | 243 uint32_t WasmModuleBuilder::AllocateIndirectFunctions(uint32_t count) { |
244 indirect_functions_.push_back(index); | 244 uint32_t ret = static_cast<uint32_t>(indirect_functions_.size()); |
| 245 indirect_functions_.resize(indirect_functions_.size() + count); |
| 246 return ret; |
| 247 } |
| 248 |
| 249 void WasmModuleBuilder::SetIndirectFunction(uint32_t indirect, |
| 250 uint32_t direct) { |
| 251 indirect_functions_[indirect] = direct; |
245 } | 252 } |
246 | 253 |
247 uint32_t WasmModuleBuilder::AddImport(const char* name, int name_length, | 254 uint32_t WasmModuleBuilder::AddImport(const char* name, int name_length, |
248 FunctionSig* sig) { | 255 FunctionSig* sig) { |
249 imports_.push_back({AddSignature(sig), name, name_length}); | 256 imports_.push_back({AddSignature(sig), name, name_length}); |
250 return static_cast<uint32_t>(imports_.size() - 1); | 257 return static_cast<uint32_t>(imports_.size() - 1); |
251 } | 258 } |
252 | 259 |
253 void WasmModuleBuilder::MarkStartFunction(WasmFunctionBuilder* function) { | 260 void WasmModuleBuilder::MarkStartFunction(WasmFunctionBuilder* function) { |
254 start_function_index_ = function->func_index(); | 261 start_function_index_ = function->func_index(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 function->name_.size()); | 457 function->name_.size()); |
451 } | 458 } |
452 buffer.write_u8(0); | 459 buffer.write_u8(0); |
453 } | 460 } |
454 FixupSection(buffer, start); | 461 FixupSection(buffer, start); |
455 } | 462 } |
456 } | 463 } |
457 } // namespace wasm | 464 } // namespace wasm |
458 } // namespace internal | 465 } // namespace internal |
459 } // namespace v8 | 466 } // namespace v8 |
OLD | NEW |