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

Issue 9844002: Implement rudimentary module linking. (Closed)

Created:
8 years, 9 months ago by rossberg
Modified:
8 years, 8 months ago
CC:
v8-dev, Kevin Millikin (Chromium)
Visibility:
Public.

Description

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= Committed: https://code.google.com/p/v8/source/detail?r=11336

Patch Set 1 #

Total comments: 10

Patch Set 2 : Addressed Sven's comments. #

Patch Set 3 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+596 lines, -245 lines) Patch
M src/arm/full-codegen-arm.cc View 1 2 4 chunks +20 lines, -10 lines 0 comments Download
M src/ast.h View 1 2 4 chunks +6 lines, -4 lines 0 comments Download
M src/ast.cc View 1 2 2 chunks +73 lines, -128 lines 0 comments Download
M src/factory.h View 3 chunks +9 lines, -3 lines 0 comments Download
M src/factory.cc View 1 2 3 chunks +19 lines, -4 lines 0 comments Download
M src/full-codegen.h View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M src/full-codegen.cc View 1 2 3 chunks +70 lines, -11 lines 0 comments Download
M src/heap.h View 1 2 2 chunks +6 lines, -0 lines 0 comments Download
M src/heap.cc View 1 2 2 chunks +26 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 2 chunks +8 lines, -38 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 4 chunks +19 lines, -10 lines 0 comments Download
M src/interface.h View 4 chunks +43 lines, -3 lines 0 comments Download
M src/interface.cc View 3 chunks +11 lines, -2 lines 0 comments Download
M src/objects.h View 1 2 6 chunks +34 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/objects-debug.cc View 1 2 2 chunks +12 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 2 5 chunks +22 lines, -1 line 0 comments Download
M src/objects-printer.cc View 1 2 4 chunks +18 lines, -1 line 0 comments Download
M src/objects-visiting.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.cc View 1 2 5 chunks +22 lines, -7 lines 0 comments Download
M src/runtime.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime.cc View 1 2 2 chunks +20 lines, -1 line 0 comments Download
M src/scopeinfo.cc View 2 1 chunk +3 lines, -1 line 0 comments Download
M src/scopes.cc View 1 2 2 chunks +3 lines, -2 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 4 chunks +19 lines, -10 lines 0 comments Download
A test/mjsunit/harmony/module-linking.js View 1 chunk +121 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/module-parsing.js View 1 2 3 chunks +5 lines, -5 lines 0 comments Download
M test/mjsunit/harmony/module-resolution.js View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
rossberg
8 years, 9 months ago (2012-03-23 13:33:01 UTC) #1
Sven Panne
LGTM when the nits are addressed. https://chromiumcodereview.appspot.com/9844002/diff/1/src/full-codegen.cc File src/full-codegen.cc (right): https://chromiumcodereview.appspot.com/9844002/diff/1/src/full-codegen.cc#newcode631 src/full-codegen.cc:631: static_cast<PropertyAttributes>(READ_ONLY + DONT_DELETE ...
8 years, 8 months ago (2012-03-30 11:42:19 UTC) #2
rossberg
8 years, 8 months ago (2012-04-10 14:01:15 UTC) #3
https://chromiumcodereview.appspot.com/9844002/diff/1/src/full-codegen.cc
File src/full-codegen.cc (right):

https://chromiumcodereview.appspot.com/9844002/diff/1/src/full-codegen.cc#new...
src/full-codegen.cc:631: static_cast<PropertyAttributes>(READ_ONLY + DONT_DELETE
+ DONT_ENUM);
On 2012/03/30 11:42:20, Sven Panne wrote:
> Style nit: In the rest of the code we use '|' instead of '+'.

Done.

https://chromiumcodereview.appspot.com/9844002/diff/1/src/full-codegen.cc#new...
src/full-codegen.cc:639: ASSERT(!value.is_null());
On 2012/03/30 11:42:20, Sven Panne wrote:
> Do we really need this after the test in the previous statement?

Well, the assertion is supposed to stay, while the test is only a temporary
hack. But actually, I removed the hack (here and in VisitModuleDeclaration for
all codegens) in favour of simply allocating an empty module in ParseUrlModule.

https://chromiumcodereview.appspot.com/9844002/diff/1/src/heap.cc
File src/heap.cc (right):

https://chromiumcodereview.appspot.com/9844002/diff/1/src/heap.cc#newcode3835
src/heap.cc:3835: if (!maybe_map->To<Map>(&map)) return maybe_map;
On 2012/03/30 11:42:20, Sven Panne wrote:
> No need for the template parameter, I think.

Done.

https://chromiumcodereview.appspot.com/9844002/diff/1/src/heap.cc#newcode3837
src/heap.cc:3837: MaybeObject* result = AllocateJSObjectFromMap(map, TENURED);
On 2012/03/30 11:42:20, Sven Panne wrote:
> No need to name the result.

Done.

https://chromiumcodereview.appspot.com/9844002/diff/1/src/heap.cc#newcode4721
src/heap.cc:4721: if (!maybe_result->ToObject(&result)) return maybe_result;
On 2012/03/30 11:42:20, Sven Panne wrote:
> Use templatized "To", removing the need for an explicit cast here.

Unfortunately, that doesn't work here, because the proper map is only set in the
next step. :(

Perhaps AllocateFixedArray & friends should take a map as argument, but that's a
refactoring we should do separately.

Powered by Google App Engine
This is Rietveld 408576698