Commit Graph

1263 Commits

Author SHA1 Message Date
rmacnak@google.com d14dc6c502 Fix crash when parsing metadata that refers to a static getter.
BUG=http://dartbug.com/18949
R=hausner@google.com

Review URL: https://codereview.chromium.org//286903020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36522 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 18:56:08 +00:00
iposva@google.com b4b4889406 - Refined https://codereview.chromium.org/293963008/
Make compilation VM more fine grained

- Use the isolate where appropriate.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//294943008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36451 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-21 21:04:03 +00:00
regis@google.com 38319b0f33 Fix issue 18435 (2nd attempt).
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org//293013005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36402 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-21 00:32:32 +00:00
regis@google.com 8d7bc4bef5 Revert bad fix.
Review URL: https://codereview.chromium.org//288343005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36365 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 17:03:10 +00:00
regis@google.com 9ae1b1f5e0 Fix issue 18435.
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org//295803003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36362 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 16:41:37 +00:00
regis@google.com dec11d8b7b Add support for javascript incompatibility warnings (work in progress).
For now, warnings are only issued when applicable for type tests, type casts,
and toString.
Fix newly reported lint errors.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//260713008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36001 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-09 22:42:10 +00:00
rmacnak@google.com f4f4713eb8 Put metadata fields in their owner class to maintain the class-field bidirectional relationship asserted Field::PrintJSON.
Extended metadata scope test based on suspicions regarding the ordering of adding type parameters metadata fields versus ordinary fields of a class.

BUG=http://dartbug.com/18652
R=iposva@google.com, regis@google.com

Review URL: https://codereview.chromium.org//269253005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35926 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 18:15:33 +00:00
iposva@google.com 7256650645 - Change when the library being loaded is registered. Now
we register it before calling the tag handler so that the
  VM can keep track of which libraries have outstanding
  requests.

R=hausner@google.com

Review URL: https://codereview.chromium.org//267353005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35870 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-07 21:46:05 +00:00
fschneider@google.com dfa5c809f5 Simplify flow graph building for instantiator.
The instantiator is always loaded from a local variable which
is determined in the parser. There is no need to create an AST a fresh
ValueGraphVisitor for it since the flow graph builder can just emit a
load-local.

This also makes it clear that the instantiator is not an arbitrary expresssion.

R=regis@google.com

Review URL: https://codereview.chromium.org//262883005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35699 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 17:58:01 +00:00
turnidge@google.com f8fcc45e3d Save the entry context for a function that has captured loop variables.
BUG=18561
R=vegorov@google.com

Review URL: https://codereview.chromium.org//266783002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35692 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 16:14:05 +00:00
iposva@google.com 84e4a2d2ce - Remove unneeded creation of :saved_current_context_var
R=turnidge@google.com

Review URL: https://codereview.chromium.org//256623005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35400 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 20:31:45 +00:00
regis@google.com da0958c822 Expose functionality to create a stack trace to internal vm code.
Provide functionality to limit depth of printed stack trace.
Fix frame numbering in presence of invisible functions in stack trace.
Let FlowGraphBuilder know if it is building a graph to generate optimized code.
The above features will be used to warn on Javascript incompatibilities.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//248213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35319 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 17:58:12 +00:00
rmacnak@google.com 7ba8ca5753 Reapply "Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation)."
With fix for uninitialized is_dart_scheme_ when read from snapshot.

BUG=http://dartbug.com/15274
R=iposva@google.com

Review URL: https://codereview.chromium.org//247683002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35289 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 00:05:08 +00:00
rmacnak@google.com 7840906011 Revert "Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation)."
Review URL: https://codereview.chromium.org//246173002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35238 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-22 00:08:52 +00:00
rmacnak@google.com 69d82c334b Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation).
Ensure invocation_fuzz_test doesn't exit prematurely.

Also visit instance methods defined in superclasses.

Complete blacklist so invocation_fuzz_test passes on the VM.

B=http://dartbug.com/15274
R=iposva@google.com

Review URL: https://codereview.chromium.org//241993004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35234 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 23:24:17 +00:00
fschneider@google.com 79a5307d5b VM: Implement closure calls as instance calls.
Conceptually f() becomes f.call() where the .call method performs the actual
closure call. The closure call itself is implemented without a stub.

The check if the object called is a closure becomes a class-id check
which can be hoisted out of loops.

R=iposva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//227723002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34917 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 10:56:00 +00:00
hausner@google.com 10f6318d87 Allow function literals in string interpolation
Interpolated strings in initializers can contain function literals. Add a test case to the function literals test.

Fixes issue 18112.

R=regis@google.com

Review URL: https://codereview.chromium.org//232213003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34903 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-09 23:42:58 +00:00
hausner@google.com 625b564a4b Fix instance method resolution with abstract accessors and methods
Fix issue 18082

R=gbracha@google.com, regis@google.com

Review URL: https://codereview.chromium.org//227703010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34845 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 22:14:24 +00:00
hausner@google.com 83f80fe560 Add const static field optimization that got lost in last checkin
My last change list accidentally got rid of an optimization where the parser replaces const static field references with the value of the field. This causes many more compile-time “execute once” calls. This change adds back the special case.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//227863002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34798 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 21:30:54 +00:00
hausner@google.com 2b4e3c7c99 Implement deferred constant support
Compile time constants lose their const-ness if they are referred
to through a deferred prefix. This CL adds a flag to some ast node
types that remembers whether a field or closure was referred to
via a deferred prefix. If so, the compile-time const analysis flags
the value as non-const.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//226953002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34785 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 17:31:32 +00:00
hausner@google.com b36457263a Deferred prefix support in metadata
Deferred prefixes are never ok in metadata, since metadata is required
to be compile time constant.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//219473007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34601 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-01 16:11:28 +00:00
rmacnak@google.com f0626388f5 VM: Evaluate metadata on a class in the scope of its library not the scope of the class.
BUG=http://dartbug.com/17795
R=gbracha@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//217543004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34537 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-28 22:38:32 +00:00
hausner@google.com ed24226376 Support deferred library prefix syntax
First step towards deferred library support:
- Parse the “deferred as” import clause.
- Implement p.loadLibrary() which returns a future that
  completes when the library is loaded.
- Treat type annotations of deferred types as malformed.
- Throw NoSuchMethodError when calling functions from
  unloaded libraries.
- Libraries are still read synchronously, but items in the
  library won’t be visible through the deferred prefix until
  the future returned by loadLibrary() completes.

Review URL: https://codereview.chromium.org//208323015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34481 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-27 21:20:47 +00:00
johnmccutchan@google.com 6952f5ddfe Use VM tag in profile and add stack trace trie
R=asiva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//201213004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34064 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-18 21:20:41 +00:00
fschneider@google.com 37b30ab2ac Alternative fix for .call invocation of closures.
This also covers "closurization" of the .call method.
This relies on the fact that f.call === f if f is a closure.
This means that adding a simple getter to _FunctionImpl that
 returns this is enough. No need for a separate dispatch.

This CL reverts the previous fix for issue 12602 (modulo the
additional tests).

BUG=dartbug.com/17473, dartbug.com/12602
R=iposva@google.com

Review URL: https://codereview.chromium.org//200193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33736 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 10:31:33 +00:00
iposva@google.com 021fca847c - Implement a PauseTimerScope so that we can properly exclude
times when a TimerScope is active.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//196413011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33662 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 20:38:24 +00:00
fschneider@google.com f75ef2e6ab Fix invocation of closures via .call in the VM.
Calling closures via .call does now work in the VM - it was working in
dart2js already.  Calling .call on a closure is implemented to go through
a dispatcher method. These dispatcher methods are automatically created and
cached in the same way as NoSuchMethod- or field-invocation dispatchers.

This CL does not change the way regular closure invocation works in
the VM. It is therefore performance-neutral for normal closure calls.

BUG=dartbug.com/12602
TEST=language/call_test
R=iposva@google.com

Review URL: https://codereview.chromium.org//188703004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33576 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-12 14:02:27 +00:00
rmacnak@google.com 57dd1321d1 Reapply "Access to imports in the VM's runtime mirrors. Extend test coverage of the source mirrors."
Regenerate snapshot test due to change in the size of Namespace. Relate the types source mirror libraries dependencies to the runtime library dependencies.

BUG=http://dartbug.com/10360

Review URL: https://codereview.chromium.org//189843003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33441 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-07 19:00:20 +00:00
hausner@google.com 295b7fd5b2 Eliminate more implicit getters
For some reason I don’t remember, we only attempt to optimize
away the implicit getter functions of const and final static
fields, but not non-final static fields. This change applies the
same optimization for all static fields, and also for all
top-level fields.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//189583003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33433 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-07 16:20:11 +00:00
rmacnak@google.com 62ad4b82ce Revert "Access to imports in the VM's runtime mirrors. Extend test coverage of the source mirrors."
Review URL: https://codereview.chromium.org//189293002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33402 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 22:45:29 +00:00
rmacnak@google.com 2d0e54a94d Access to imports in the VM's runtime mirrors. Extend test coverage of the source mirrors.
BUG=http://dartbug.com/10360
R=gbracha@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//154733003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33397 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 22:02:29 +00:00
srdjan@google.com 2e214c324b More performance fixes.
R=asiva@google.com

Review URL: https://codereview.chromium.org//183973035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33389 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 19:00:11 +00:00
ajohnsen@google.com c3dfdbe772 Fix fromEnvironment when called from isolates.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//180243022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33363 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 09:16:41 +00:00
srdjan@google.com 3ffe7579ce Minor VM performance improvements based on profiling.
R=asiva@google.com

Review URL: https://codereview.chromium.org//185553015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33333 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-05 17:42:40 +00:00
hausner@google.com 776a6cfc2e Always evaluate e in (e is T)
(e is T) is compiled  to a throw TypeError when T is malformed.
This change makes sure that e is evaluated even though it is
ignored. We need to do this due to possible side effects.

Fixes issue 17253

R=regis@google.com

Review URL: https://codereview.chromium.org//185553018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33299 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 20:44:51 +00:00
hausner@google.com 75f9f5bfa3 Fix error message when assigning to a local const variable
Remove front-end optimization that turned load local const
value into a load literal. Change backend to recognize loading
of const locals. This fixes the error message automagically.

Fix for issue 17258

R=srdjan@google.com

Review URL: https://codereview.chromium.org//186853003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33288 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 18:44:53 +00:00
hausner@google.com 97e7f2c299 Fix type checks with malformed types
Parser must continue to parse the rest of an expression that contains
a type test with a malformed type.

Before:
'file:XXX’: error: line 5 pos 12: ')' expected
  if (3 is X && 2 == 2) print("foo");

After:
'file:XXX’: malformed type: line 5 pos 12: type 'X' is not loaded
  if (3 is X && 2 == 2) print("foo");
           ^
type error.
#0      main (file:XXX:5:12)
#1      _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)

R=regis@google.com

Review URL: https://codereview.chromium.org//183743015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33253 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-03 23:27:44 +00:00
rmacnak@google.com b49aa48f07 Fix VM crash when parsing what looks like a closure call during metadata evaluation.
BUG=http://dartbug.com/17141
R=gbracha@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//180313003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33141 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-27 23:24:05 +00:00
hausner@google.com 5920d6c173 Fix formatting issue from previous CL
TBR: iposva

Review URL: https://codereview.chromium.org//179083005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33030 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-25 18:48:37 +00:00
hausner@google.com ad3fb79210 Better error message for assignment to final local variables
“No top-level getter found” becomes “cannot assign to final variable xxx”.

Fixes issue 16782.

R=iposva@google.com

Review URL: https://codereview.chromium.org//177633008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33028 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-25 18:01:35 +00:00
fschneider@google.com 16857e0b13 Revert r32930 (Add more timing information in the VM to track time...)
It caused severe performance regressions that should be addressed.

TBR=asiva@google.com

Review URL: https://codereview.chromium.org//177733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32959 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:15:55 +00:00
iposva@google.com edd82bc688 - Restore the better error message.
R=asiva@google.com

Review URL: https://codereview.chromium.org//170313008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32939 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 22:44:39 +00:00
asiva@google.com 6d313d3797 Add more timing information in the VM to track time spent is dart code Vs native code.
R=johnmccutchan@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//137483010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32930 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 21:30:29 +00:00
lrn@google.com 9c6b5e4823 Doesn't work as written when int != intptr_t.
Review URL: https://codereview.chromium.org//175083003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32898 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 13:34:29 +00:00
lrn@google.com 0dbb989cb8 Add internal operation that converts a growable list to a fixed list.
The conversion breaks the original list, but doesn't copy data.
Currently only used in List.from(Iterable).

BUG= http://dartbug.com/9458
R=floitsch@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//134893003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32896 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 13:15:16 +00:00
regis@google.com 7830430adf Implement eager instantiation and canonicalization of type arguments at run
time using a cache in uninstantiated type arguments.
Remove InstantiatedTypeArguments class.
Fix a bug in optimized code: do not update unused type test cache for Smi.
Fix a bug in optimized code on ARM and MIPS in type test cache lookup.

R=iposva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//154393003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32447 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 19:54:33 +00:00
hausner@google.com ac559f643a Introduce cache of resolved names in library
A name that is not resolved in the local scope gets looked up
in the global scope of the library to which the code being compiled
belongs. The local name dictionary gets searched first, then the
dictionary of each imported library (and and their re-exported
libraries.) Each dictionary lookup includes the lookup of the
mangled getter and setter names, which means that we concatenate
the same name many times.

This change introduces a cache that stores the result of a previous
name lookup, including negative lookup results. The latter is important
to speed up the resolution of names that are not in the global name
space, e.g. class members like .length in lists.

Experiments running dart2js (with VM option --compile_all) show
that this reduces the number of name mangling calls by a factor of 10
and speeds up compiling dart2js by 15%.

R=asiva@google.com

Review URL: https://codereview.chromium.org//135123011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32385 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-06 21:32:31 +00:00
asiva@google.com 29de1e8e59 Enter and Exit scope when calling into the native library tag handler
instead of relying on an outer enclosing scope.

R=hausner@google.com

Review URL: https://codereview.chromium.org//141803019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32346 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-05 23:42:06 +00:00
fschneider@google.com 6ffa061fdf Fix stack height assertion code and free up a bit in the Function tag bits.
The bit has_finally was only used to skip the checking of the stack height
at return statements: There was an unused value floating on top of the
expression stack in unoptimized code if the finally block preceded a normal
return statement. Normallyi, that does not cause harm. Optimized code is not
affected since it has a fixed stack size for expression evaluation.

This CL fixes the stack height for functions with try-finally by introducing
a temporary local where the return value is saved before an inlined
finally-block.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//149603003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32157 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-30 12:12:31 +00:00
rmacnak@google.com 2808e02ca0 VM: Fix crash when a type error is encountered while evaluating metadata in checked mode.
BUG=http://dartbug.com/16321
R=hausner@google.com

Review URL: https://codereview.chromium.org//148263007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32042 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-27 23:50:45 +00:00