Commit Graph

221 Commits

Author SHA1 Message Date
regis@google.com 91388a5f79 Simplify and fix instantiation of recursive types.
Add tests for non-contractive types.
Cleanup language tests status file.
Enhance tracing of type finalization.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34739 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-04 18:27:53 +00:00
regis@google.com f60ab4dd11 Detect and reject illegal recursive types (non-contractive types).
Fixed instantiation and equality of recursive types.
Added many asserts to detect issues with recursive types.
Disabled bad tests. They declare illegal types and will be fixed in a later cl.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34460 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 23:38:18 +00:00
hausner@google.com a7d344aa79 Fix checked tests
Follow-on change to implicit static getter elimination. Class finalizer
needed to be updated accordingly so type checks are made on non-final
fields as well.

TBR

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33435 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-07 16:59:17 +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
regis@google.com 9b13508243 Avoid repeated resolution of types by marking them as resolved.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32706 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-14 17:43:11 +00:00
regis@google.com 9380c54628 Make cycle checking of super interfaces linear instead of quadratic by marking
classes as checked (issue 16343).

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32636 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-13 00:14:36 +00:00
regis@google.com 2673ef210d Do not resolve type arguments when only a resolved type class is needed to
calculate number of type arguments during type finalization (issue 16640).
Add regression test.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32624 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-12 21:18:59 +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
srdjan@google.com 8b7ebed54f Mark optimized code that used CHA for optimization so that lazy class 'finalization' does not invalidate that code.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32335 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-05 20:31:57 +00:00
regis@google.com 8aac3612cf Share the same type parameters of a mixin application class to propagate
identical type arguments to the super type and to the mixin type, thereby
allowing for further optimizations, such as instantiator vector reuse or
sharing of type arguments with the super class.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32140 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-29 21:10:53 +00:00
regis@google.com 17196f6467 Make a type malbounded if one of its type arguments is malbounded, even if
independently of the declared bounds for the type (fix issue 16149).

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31901 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 22:56:35 +00:00
regis@google.com 5fdae0d636 Leave uninitialized type arguments of a type being finalized as null instead of
temporarily setting them to dynamic for improved code robustness, since dealing
with a null type is less forgiving than dealing with dynamic.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31843 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 18:56:10 +00:00
regis@google.com b48d1455c2 Share mixin type with interface type in mixin application classes.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31807 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-14 22:30:59 +00:00
regis@google.com c2f0dec5ec Support bounded mixins in the VM (fix issue 14453).
Add tests.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31794 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-14 18:41:27 +00:00
srdjan@google.com b7d93c342a Fix 15721: When checking for bad overrides we must eagerly finalize superclasses.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31628 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-08 21:45:05 +00:00
zra@google.com fdeff1ba17 Replaces LongJump with LongJumpScope.
LongJump required explicitly restoring the old
long jump base before function return. This was
sometimes forgotten, leading to crashes. This
change puts the base restoration into the
destructor so that it happens automatically on
return.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31463 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-04 01:23:43 +00:00
regis@google.com 3bdeaf9813 Add missing ResolveType call (fix issue 15738).
Remove unused parameter from ResolveType.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31336 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 14:26:53 +00:00
regis@google.com fb6d24945f Introduce class TypeRef in the VM to fully support recursive types.
Fix issues 15244, 15148, 14869, 14000, and 13688 (was closed, but fragile).

Note that the current solution is not final as it may not be correct in more
complex cases not yet covered by language tests.
The final solution will require a 'trail' instead of a simple mark bit to
prevent operations involving recursive types to diverge.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31087 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-11 22:51:19 +00:00
fschneider@google.com cd54507fc2 Mark native functions when they are created.
Until now the parser marked native functions as native when parsing.

This may be too late for some functions. E.g. the native typed list
constructor may not be invoked because the intrinsic code is executed
instead (unless for example new-space allocation fails).

This causes missing type information when optimizing functions using
those recognized factory functions like Uint8List._new.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30846 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-04 10:32:43 +00:00
srdjan@google.com 3274f92827 Rename FinalizeTypeHierarchy to ProcessPendingClasses.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30688 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-27 00:11:32 +00:00
srdjan@google.com 3485989ae7 Do not eagerly finalize classes in CHA, instead regard unfinalized classes as ’non-existent’ and only invalidate optimized code at finalization of the class.
Rename FinalizePendingClasses to FinalizePendingClassInterfaces as the class finalization occurs lazily.
TODO: add dependency information to deoptimize/remove only relevant optimized code.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30582 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 17:59:23 +00:00
regis@google.com d1e945994e Improve type test and type equality for generics (issue 15148).
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30546 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 21:30:51 +00:00
regis@google.com db2cec593d Distinguish between malformed and malbounded types more efficiently using the
recently introduced LanguageError 'kind' field.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30383 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-18 23:31:12 +00:00
regis@google.com 2a355a7bb6 Lazily format LanguageError messages (fix issue 15069).
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30308 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-15 18:54:24 +00:00
regis@google.com 694401d38e Rename mixin typedef to mixin application alias in VM.
R=hausner@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30277 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-14 17:42:39 +00:00
regis@google.com e3da5e16e4 Check type bounds of redirecting factories (issue 14699).
Add tests for malbounded redirecting factories.
Clean up bound checking code and type error reporting code.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30177 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-11 22:59:48 +00:00
hausner@google.com 2139b9d5f0 Undo change 29900
Undo a gratuitous change to the parser.

@kmillikin: please at least be courteous enough to ask one of the front-end
authors to review a change that is not a pressing issue, such as style preferences.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29954 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-06 01:21:32 +00:00
kmillikin@google.com a59e0881cf Clean up Parser::ParseTryStatement in the VM.
Streamline the implementation, factor out repeated code, rename some cryptic
identifiers, and fix a misspelling.

Also, disentangle an implicit include dependency: class_finalizer.cc was
getting code_generator.h implicitly from something included (unnecessarily
as it turns out) by parser.h.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29900 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 12:49:14 +00:00
fschneider@google.com 91ca330ac8 VM: Fix initialization of statics in presence of exceptions.
In a static- or top-level variable v

var v = expr
static v = expr

If the initializer expression expr throws, the VM throws a
CyclicInitializationError when loading v afterwards, even though
this has nothing to do with cyclic initialization.

I'm changing the way implicit static getters and static initializers are
compiled. Static initializers are invoked from static getters.

They look as follows:

get:v {
  if (field.value === transition_sentinel) {
    field.value = null;
    throw new CyclicInitializationError();
  }
  if (field.value === sentinel) {
    field.value = transition_sentinel;
    init:v();
  }
  return field.value;
}


init:v {
  try {
    field.value = expr;
  } catch {
    if (field.value === transition_sentinel) {
      field.value = null;
    }
    rethrow;
  }
}

BUG=http://dartbug.com/5802
TEST=language/lazy_static3_test,
language/throwing_lazy_variable_test,
co19/Language/12_Expressions/30_Identifier_Reference_A08_t02

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29797 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-04 10:08:47 +00:00
fschneider@google.com ce9573722c VM: Fix checked mode crash (issue 13831).
The AST for static getters differs between parsing the first time, and
subsequent parsings. This leads to a mismatch in deoptimization-ids
between the optimized and the unoptimized code.

This CL avoids creating different ASTs for the same static getters. To allow
better inlining of these getters, the initialization expression is wrapped in a
hidden static initializer-function. As a result the size of such getters is
constant and does not depend on the initializer expression.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29680 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 16:49:55 +00:00
regis@google.com 3fa7a61efc Implement latest spec changes regarding malformed types (see issue 14006):
- a malformed type used in a is, as, or catch type test results in a dynamic
  type error being thrown.
- a malformed type is not mapped to dynamic anymore.

For now, this applies to type tests in checked mode as well, but discussion is
still on-going.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29608 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 23:30:32 +00:00
regis@google.com 65379851a8 Implement stricter rule about self referencing typedefs (fix issue 13675).
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29460 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-29 17:04:21 +00:00
regis@google.com 20badfb06e Register synthesized mixin application classes in the library and reuse them
when possible (fix issue 14318).

R=asiva@google.com, hausner@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29276 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-25 19:46:32 +00:00
regis@google.com 177276f059 Report compile-time error for const factories redirecting to malformed type
(fix issue 14305).

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29123 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 21:03:11 +00:00
regis@google.com 9ec07853c5 Report correct error message in case of super invocation (fix issue 8208).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29042 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 22:12:07 +00:00
lrn@google.com 8b1d5720f7 Change "typedef" to "class" in core library and related tests.
R=floitsch@google.com, johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28712 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-16 09:02:46 +00:00
regis@google.com 2f900dab13 Cache number of type arguments in class object instead of recalculating it.
Reduce size of num_native_fields field in class object.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28670 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 18:31:31 +00:00
regis@google.com fcadf9fdd6 Overlap type arguments of a type with the type arguments of its super type
when possible. Overlapping may be partial.
Add flag --overlap-type-arguments controlling this optimization for debugging
and performance measurement (default is true).

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28539 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-11 18:36:25 +00:00
regis@google.com 79b9edbf2a Do not share type arguments of mixin types, but clone them to avoid finalization
errors when cycles are involved (issue 13688).
Add regression test.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28107 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 18:26:05 +00:00
hausner@google.com fcb84c8dc9 Fix expression evaluation in library context
- Use correct source for patch functions when class
  finalizer reports error
- Reinstate support for class in Dart_EvaluateExpr

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28064 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-30 18:49:32 +00:00
regis@google.com 6531272706 Support forwarding constructors for mixin typedefs (issue 11888).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27979 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-27 00:26:22 +00:00
regis@google.com 20c36666b8 Address comments of committed change https://codereview.chromium.org/24397002/
Fix typo in Matthias last commit.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27850 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 20:26:12 +00:00
regis@google.com 3b5628fd1b Support mixin application typedef as mixin in the VM (issues 9383, 12773).
Disallow Object as mixin (issue 10952).
Detect illegal cycles in mixins.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27791 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 00:25:01 +00:00
iposva@google.com d0b681f354 - Write the coverage data to a file instead of printing to stdout.
- Explicitly include lines with zero hits.

R=asiva@google.com, mlippautz@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27726 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 21:37:48 +00:00
regis@google.com 6c92ec5439 Simplify VM internal representation of a mixin application clause (MixinAppType
object) by removing some redundant field and type arguments.
Tolerate mixins with wrong number of type arguments and update tests.
Note: this is a first cleanup step in preparation of more mixin bug fixes.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27363 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 00:41:07 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.

Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.

Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.

Fixes 12915, 12913, 12724.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 21:52:40 +00:00
regis@google.com 765aac1496 Keep track of the application of a mixin type to a mixin application class,
which includes setting up its type parameters (fix issue 12871).

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27157 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 22:21:36 +00:00
regis@google.com 93059fe3cf More cleanup related to malformed and malbounded types.
Remove support for warnings in parser and related flags.
Rename flag --error-on-malformed-type to --error-on-bad-type, since it covers
both malformed and malbounded types (also closer to --error-on-bad-override).

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26677 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 23:24:01 +00:00
regis@google.com 81bcb1f18a Distinguish between malformed and malbounded types (fix issues 12552 and 12554).
Add test.
Update status files.

Explanation of change: A malbounded type argument should not be mapped to
dynamic, as is a malformed type argument.
This change also adds a bunch of TODOs related to the encounter of malbounded
types in unexpected places.
A follow-up change will address these TODOs, add more tests, and may simplify
code that is still handling malformed types where they cannot occur anymore
after the spec simplified their handling.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26665 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 17:56:02 +00:00
regis@google.com 0ab840ae98 Fix bound checking in self referencing type (issue 12553).
Added test.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26444 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 17:22:18 +00:00