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

Issue 8234016: Inline allocation of implicit closures. (Closed)

Created:
9 years, 2 months ago by regis
Modified:
9 years, 2 months ago
Reviewers:
siva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Inline allocation of implicit closures. Consolidate generation of closure allocation stubs into one function. Fix type name printing when printing ast. Committed: https://code.google.com/p/dart/source/detail?r=357

Patch Set 1 #

Total comments: 8

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+172 lines, -162 lines) Patch
M runtime/vm/ast.h View 1 4 chunks +15 lines, -12 lines 0 comments Download
M runtime/vm/ast_printer.cc View 1 6 chunks +9 lines, -8 lines 0 comments Download
M runtime/vm/code_generator.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/vm/code_generator.cc View 1 2 chunks +9 lines, -10 lines 0 comments Download
M runtime/vm/code_generator_ia32.cc View 1 3 chunks +13 lines, -18 lines 0 comments Download
M runtime/vm/object.h View 1 2 chunks +22 lines, -2 lines 0 comments Download
M runtime/vm/object.cc View 1 4 chunks +11 lines, -10 lines 0 comments Download
M runtime/vm/parser.cc View 1 15 chunks +23 lines, -25 lines 0 comments Download
M runtime/vm/stub_code.h View 1 2 chunks +0 lines, -4 lines 0 comments Download
M runtime/vm/stub_code.cc View 1 1 chunk +0 lines, -21 lines 0 comments Download
M runtime/vm/stub_code_arm.cc View 1 1 chunk +0 lines, -6 lines 0 comments Download
M runtime/vm/stub_code_ia32.cc View 1 4 chunks +68 lines, -38 lines 0 comments Download
M runtime/vm/stub_code_x64.cc View 1 1 chunk +0 lines, -6 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
regis
9 years, 2 months ago (2011-10-11 20:07:21 UTC) #1
siva
LGTM http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.cc File runtime/vm/object.cc (right): http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.cc#newcode2723 runtime/vm/object.cc:2723: } if (!IsClosureFunction()) { return false; } instead ...
9 years, 2 months ago (2011-10-11 21:00:46 UTC) #2
regis
9 years, 2 months ago (2011-10-11 23:40:19 UTC) #3
Thanks!

http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.cc
File runtime/vm/object.cc (right):

http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.cc#newcode2723
runtime/vm/object.cc:2723: }
On 2011/10/11 21:00:46, asiva wrote:
> if (!IsClosureFunction()) {
>   return false;
> }
> 
> instead of the explicit kind() check ?

Done.

http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.h
File runtime/vm/object.h (right):

http://codereview.chromium.org/8234016/diff/1/runtime/vm/object.h#newcode1149
runtime/vm/object.h:1149: bool IsImplicitClosureFunction() const;
On 2011/10/11 21:00:46, asiva wrote:
> I am wondering if it would be more readable if we
> had
> bool IsRegularClosureFunction() const;
> bool IsStaticImplicitClosureFunction() const;
> bool IsDynamicImplicitClosureFunction() const;

I'd like to keep IsClosureFunction() to return true for all forms, otherwise you
need to OR all forms.

I do not like "Dynamic" (because of the coming renaming of var to Dynamic), but
prefer "Instance".

I added helpers as you suggested, bu with slightly different names.

http://codereview.chromium.org/8234016/diff/1/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

http://codereview.chromium.org/8234016/diff/1/runtime/vm/parser.cc#newcode1423
runtime/vm/parser.cc:1423: !func.IsClosureFunction() &&
On 2011/10/11 21:00:46, asiva wrote:
> Maybe we should append to the comment as to why
> func.IsClosureFunction() needs to be in this list.
> 
> I am not sure I understand the advantage you are getting by not treating all
> closure functions as static the way you had before. The assertions and closure
> type could have still been gotten using the parent_function.

I added a comment.
I prefer that is_static() reflects the static scope or instance scope of the
closure. This should make instantiation of generic closure types clearer
(upcoming cl). I felt that using is_static() to indicate the presence of a
receiver as first formal parameter was not quite correct. An instance closure
has access to the captured receiver, but via the context.

While writing this, I realized that we do not need Function::IsInStaticScope()
anymore. Removed.

http://codereview.chromium.org/8234016/diff/1/runtime/vm/stub_code_ia32.cc
File runtime/vm/stub_code_ia32.cc (right):

http://codereview.chromium.org/8234016/diff/1/runtime/vm/stub_code_ia32.cc#ne...
runtime/vm/stub_code_ia32.cc:1327: } else {
On 2011/10/11 21:00:46, asiva wrote:
> add a comment // Regular closure.

Added ASSERT.

Powered by Google App Engine
This is Rietveld 408576698