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

Issue 1059573004: Compile tearoffs of static functions as constants. (Closed)

Created:
5 years, 8 months ago by Anders Johnsen
Modified:
5 years, 8 months ago
Reviewers:
ahe, zerny-google
CC:
fletch+reviews_googlegroups.com
Base URL:
git@github.com:dart-lang/fletch.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Compile tearoffs of static functions as constants. BUG= R=zerny@google.com Committed: https://github.com/dart-lang/fletch/commit/efdb86b437643ce6b2bbf06878cfc6528d1dd352

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -5 lines) Patch
M pkg/fletchc/lib/src/codegen_visitor.dart View 4 chunks +30 lines, -4 lines 8 comments Download
M pkg/fletchc/lib/src/fletch_backend.dart View 2 chunks +6 lines, -1 line 0 comments Download
M pkg/fletchc/lib/src/fletch_constants.dart View 1 chunk +20 lines, -0 lines 2 comments Download

Messages

Total messages: 10 (2 generated)
Anders Johnsen
5 years, 8 months ago (2015-04-06 12:57:47 UTC) #2
zerny-google
lgtm
5 years, 8 months ago (2015-04-07 08:05:05 UTC) #3
Anders Johnsen
Committed patchset #1 (id:1) manually as efdb86b437643ce6b2bbf06878cfc6528d1dd352 (presubmit successful).
5 years, 8 months ago (2015-04-07 08:18:53 UTC) #4
ahe
https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart File pkg/fletchc/lib/src/codegen_visitor.dart (right): https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart#newcode195 pkg/fletchc/lib/src/codegen_visitor.dart:195: context.markConstantUsed(constant); Why isn't this called for other constants? https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/fletch_constants.dart ...
5 years, 8 months ago (2015-04-07 15:00:11 UTC) #6
ahe
https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart File pkg/fletchc/lib/src/codegen_visitor.dart (right): https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart#newcode1106 pkg/fletchc/lib/src/codegen_visitor.dart:1106: if (value >= 0x3FFFFFFF) { 0x3FFFFFFF should probably be ...
5 years, 8 months ago (2015-04-07 15:03:30 UTC) #7
Anders Johnsen
https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart File pkg/fletchc/lib/src/codegen_visitor.dart (right): https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart#newcode195 pkg/fletchc/lib/src/codegen_visitor.dart:195: context.markConstantUsed(constant); On 2015/04/07 15:00:11, ahe wrote: > Why isn't ...
5 years, 8 months ago (2015-04-08 06:32:14 UTC) #8
ahe
https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart File pkg/fletchc/lib/src/codegen_visitor.dart (right): https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen_visitor.dart#newcode725 pkg/fletchc/lib/src/codegen_visitor.dart:725: if (compiledClass.fields == 0) { Why is it the ...
5 years, 8 months ago (2015-04-08 08:04:18 UTC) #9
Anders Johnsen
5 years, 8 months ago (2015-04-08 08:37:58 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen...
File pkg/fletchc/lib/src/codegen_visitor.dart (right):

https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen...
pkg/fletchc/lib/src/codegen_visitor.dart:725: if (compiledClass.fields == 0) {
On 2015/04/08 08:04:18, ahe wrote:
> Why is it the number of fields that determine if you use
> allocateConstantClassInstance?
> 
> You stated that the reason for using FletchClassInstanceConstant is that
> compiledClass isn't a real class. Why is that the same as having no fields?
> 
> Also, when would the tearoff class have fields?

Because the field is not a constant - it can only be a constant if it doesn't
have any fields. But in this case, we can assert it.

https://codereview.chromium.org/1059573004/diff/1/pkg/fletchc/lib/src/codegen...
pkg/fletchc/lib/src/codegen_visitor.dart:1106: if (value >= 0x3FFFFFFF) {
On 2015/04/08 08:04:18, ahe wrote:
> On 2015/04/08 06:32:13, Anders Johnsen wrote:
> > On 2015/04/07 15:03:30, ahe wrote:
> > > 0x3FFFFFFF should probably be a named constant with some documentation.
> > > 
> > > Also, what happens if value is a negative value of high magnitude?
> > 
> > literal ints are never negative.
> 
> Assert that?

Done.

Powered by Google App Engine
This is Rietveld 408576698