Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate constant functions at compile time #16598

Closed
stevemessick opened this issue Feb 6, 2014 · 3 comments
Closed

Evaluate constant functions at compile time #16598

stevemessick opened this issue Feb 6, 2014 · 3 comments
Labels
closed-obsolete Closed as the reported issue is no longer relevant dart2js-optimization type-enhancement A request for a change that isn't a bug web-dart2js

Comments

@stevemessick
Copy link
Contributor

[ed note: I'm just passing these along as I see them]

[user feedback]

Dart2Js generates code like this:

 t2 = C.JSNumber_methods.toInt$0(Math.floor(7.111111111111111));

7.1... is a result of a devision of constants that Dart2Js calculated at build time, nice! But it could also call calculate Math.floor(7.1) at runtime, as it is also constant at build time.
////////////////////////////////////////////////////////////////////////////////////
Editor: 1.2.0.dev_02_04 (2014-01-31)
OS: Windows 8 - amd64 (6.2)
JVM: 1.7.0_21

projects: 1

open dart files: 0

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 1778 / 710 / 203 MB
thread count: 28
index: 559303 relationships in 108843 keys in 15485 sources

SDK installed: true
Dartium installed: true

@floitschG
Copy link
Contributor

Added Optimization label.

@floitschG
Copy link
Contributor

Removed the owner.

@rakudrama
Copy link
Member

I don't see many of these but I have recently seen:

      t1 = Math.pow(2, 52);

          t1._multiplierDigits = C.JSDouble_methods.round$0(Math.log(100) / 2.302585092994046);

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant dart2js-optimization type-enhancement A request for a change that isn't a bug web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants