Implement rudimentary module linking.
authorrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Apr 2012 14:43:27 +0000 (14:43 +0000)
committerrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Apr 2012 14:43:27 +0000 (14:43 +0000)
commitab26fb6b21a10ff5f94588213b00f2ed2ef981b4
tree750177a5a59603783031ae70a892152fb0b0942d
parentf4c15c4ec26233e6e00b7bddea0d36c2863d7a1d
Implement rudimentary module linking.

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
28 files changed:
src/arm/full-codegen-arm.cc
src/ast.cc
src/ast.h
src/factory.cc
src/factory.h
src/full-codegen.cc
src/full-codegen.h
src/heap.cc
src/heap.h
src/hydrogen.cc
src/ia32/full-codegen-ia32.cc
src/interface.cc
src/interface.h
src/objects-debug.cc
src/objects-inl.h
src/objects-printer.cc
src/objects-visiting.cc
src/objects.cc
src/objects.h
src/parser.cc
src/runtime.cc
src/runtime.h
src/scopeinfo.cc
src/scopes.cc
src/x64/full-codegen-x64.cc
test/mjsunit/harmony/module-linking.js [new file with mode: 0644]
test/mjsunit/harmony/module-parsing.js
test/mjsunit/harmony/module-resolution.js