Commit Graph

226 Commits

Author SHA1 Message Date
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Kevin Millikin f26e70ad3e Remove the LoadLocal used at the end of a temp local scope.
The previous pattern was:

1. FP-relative load of the top of the stack
2. Push #1
3. Pop
4. Pop
5. Push #3

Where #5 was omitted when the value was unused.

The new pattern is:

1. Pop
2. Push #1

Where #2 is omitted when the value is unused.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1963683003 .
2016-05-20 12:40:10 +02:00
Florian Schneider 2783afd607 VM: Fix receiver type propagation in presence of try-catch.
With catch blocks appearing as additional function entry blocks,
there can be phis for the receiver (parameter 0).

This CL fixes the problem that the receiver type information
was lost in the presence of try-catch.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1841073003 .
2016-03-30 15:55:11 -07:00
Srdjan Mitrovic 0c77e70b49 Cleanup access to guarded_fields
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1712563006 .
2016-02-19 11:07:44 -08:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Regis Crelier b116694c84 Fix building of closure type arguments (fixes #25543).
Re-enable skipped test with --noopt.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1631803003 .
2016-01-25 13:58:00 -08:00
John McCutchan 77101d63e3 Source positions for constructors and lots of async machinery
- Rework token position address space.
- Use ClassifyingTokenPositions::kMethodExtractor for the token position of a method extractor.
- Plumb token positions through all of Ast Transformer.
- Plumb token positions for temporary expressions, etc in Flow Graph Builder.
- Add token positions for parts of the await machinery.
- Move ClassifyingTokenPositions into token.h.
- Remove default token position of Scanner::kNoSourcePos for many IR instructions.
- A couple of unit tests.
- Use synthetic token positions for synthetic AstNodes.
- Fix SLEB128 encoding / decoding + test
- s/Scanner::kNoSourcePos/Token::kNoSourcePos.
- Remove >= 0 and < 0 checks against token positions and use helpers instead.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1589643002 .
2016-01-19 15:01:08 -08:00
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