John McCutchan
bda2b3d2ff
Source position tests for switch and try catch finally
...
- Give AwaitMarkerNode a token position.
- Make it possible to provide a token position for SaveContext, RestoreContext, StoreContext, and CurrentContext.
- Pass in a token position to internally generated StoreLocal and LoadLocal instructions for try-catch-finally.
- Introduce a Context ClassifyingTokenPosition to be used when we can't attribute a context related instruction to a source position.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1575953005 .
2016-01-12 15:02:35 -08:00
Vyacheslav Egorov
2306f29cc4
Remove unreachable exits from the list collected by InlineExitCollector.
...
Otherwise we might crash if we try to inherit a deoptimization target
from an unreachable exit as it was not visited by SSA construction and
has no environments attached to it.
R=fschneider@google.com
BUG=http://dartbug.com/25364
Review URL: https://codereview.chromium.org/1563703005 .
2016-01-07 15:21:47 +01:00
John McCutchan
a0260c8c24
Add token position to StoreStaticFieldInstr
...
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1568713002 .
2016-01-06 14:38:54 -08:00
John McCutchan
6e4dcdf879
Add a token position to LoadLocal, StoreLocal, and LoadStaticField instructions
...
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1569613002 .
2016-01-06 13:29:01 -08:00
Regis Crelier
48bc8bbf33
Remove instantiator argument in generated code for type tests.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org/1533383003 .
2015-12-21 13:07:32 -08:00
Florian Schneider
f6b96b3d07
Start remove dependencies on compiler-related files.
...
Minimize the number of dependencies of compiler-related files.
This is needed to remove whole .cc/.h files from a compiler-less VM binary which
can be used for running precompiled code.
* removed dependencies of object.cc on flow_graph_compiler.h and flow_graph_builder.h
* removed unnecessary includes from object.h
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org/1411873005 .
2015-11-05 00:08:35 +01:00
Srdjan Mitrovic
772ee329c4
Make ICData changes thread safe (first compute array, then set it). Install code in the main thread instead of in the background compilation thread.
...
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1410363005 .
2015-10-26 15:12:29 -07:00
Srdjan Mitrovic
6f53350611
Move deopt_id and related helpers/definitions from Isolate to Thread
...
BUG=
R=zra@google.com
Review URL: https://codereview.chromium.org/1390153004 .
2015-10-13 10:08:14 -07:00
Regis Crelier
e6225bee44
Improve async code in VM by not unnecessarily capturing parameters of async and
...
sync closures, thereby avoiding copy of parameters on entry.
Remove variable aliases in local scopes now that another mechanism detects
use-before-define cases. Keep aliases only for captured variables of outer
functions thereby speeding up scope lookups for all Dart code (not just async).
The next step will be to try to reduce the number of captured variables in
async code.
R=hausner@google.com
Review URL: https://codereview.chromium.org//1317213003 .
2015-08-27 16:49:07 -07:00
Srdjan Mitrovic
fbc9f6b9d8
Fix (optimizer) crashes in conditional nodes when result is not needed.
...
BUG=
R=hausner@google.com
Review URL: https://codereview.chromium.org//1211593004 .
2015-06-24 11:30:50 -07:00
Regis Crelier
4bf6db0c25
Adjust context level when required before executing inlined finally clauses.
...
Add regression test.
BUG=23537
R=srdjan@google.com
Review URL: https://codereview.chromium.org//1154823003
2015-06-03 10:31:48 -07:00
Florian Schneider
88d316fbc0
VM: Fix two incorrect function fingerprints.
...
The checking code was broken for a while, so this mismatch was not noticed.
BUG=
R=vegorov@google.com
Review URL: https://codereview.chromium.org//1156423002
2015-05-29 12:20:09 +02:00
Daniel Andersson
ea46192ca3
VM-internalize the default Map implementation.
...
Make the compact linked hash map, which is the default implementation for Map
(including map literals), a VM-internal class.
This makes it easy to have more efficient serialization of maps (although for
now, the implementation is straight-forward).
Refactor the compact hash class hierarchy to enable the VM-internal class and
the rest (also the Set classes) to share a maximal amount of code, by using
two different bases for implicit/explicit fields.
Remove existing proof-of-concept, C++-based internal VM-class.
BUG=http://dartbug.com/22982
R=asiva@google.com
Review URL: https://codereview.chromium.org//1151523002
2015-05-28 09:32:54 -07:00
Matthias Hausner
bdf8124301
Add 3 new tokens and fix all the fallout from changing token values.
...
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//1142423003
2015-05-21 09:06:11 -07:00
asiva@google.com
579fc0fd2e
Some more cleanup of the finger print checking code.
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//1136163002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45742 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 18:14:18 +00:00
koda@google.com
b5ea484105
Share code for building recognized native getters.
...
Internalizing the maps will add a few more of these, so let's avoid duplication.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//1124963002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45547 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 02:49:56 +00:00
koda@google.com
9c181ec6d5
Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
...
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.
Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.
Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).
R=iposva@google.com
Review URL: https://codereview.chromium.org//982873004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +00:00
hausner@google.com
9a6ed9a718
Implement async* functions in VM
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//944893005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44185 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 17:49:53 +00:00
hausner@google.com
2487c76886
Add support for sync* and yield and yield*
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org//888463004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43516 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 18:36:40 +00:00
zerny@google.com
e449cd0329
Propagate the stack trace of the inner-most throw when using async/await.
...
This patch does not provide a full async stack trace, it only ensures
that the inner-most stack frame will be the point of the initial throw.
BUG=http://dartbug.com/22009
R=iposva@google.com
Review URL: https://codereview.chromium.org//893193004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43463 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 11:54:23 +00:00
srdjan@google.com
12c5e2bbaf
Cleanup: use const reference for ParsedFunction where possible.
...
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//878243002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43226 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-28 00:41:09 +00:00
srdjan@google.com
110a74f954
Cleanups: parsed_function()->function() => function()
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//881063003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43213 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 22:09:31 +00:00
vegorov@google.com
e31313efea
Refactor _ByteDataView.[set|get]<Type> methods to improve their performance.
...
- don't manually truncate values before passing them to TypedData._[set|get]<Type> - these methods already have truncating semantics;
- don't call into runtime for endianess conversion, implement it in pure Dart instead (with an intent to provide optimized version on platforms that support fast byte-swapping instructions);
- force inlining of these methods (change the order of checks in the ShouldWeInline to guarantee inlining of whitelisted methods).
Unrelated change:
- tweak output of Function::CheckSourceFingerprint to be immediately copy&paste useful.
R=fschneider@google.com
BUG=http://dartbug.com/22107
Review URL: https://codereview.chromium.org//860963002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43038 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 14:21:49 +00:00
fschneider@google.com
9fad07f46e
Enable inlining inside try-blocks in the VM's optimizing compiler.
...
R=vegorov@google.com
Review URL: https://codereview.chromium.org//773183002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42103 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 12:29:28 +00:00
srdjan@google.com
bad6a61899
Cleanups.
...
R=vegorov@google.com
Review URL: https://codereview.chromium.org//774763002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42069 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 18:48:12 +00:00
hausner@google.com
4bf624ebc0
Implement enum types in VM
...
Fully support enum types as per language spec version 1.6.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//735723003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41815 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-18 23:10:07 +00:00
fschneider@google.com
7bec3edaef
Remove saving/restoring of the context at function entry.
...
This is not needed anymore after I changed the current context
to always reside in a local variable.
Further simplifications and cleanup in the debugger.
This also fixes a bad memory retention problem with
non-capturing closures.
BUG=dartbug.com/18886
TEST=tests/language/vm/closure_memory_retention_test.dart
R=hausner@google.com
Review URL: https://codereview.chromium.org//695483003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41433 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 07:35:51 +00:00
fschneider@google.com
876193b31a
Make CTX allocatable by the register allocator.
...
This change makes CTX available by not caching the current
context while in Dart code. Instead the current context
is held in a local variable (:saved_current_context_var) and
is passed as argument in CTX at calls.
This also simplifies a lot of code in the debugger: As a result,
Isolate::top_context is not needed anymore since the current context
can always be extracted from a Dart frame.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//678763004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41422 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-30 15:42:38 +00:00
fschneider@google.com
c4ff0631f8
Initialize the async jump variable with a smi to avoid polymorphic comparison.
...
Using the implicit initial null value makes the comparison in the dispatch
prologue of async closures polymorphic (Null|Smi). Initializing to it -1
eliminates the unnecessary class check for null.
Small clean up of scopes and internal variables used for async functions:
Capture them in the parser, so that there is no need to do this later in the
async-transformer.
R=hausner@google.com
Review URL: https://codereview.chromium.org//655773003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41123 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 11:41:22 +00:00
hausner@google.com
2f49f29c38
Await always waits
...
The expression ‘await e’ always suspends the enclosing function. If e does not
evaluate to a an object o of type Future, a new Future is created using Future.value(o).
A small change in the backend allows a return instruction to be followed by
other instructions. In async functions, a return can suspend the function and the
continuation point is in the same code block after the return.
Other small changes:
- More user-friendly error message if async/await is not enabled.
- Programs no longer need to import dart:async when using async/await.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//634603002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41105 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 19:58:06 +00:00
fschneider@google.com
da0fb6bbe2
More intrinsics in IR.
...
R=srdjan@google.com , vegorov@google.com , zra@google.com
Review URL: https://codereview.chromium.org//513213002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40088 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-10 13:34:58 +00:00
mlippautz@google.com
98628f3543
Enable await in while and do-while.
...
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org//538703002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39839 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 21:51:15 +00:00
mlippautz@google.com
7c7919f8ef
Await it!
...
Add support for awaiting futures. This leaves us with a non-structural CFG.
TODOs:
* Forwarding exceptions through futures in async functions and rethrowing them using await.
* Known bug with nested contexts (will be fixed in following CL)
* await is not recognized at all expressions specified (yet)
BUG=
R=hausner@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//484933003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39559 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-26 17:35:56 +00:00
fschneider@google.com
950e2dfeb5
Eliminate calls to Isolate::Current from the flow-graph builder.
...
Instead, use the saved isolate of the graph builder.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//360503003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37811 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 09:04:32 +00:00
regis@google.com
8cf0d1034e
Ensure that a javascript compatibility warning results in a
...
JavascriptCompatibilityError being thrown in all cases when --warning_as_error
is specified.
Prior to this change, some javascript compatibility warnings resulted in a
compile time error.
Change expectations accordingly in tests.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//347873002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37515 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 20:57:41 +00:00
regis@google.com
32f3e11d99
Cleanup of error and warning reporting.
...
R=hausner@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//340203003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37468 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 22:30:34 +00:00
srdjan@google.com
ee210974f6
Reduce default capacity of growable list from 4 to 2 elements. Improves performance.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//337383004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37421 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 20:49:47 +00:00
srdjan@google.com
58fd318f4c
Cleanup: use a ZoneGrowableArray instead of Array for ICData map.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//333403002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37400 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 15:52:05 +00:00
iposva@google.com
ab18821876
- Fix the external_test.dart as it was relying on outdated
...
functionality and broken syntax. So some tests were passing
for the wrong reason.
- Fix the VM parser to properly report the compilation errors.
- Fix the generation of pretty names of private identifiers.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org//269253007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37208 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 22:19:33 +00:00
srdjan@google.com
3480ac4a0e
Fix deferred library code disabling for inlined functions.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//313403004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37107 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 22:14:40 +00:00
srdjan@google.com
ce2d52f111
Pass isolates explicitly.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//306643002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36740 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 14:24:53 +00:00
srdjan@google.com
16282635a1
Use isolate when allocation Zone objects and handles: focus on FlowGraphOptimizer, next inliner.
...
R=regis@google.com
Review URL: https://codereview.chromium.org//298913007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36587 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 21:15:29 +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
srdjan@google.com
031b2a5e80
Fixes crash (issue 18662).
...
Prevent EffectGraphVisitor from emitting constants as they have no effect and will cause SSA builder to crash. Remove one optimization in graph buidler, but left the one that eliminates type tests against dynamic and Object as that is a frequent case in checked mode and reduces generated code.
R=regis@google.com
Review URL: https://codereview.chromium.org//269273002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35855 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-07 17:40:22 +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
srdjan@google.com
f18d761b87
Merge ConstantInstr -> UnboxDouble to UnboxedConstant. Reduces register usage and allows for various optimization with constants.
...
R=fschneider@google.com
Review URL: https://codereview.chromium.org//266633007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35663 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-01 22:03:21 +00:00
fschneider@google.com
1933c126c8
VM: Explicitly load function and context before calling a closure.
...
Before these were implicitly loaded as part of the closure calling code sequence.
This CL makes those loads canditates for load elimination. The context is also
explictly stored before the call.
R=regis@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//265443002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35595 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-30 20:14:02 +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
regis@google.com
98bcbb0dae
Do not ignore side effects of a type test or type cast as expression, such
...
as bound errors in checked mode.
Added tests.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//246293008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35284 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-22 20:48:13 +00:00
fschneider@google.com
53abcebbf9
VM: Replace StoreVMField with StoreInstanceField.
...
This simplifies a lot of code in the optimizer and avoids the confusion
and errors due to mismatch input operands when using StoreVMField.
I added a separate constructor for LoadFieldInstr to avoid having
to explicily set the associated field there.
R=regis@google.com
Review URL: https://codereview.chromium.org//179443004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33059 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-26 12:12:40 +00:00