Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Unified Diff: src/wasm/module-decoder.cc

Issue 1692173002: [wasm] Add support for a start function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 1236fd6982b92492722c4c7483c72797c54c0fcc..fe4217d63ca81931776aa4a6a6046fb8667c973c 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -180,6 +180,29 @@ class ModuleDecoder : public Decoder {
}
break;
}
+ case kDeclStartFunction: {
+ // Declares a start function for a module.
+ CheckForPreviousSection(sections, kDeclFunctions, true);
+ if (module->start_function_index >= 0) {
+ error("start function already declared");
+ break;
+ }
+ int length;
+ const byte* before = pc_;
+ uint32_t index = consume_u32v(&length, "start function index");
+ if (index >= module->functions->size()) {
+ error(before, "invalid start function index");
+ break;
+ }
+ module->start_function_index = static_cast<int>(index);
+ FunctionSig* sig =
+ module->signatures->at(module->functions->at(index).sig_index);
+ if (sig->parameter_count() > 0) {
+ error(before, "invalid start function: non-zero parameter count");
+ break;
+ }
+ break;
+ }
case kDeclWLL: {
// Reserved for experimentation by the Web Low-level Language project
// which is augmenting the binary encoding with source code meta
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698