Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A reference validator for asm.js.

License

NotificationsYou must be signed in to change notification settings

asm-js/validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Mozilla Research project to specify and develop the extremely optimizable subset of JS targeted by compilers like Emscripten, Mandreel, and LLJS.

Discussion of the asm.js spec now takes place on Specifictionhere.

Thespec repo hosts the source forthe current asm.js Working Draft.

This repo hosts JS source code which performs asm.js validation, howeveras of this update, this code is not up to date with the latest working draft and isnot extensively tested. Patches to update it or fix bugs are welcome though.

Example

functionmymodule(stdlib,foreign,heap){"use asm";// -------------------------------------------------------------------------// SECTION 1: globalsvarH32=newstdlib.Int32Array(heap);varHU32=newstdlib.Uint32Array(heap);varlog=foreign.consoleDotLog;varg_i=0;// int globalvarg_f=0.0;// double global// -------------------------------------------------------------------------// SECTION 2: functionsfunctionf(x,y){// SECTION A: parameter type declarationsx=x|0;// int parametery=+y;// double parameter// SECTION B: function bodylog(x|0);// call into FFI -- must force the signlog(y);// call into FFI -- already know it's a doublex=(x+3)|0;// signed addition// SECTION C: unconditional returnreturn((((x+1)|0)>>>0)/(x>>>0))|0;// compound expression}functiong(){g_f=+(g_i|0);// read/write globalsreturn;}functiong2(){return;}functionh(i,x){i=i|0;x=x|0;H32[i>>2]=x;// shifted by log2(byte count)ftable_2[(x-2)&1]();// dynamic call of functions in table 2// no return necessary when return type is void}// -------------------------------------------------------------------------// SECTION 3: function tablesvarftable_1=[f];varftable_2=[g,g2];// all of the same type// -------------------------------------------------------------------------// SECTION 4: exportsreturn{f_export:f,goop:g};}

License

Apache 2.0.

About

A reference validator for asm.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp