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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 } | 322 } |
323 FixupSection(buffer, start); | 323 FixupSection(buffer, start); |
324 } | 324 } |
325 | 325 |
326 // == Emit imports =========================================================== | 326 // == Emit imports =========================================================== |
327 if (imports_.size() > 0) { | 327 if (imports_.size() > 0) { |
328 size_t start = EmitSection(kImportSectionCode, buffer); | 328 size_t start = EmitSection(kImportSectionCode, buffer); |
329 buffer.write_size(imports_.size()); | 329 buffer.write_size(imports_.size()); |
330 for (auto import : imports_) { | 330 for (auto import : imports_) { |
331 buffer.write_u32v(import.name_length); // module name length | 331 buffer.write_u32v(0); // module name length |
332 buffer.write(reinterpret_cast<const byte*>(import.name), // module name | 332 buffer.write_u32v(import.name_length); // field name length |
| 333 buffer.write(reinterpret_cast<const byte*>(import.name), // field name |
333 import.name_length); | 334 import.name_length); |
334 buffer.write_u32v(0); // field name length | |
335 buffer.write_u8(kExternalFunction); | 335 buffer.write_u8(kExternalFunction); |
336 buffer.write_u32v(import.sig_index); | 336 buffer.write_u32v(import.sig_index); |
337 } | 337 } |
338 FixupSection(buffer, start); | 338 FixupSection(buffer, start); |
339 } | 339 } |
340 | 340 |
341 // == Emit function signatures =============================================== | 341 // == Emit function signatures =============================================== |
342 bool has_names = false; | 342 bool has_names = false; |
343 if (functions_.size() > 0) { | 343 if (functions_.size() > 0) { |
344 size_t start = EmitSection(kFunctionSectionCode, buffer); | 344 size_t start = EmitSection(kFunctionSectionCode, buffer); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 // Emit the offset table per function. | 535 // Emit the offset table per function. |
536 for (auto function : functions_) { | 536 for (auto function : functions_) { |
537 function->WriteAsmWasmOffsetTable(buffer); | 537 function->WriteAsmWasmOffsetTable(buffer); |
538 } | 538 } |
539 // Append a 0 to indicate that this is an encoded table. | 539 // Append a 0 to indicate that this is an encoded table. |
540 buffer.write_u8(0); | 540 buffer.write_u8(0); |
541 } | 541 } |
542 } // namespace wasm | 542 } // namespace wasm |
543 } // namespace internal | 543 } // namespace internal |
544 } // namespace v8 | 544 } // namespace v8 |
OLD | NEW |