• rossberg@chromium.org's avatar
    Implement rudimentary module linking. · ab26fb6b
    rossberg@chromium.org authored
    Constructs the (generally cyclic) graph of module instance objects
    and populates their exports. Any exports other than nested modules
    are currently set to 'undefined' (but already present as properties).
    
    Details:
    - Added new type JSModule for instance objects: a JSObject carrying a context.
    - Statically allocate instance objects for all module literals (in parser 8-}).
    - Extend interfaces to record and unify concrete instance objects,
      and to support iteration over members.
    - Introduce new runtime function for pushing module contexts.
    - Generate code for allocating, initializing, and setting module contexts,
      and for populating instance objects from module literals.
      Currently, all non-module exports are still initialized with 'undefined'.
    - Module aliases are resolved statically, so no special code is required.
    - Make sure that code containing module constructs is never optimized
      (macrofy AST node construction flag setting while we're at it).
    - Add test case checking linkage.
    
    Baseline: http://codereview.chromium.org/9722043/
    
    R=svenpanne@chromium.org,mstarzinger@chromium.org
    BUG=
    TEST=
    
    Review URL: https://chromiumcodereview.appspot.com/9844002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    ab26fb6b
module-linking.js 3.5 KB