Commit Graph

7115 Commits

Author SHA1 Message Date
sgjesse@google.com b6d16215aa Revert "Make stdout/stderr async"
This reverts r41350.

There are test-failures that needs to be analyzed.

TBR=iposva@google.com, ajohnsen@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41353 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 09:07:56 +00:00
sgjesse@google.com c50df5e563 Make stdout/stderr async
This makes stdout.write and stderr.write async.

This effectively reverts https://code.google.com/p/dart/source/detail?r=33645

R=iposva@google.com, ajohnsen@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41350 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 08:53:10 +00:00
iposva@google.com d309354728 Fix SIMARM64 and SIMMIPS builds:
- Use DEBUG_ASSERT as needed for Mutex::Owner() access.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41334 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 19:51:46 +00:00
iposva@google.com 55357d2993 - Use the simulator to do atomic operations that could also
be executed in generated code.

R=koda@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41332 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 19:21:33 +00:00
hausner@google.com 95dc65a0e9 Implement await for statement
Implement await for statement to iterate over streams. Uses
the built-in class StreamIterator.

await for (var e in stream_expr) {
  S;
}

Is translated to:

var it = new StreamIterator(stream_expr);
while (await it.moveNext()) {
  var e = it.current;
  S;
}

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41328 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 18:03:43 +00:00
turnidge@google.com c658fa60f9 Fix deadlock that can occur while handling service messages at a breakpoint.
Deadlock looks like:

  Regular Isolate
  -> paused at breakpoint in debug message loop
  -> holds debug message queue lock to get message notifications
  -> handles an service message
  -> waits for portmap lock to send response

  Service Isolate
  -> receives request for paused isolate
  -> holds portmap lock to send message
  -> runs custom message notifier to wake debug message loop
  -> waits for debug message queue lock

I've solved this by releasing the debug message queue lock while
handling service messages.  This requires me to poll for new service
messages after reacquiring the debug message queue lock to make sure I
haven't dropped any notifications.

It's a little weird that the embedder (runtime/bin) needs to be aware
of the locking in the core vm (runtime/vm), but this seemed like the
simplest fix for now.

BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41326 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 16:57:21 +00:00
lrn@google.com 8050a0392b Fix assertion not holding (calling with start==end) and typo.
Review URL: https://codereview.chromium.org//677423002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41317 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 14:00:13 +00:00
fschneider@google.com cedcd90984 Remove dead code from InvokeDartCode stub.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41316 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 13:43:17 +00:00
lrn@google.com 7485b6fff2 Fix type-errors.
R=whesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41315 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 13:33:49 +00:00
lrn@google.com a3dd8cd26f Fix typo reutrn -> return typo.
R=whesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41314 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 13:05:21 +00:00
vegorov@google.com acee3f390f Revert "Revert "IR refactoring: reduce duplication related to MayThrow/AllowsCSE.""
This relands commit r41281.

TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41312 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 12:13:37 +00:00
lrn@google.com e2e17c3f26 Make JSON parsing work as a chunked conversion sink.
This allows JSON parsing to work on individual chunks of source instead
of collecting and concatenating all the parts before parsing.

This is made in anticipation of having a UTF-8 version that parses directly
on the input codes, without creating a String first.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41311 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 12:11:39 +00:00
vegorov@google.com ad57bec275 Revert "IR refactoring: reduce duplication related to MayThrow/AllowsCSE."
This reverts commit r41281.

Old Mac OS X bots are unhappy (GCC frontend used on those bots can't correctly resolve reference to the base constructor unless all template parameters are specified).

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41284 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 16:05:59 +00:00
vegorov@google.com 6b4677a431 IR refactoring: reduce duplication related to MayThrow/AllowsCSE.
Fold those things into TemplateInstruction/TemplateDefinition.

R=fschneider@google.com, zerny@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41281 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 15:10:11 +00:00
fschneider@google.com 1dc4e979d9 Remove isolate pointer from context objects.
By moving all stubs that do runtime calls into the isolate
we don't need to cache the current isolate in each context
object.

This saves space on each context at the cost of duplicating stubs
in each isolate. Most stubs are already isolate-specific and the total number
 of stubs is small enough for this to be a good trade-off.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41279 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 12:19:20 +00:00
vegorov@google.com fb915fe887 IR cleanup: pass deopt id as constructor argument instead of doing deopt_id_ assignment.
This also kills a list of Instruction friends that was growing without bounds.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41278 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 11:27:17 +00:00
fschneider@google.com 81eacccfa3 Simplify SnapshotReader::LookupInternalClass.
All callers of this function assert that the returned RawClass
is non-null. Also, the returned Class is only used to extract its class id.

I removed the unreachable code and simplified it accordingly to just return
the class id directly.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41277 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 09:37:04 +00:00
kustermann@google.com 360dfe4f41 Several bugfixes in dart:io's handing of sockets
This CL includes fixes for the following issues:

a) The event handler created listening socket metadata (values of a hashtable
indexed by filedescriptor) sometimes as SocketData and sometimes as
ListeningSocketData depending whether the socket has been listened to or not.
This was very buggy, in particular because multiple isolates can have a
reference to the same server socket in different states (opened, listened,
closed).

=> This should be fixed by sending the file descriptior typeMask always to the
   eventhandler.

b) A server socket cloned via the ServerSocketReference mechanism, opens a
receive port for sending (fd, address, port) to isolates/... which want to
create a server socket from the reference.
This receive port was not closed properly when calling only close() (and not
listening first).

=> This should be fixed by closing this receiveport on the ServerSocket.close()
   call as well.

c) It was assumed in the event handler that a close command needs to have the
Dart_Port in a hash table. But this is only the case if the user actually
listened to the ServerSocket. Otherwise the event handler does not know about
the server socket. This caused a NULL dereference which resulted in a SEGFAULT.

=> This should be fixed by checking if the Dart_Port is in the hashmap of the
ListeningSocketData or not.

d) Too many bits were considered when extracting token count in C++ code.

The CL includes a regression test which should trigger these issues.

BUG=21384,21383
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41276 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 08:55:50 +00:00
iposva@google.com abd65a6bec - Make sure the VM actually asks for libdl when being linked.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41264 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-23 18:20:50 +00:00
koda@google.com 516a33a0cc Avoid races in capacity accounting.
Use pages_lock_ to sync access to usage_.capacity_in_words.
Also remove ASSERT no longer valid with concurrent sweep.

This does not resolve the more general issue of the growth policy not being perpared for concurrent sweeping.

BUG=21363
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41251 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-22 20:41:44 +00:00
johnmccutchan@google.com fb7f8551b4 Add unboxed Mint for X64
BUG=
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41233 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 18:11:43 +00:00
iposva@google.com c7c9d5d12f Fix http://dartbug.com/21335
- Make the VM internal AssertionError, TypeError and CastError implement
  the public classes instead of patching them.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41231 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 17:00:16 +00:00
fschneider@google.com c6e2650073 VM: Avoid repeated deoptimizations from hoisted array bounds checks.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41223 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 10:36:52 +00:00
koda@google.com ede485669b Fix test timeout; faster DEBUG String::CharAt by not using mutable accessor.
BUG=dart:21343
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41218 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 00:15:43 +00:00
iposva@google.com 3feded1f47 - Rename flags to reflect the generation impacted.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41202 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 15:26:04 +00:00
vegorov@google.com dde7963d36 Ignore redundant parallel moves when checking if a block is empty.
Single predecessor blocks containing nothing but redundant parallel moves can be compacted away.

R=zerny@google.com
BUG=http://dartbug.com/21302

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41187 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 11:29:19 +00:00
iposva@google.com 6266f1d4a0 - Do not attempt to set parameter types if they
were already finalized.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41182 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-17 21:50:28 +00:00
iposva@google.com 39703863c4 - Add a separate step to finalize the VM isolate explicitly.
- Allocate the method extractor parameter types and names
  only once, namely in the VM isolate.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41173 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-17 17:02:19 +00:00
srdjan@google.com 3dbcfcca7a Fix issue 21159: prevent endless inlining of field dispatchers.
Review URL: https://codereview.chromium.org//659793003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41156 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-16 17:13:01 +00:00
srdjan@google.com 5b9f017992 Fix issue 20133: do not crash if debug port is illegal.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41155 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-16 17:08:22 +00:00
fschneider@google.com 04563b8bce Fix crash with --trace-deoptimization-verbose and tweak formatting.
Uninitialized instances (e.g. closures) can't be printed using ToCString.
Print just the class instead.

Print values/addresses consistently with our disassembly output (no leading zeros)
This makes searching in the trace output easier.

Limit printing source lines to max 80 chars. Otherwise the trace output for
minified Dart code gets unreadable.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41134 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 15:49:40 +00:00
fschneider@google.com 9087108b5f VM: Avoid repeated deoptimization on speculatively hoisted smi-checks.
This adds the same check as we already have for CheckClass for
CheckSmi and CheckEitherNonSmi instructions to avoid repeated
deoptimization after LICM.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41133 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 15:46:49 +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
vegorov@google.com 3d0ddfce79 BoundsCheckGeneralizer::Simplify should ignore unsupported binary ops.
R=fschneider@google.com
BUG=http://dartbug.com/21324

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41118 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 10:26:37 +00:00
hausner@google.com 053dc6eaee Fixing release build
Make compiler happy.

TBR=srdjan

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41106 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 20:07:48 +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 e6ef4b16bf Fix captured parameters and optimized try-catch.
The stack slots of captured parameters must be skipped when
generating sync code in optimized try-catch. Since those parameters
are initially copied into the context, their values are not recorded
in the environment.

Store-to-load forwarding may though use the original initial value
from the stack and therefore it must not be overwritten by try-sync
code that predeeds every call inside optimized try-blocks.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41099 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 14:48:32 +00:00
rmacnak@google.com 2b51264dcf Make deserialization more regular as prep for deferring canonicalization for types/instances.
BUG=http://dartbug.com/21079
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41089 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 01:16:00 +00:00
hausner@google.com 05398d6e02 Reuse function objects of async closure body
When an async function is compiled, it creates a closure that contains the code of the async function’s body. Before this change, a new function object is created each time the async function is compiled. This change looks up previously created closures and reuses them, similar to what the parser does for local functions.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41084 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-13 21:38:12 +00:00
koda@google.com 1fbac47d9e Write barrier audit: const raw_ptr()
raw_ptr() now returns a const*, and all writes within objects must be routed through a well-defined set of methods on Object.

Note: This also includes writes to non-pointer fields, to enable low-level verification of all writes. Additionally, it allows enforcing a NoGCScope around such writes to protect against moving objects.

Add a bunch of these (now required) NoGCScopes.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41058 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-11 00:26:54 +00:00
koda@google.com b7db007f71 Fix Object::Clone.
Exclude header when copying: default value for its tags will be that of a fresh object.
Correct logic for adding the clone to the store buffer.

BUG=21273

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41055 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 23:26:58 +00:00
regis@google.com 8e8456cfdb Fix x64 build (RBX is callee-saved, use R8 instead).
Review URL: https://codereview.chromium.org//643293002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41053 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 20:43:44 +00:00
regis@google.com 3e4f87790e Implement bigint absAdd, absSub, mulAdd, sqrAdd, estQuotientDigit intrinsics,
and Montgomery mulMod intrinsics on x64.
Add support for mul, div, shld, adc, sbb instructions on x64.
Add assembler tests.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41050 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 19:50:03 +00:00
iposva@google.com 1cae9b9c40 - Fine grain locking of free list when sweeping concurrently.
Review URL: https://codereview.chromium.org//649743002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41049 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 19:44:41 +00:00
koda@google.com 9fc1ca4536 Add unit test for freeing VirtualMemory.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41043 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 15:41:00 +00:00
zra@google.com f3a21e3ff3 Uses correct mnemonic for vmrs instructions.
Keeps vmstat as a macro.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41042 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 15:30:41 +00:00
zra@google.com 677a4709ce Uses stp/ldp for frame entry/exit on arm64.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41041 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 15:29:27 +00:00
regis@google.com 2d677be961 Implement bigint absAdd, bigint absSub, and Montgomery mulMod intrinsics on ARM.
R=johnmccutchan@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41036 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 07:49:27 +00:00
johnmccutchan@google.com 7bbdfc2e16 - Use UnboxedInt32 and UnboxedUint32 representation for LoadIndexedInstr
- Avoid inserting an check class instruction for Uint32 and Int32 arrays on StoreIndexedInstr
- Implement Int32ToDouble on all architectures
- Add Int32 to double instruction to ARM64 and simulator.
- Add Int32 to double instruction to X64.

R=vegorov@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41025 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 20:49:15 +00:00
koda@google.com 299cc226b8 Fix windows build.
TBR=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41020 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 16:09:59 +00:00