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

Issue 10831142: Associate the correct type to method receivers (instead of Dynamic type). (Closed)

Created:
8 years, 4 months ago by regis
Modified:
8 years, 4 months ago
Reviewers:
srdjan, hausner
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Associate the correct type to method receivers (instead of Dynamic type). Properly name the first implicit parameter to factories as ':type_arguments' (instead of 'this', which made it accessible to user code). Various cleanup. Committed: https://code.google.com/p/dart/source/detail?r=10203

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+284 lines, -151 lines) Patch
M runtime/vm/ast.h View 11 chunks +27 lines, -22 lines 2 comments Download
M runtime/vm/code_descriptors_test.cc View 1 chunk +4 lines, -4 lines 0 comments Download
M runtime/vm/code_patcher_ia32_test.cc View 1 chunk +6 lines, -1 line 0 comments Download
M runtime/vm/code_patcher_x64_test.cc View 1 chunk +5 lines, -1 line 0 comments Download
M runtime/vm/compiler.cc View 2 chunks +3 lines, -5 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 chunk +9 lines, -6 lines 0 comments Download
M runtime/vm/object.h View 2 chunks +2 lines, -0 lines 2 comments Download
M runtime/vm/object.cc View 8 chunks +19 lines, -9 lines 2 comments Download
M runtime/vm/object_test.cc View 8 chunks +18 lines, -12 lines 0 comments Download
M runtime/vm/parser.h View 2 chunks +6 lines, -2 lines 0 comments Download
M runtime/vm/parser.cc View 34 chunks +157 lines, -73 lines 4 comments Download
M runtime/vm/runtime_entry_test.cc View 1 chunk +7 lines, -6 lines 0 comments Download
M runtime/vm/stub_code_ia32_test.cc View 1 chunk +6 lines, -1 line 0 comments Download
M runtime/vm/stub_code_x64_test.cc View 2 chunks +6 lines, -2 lines 0 comments Download
M runtime/vm/symbols.h View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/unit_test.cc View 2 chunks +8 lines, -7 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
regis
8 years, 4 months ago (2012-08-02 22:06:17 UTC) #1
srdjan
LGTM https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/ast.h File runtime/vm/ast.h (right): https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/ast.h#newcode933 runtime/vm/ast.h:933: ASSERT(&local_ != NULL); That can't be, can it? ...
8 years, 4 months ago (2012-08-02 22:29:46 UTC) #2
regis
Thanks https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/ast.h File runtime/vm/ast.h (right): https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/ast.h#newcode933 runtime/vm/ast.h:933: ASSERT(&local_ != NULL); On 2012/08/02 22:29:46, srdjan wrote: ...
8 years, 4 months ago (2012-08-02 23:01:26 UTC) #3
hausner
LGTM but I am worried that you allocate a new type object each time the ...
8 years, 4 months ago (2012-08-02 23:25:00 UTC) #4
regis
8 years, 4 months ago (2012-08-02 23:58:37 UTC) #5
Thanks Matthias.

Since I submitted already, I will address your comments in a following cl.

I will also change references to pointers in the ast, since people got shocked
by the ASSERTs introduced in this cl.

Indeed, C++ let you pass *receiver with receiver == NULL to a formal parameter
of a reference type const LocalVariable& local. Then, &local == NULL.

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/object.cc#n...
runtime/vm/object.cc:3704: void Function::set_owner(const Class& value) const {
On 2012/08/02 23:25:00, hausner wrote:
> Make this accessor private?

Good point. Done for Function and for Field.

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/object.h
File runtime/vm/object.h (right):

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/object.h#ne...
runtime/vm/object.h:1677: void set_owner(const Class& value) const {
On 2012/08/02 23:25:00, hausner wrote:
> Make this setter private?

Done.

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/parser.cc#n...
runtime/vm/parser.cc:430: AddFinalParameter(receiver_type->token_pos(),
On 2012/08/02 23:25:00, hausner wrote:
> Why are you using the token position of the type, not the token position that
is
> passed in (typically the call position)?

The token position is now passed to ReceiverType to build the type, and this
same position is then used here.

Well, that was the idea, but your comment made me realize that the type may get
canonicalized, in which case the token position gets lost.
I'll keep the name_pos as a separate parameter.

https://chromiumcodereview.appspot.com/10831142/diff/1/runtime/vm/parser.cc#n...
runtime/vm/parser.cc:7236: Type::New(current_class(), type_arguments,
type_pos));
On 2012/08/02 23:25:00, hausner wrote:
> I don't understand why you have to allocate a new type object each time you
add
> a receiver to an argument list. Can they not all share the same type object?

We add this type to the formal parameter list, not to the argument list. So
there are not that many. Also, these types get canonicalized, so they get shared
anyway.

Powered by Google App Engine
This is Rietveld 408576698