void WASMModuleParser::parseModule() { uint32_t magicNumber; READ_UINT32_OR_FAIL(magicNumber, "Cannot read the magic number."); FAIL_IF_FALSE(magicNumber == wasmMagicNumber, "The magic number is incorrect."); uint32_t outputSizeInASMJS; READ_UINT32_OR_FAIL(outputSizeInASMJS, "Cannot read the output size in asm.js format."); parseConstantPoolSection(); PROPAGATE_ERROR(); parseSignatureSection(); PROPAGATE_ERROR(); parseFunctionImportSection(); PROPAGATE_ERROR(); parseGlobalSection(); PROPAGATE_ERROR(); parseFunctionDeclarationSection(); PROPAGATE_ERROR(); parseFunctionPointerTableSection(); PROPAGATE_ERROR(); parseFunctionDefinitionSection(); PROPAGATE_ERROR(); parseExportSection(); }
void WASMModuleParser::parseModule(ExecState* exec) { uint32_t magicNumber; READ_UINT32_OR_FAIL(magicNumber, "Cannot read the magic number."); FAIL_IF_FALSE(magicNumber == wasmMagicNumber, "The magic number is incorrect."); uint32_t outputSizeInASMJS; READ_UINT32_OR_FAIL(outputSizeInASMJS, "Cannot read the output size in asm.js format."); parseConstantPoolSection(); PROPAGATE_ERROR(); parseSignatureSection(); PROPAGATE_ERROR(); parseFunctionImportSection(exec); PROPAGATE_ERROR(); parseGlobalSection(exec); PROPAGATE_ERROR(); parseFunctionDeclarationSection(); PROPAGATE_ERROR(); parseFunctionPointerTableSection(); PROPAGATE_ERROR(); parseFunctionDefinitionSection(); PROPAGATE_ERROR(); parseExportSection(); PROPAGATE_ERROR(); FAIL_IF_FALSE(!m_module->arrayBuffer() || m_module->arrayBuffer()->impl()->byteLength() < (1u << 31), "The ArrayBuffer's length must be less than 2^31."); }