Commit Graph

15405 Commits

Author SHA1 Message Date
ager@google.com e286176171 Implement File.{readAsBytes, readAsText, readAsLines}.
Convenience methods to use if all you care about is getting the
entire contents of a file.

R=sgjesse@google.com
BUG=1579
TEST=standalone/FileTest

Review URL: https://chromiumcodereview.appspot.com//9452014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4568 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-24 13:31:38 +00:00
asiva@google.com dfdbec210a Fix build break.
TBR=srdjan
Review URL: https://chromiumcodereview.appspot.com//9455032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4556 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 23:43:14 +00:00
asiva@google.com 26d2689283 Change the generated dart test in CodeIndexTableTest so that it does not induce a deep recursion in the dart code generator.
Review URL: https://chromiumcodereview.appspot.com//9454024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4555 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 23:01:45 +00:00
srdjan@google.com e8114222fe New compiler, intermediate language, type testing and casting changes as agreed with Kevin.
Review URL: https://chromiumcodereview.appspot.com//9454022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4554 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 22:51:18 +00:00
srdjan@google.com e6d87ec63f When tracing type checks in runtime, also print the method where the type check occured.
Review URL: https://chromiumcodereview.appspot.com//9447028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4551 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 20:03:02 +00:00
hausner@google.com 1ecc0a9e97 Fix handling of unresolved names
Fixes issue 1805 (http://code.google.com/p/dart/issues/detail?id=1805)

The VM didn't turn unresolved identifiers into instance getter calls in all cases. Refactored the code that handles primary expressions.
Review URL: https://chromiumcodereview.appspot.com//9453020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4550 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 19:55:57 +00:00
srdjan@google.com e3c98a5e19 Enable new compiler in x64 mode (bail-out all the time, but we can use automated testing).
Disable CodeIndexTable test inde debug x64. This CL includes a pending CL from Kevin (will wait for it to be submitted).
Review URL: https://chromiumcodereview.appspot.com//9443021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4549 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 19:24:14 +00:00
srdjan@google.com 00ae8f2985 Fix issue 1741: add map to immutable list.
Review URL: https://chromiumcodereview.appspot.com//9456017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4548 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 19:23:41 +00:00
kmillikin@google.com 023b02d54c Implement a simple InstructionVisitor class.
The instruction visitor visits each block and for each block each
instruction.  Rewrite the instruction printing code to use this new
visitor.

R=srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9453014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4547 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 18:29:58 +00:00
kmillikin@google.com 164832b3a3 Add type testing and casting support.
Introduce a virtual tag() function to Instruction classes, use it to
implement type testing and casting.  Use type testing and casting to
eliminate some virtual functions on the instruction classes.

R=srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9454012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4546 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 18:15:11 +00:00
kmillikin@google.com 131632ab24 Fix a pair of bugs in the translation of 'if' nodes.
The condition graph fragment was appended twice, and the join did not
properly handle the case of nonlocal exits from the arms of the 'if'.

R=srdjan@google.com
BUG=
TEST=all tests pass in x64 release mode with --use_new_compiler

Review URL: https://chromiumcodereview.appspot.com//9456009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4545 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 18:09:44 +00:00
srdjan@google.com d89a53417b Added LongJump for bailout. When trying to fix all crashes, CHECK_ALIVE did not scale well as bailing out mechanism.
Implemented UnaryOpNode. Fix crashes.
(this CL also includes the patches from https://chromiumcodereview.appspot.com/9429056/, will remove them once syncing with submitted 9429056)
Review URL: https://chromiumcodereview.appspot.com//9443002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4541 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 16:14:01 +00:00
ager@google.com e92d0eab5a Reimplement Windows Monitors.
Now using an event object per thread which is linked into a list
of waiters for the monitor.

Notify takes the first element of the list and notifies (FIFO order).

Notify all extracts the entire list and notifies each of them. This
avoids the issues with fairness and correctness of the previous version.

The MonitorWaitData object holding the event and a pointer to the
next waiter is stored in thread local storage and lazily initialized.

R=sgjesse@google.com,asiva@google.com
BUG=1614
TEST=

Review URL: https://chromiumcodereview.appspot.com//9424050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4537 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 15:24:18 +00:00
whesse@google.com f3ab33610d Use correct format for gyp file when adding -ldl linker flag.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9452013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4536 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 14:52:40 +00:00
whesse@google.com 47f51c1053 Add -ldl linker flag to libdart_builtin link step.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9447018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4532 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 14:25:52 +00:00
whesse@google.com 33acdc584a Add -ldl linker flag to Dart shell extensions test shared library link.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9442016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4530 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 13:46:36 +00:00
whesse@google.com 0e40002890 Add native extensions to the Dart shell, on the linux platform.
BUG=
TEST=standalone/TestExtensionTest

Review URL: https://chromiumcodereview.appspot.com//9430051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4529 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 13:25:11 +00:00
sgjesse@google.com e07a1f818e Fix bug in Directory after porting to using native ports
The full path was no longer provided to the directory handler

R=ager@google.com

TEST=tests/standalone/src/DirectoryTest.dart

BUG=

Review URL: https://chromiumcodereview.appspot.com//9452009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4521 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:13:35 +00:00
sgjesse@google.com 5a38a88099 Port async file operations to be using native ports instead or an isolate
R=ager@google.com

Review URL: https://chromiumcodereview.appspot.com//9415043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4520 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:11:48 +00:00
kmillikin@google.com 392cdd56ef Recognize basic block entries in the flow graph.
Also, instead of keeping a list of all instructions, keep a list of only
block entries.  The printing implementation is changed (for the better) to
use the new representation.  With --use_new_compiler and --print_flow_graph
the function:

main() {
  var f = 1;
  var n = 5;
  while (n > 0) {
    f = f * n;
    n = n - 1;
  }
  print(f);
}

prints as:

 0: [target]
    StoreLocal(f, #1)
    StoreLocal(n, #5) goto 1
 1: [join]
    t0 <-LoadLocal(n)
    t0 <-InstanceCall(>, t0, #0)
    if t0 goto(2, 3)
 2: [target]
    t0 <-LoadLocal(f)
    t1 <-LoadLocal(n)
    t0 <-InstanceCall(*, t0, t1)
    StoreLocal(f, t0)
    t0 <-LoadLocal(n)
    t0 <-InstanceCall(-, t0, #1)
    StoreLocal(n, t0) goto 1
 3: [target]
    t0 <-LoadLocal(f)
    StaticCall(print, t0)
    return #null

R=srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9429056

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4515 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 09:09:45 +00:00
srdjan@google.com a396e575ee Fix Issue 1804: Forgot to rename one virtual function.
Review URL: https://chromiumcodereview.appspot.com//9429072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4503 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 22:41:56 +00:00
iposva@google.com f0c1954e9b Fix issue 732:
- Add handling for #resource library tags: Ignore at runtime, they are only used
  by the Dart Editor at the moment.
Review URL: https://chromiumcodereview.appspot.com//9431038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4493 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 21:40:07 +00:00
regis@google.com 1442b01a25 Fix typo in --verify_implements functionality (issue 1291).
Review URL: https://chromiumcodereview.appspot.com//9433047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4481 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 18:42:09 +00:00
srdjan@google.com 251439618f Disable invocation of otpimizing compiler on x64 regardless of optimization_invocation_threshold value.
Review URL: https://chromiumcodereview.appspot.com//9431036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4478 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 17:54:57 +00:00
regis@google.com 25fcaf5044 Generic bound errors are static type errors not to be reported by the VM.
Review URL: https://chromiumcodereview.appspot.com//9428015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4476 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 17:48:05 +00:00
srdjan@google.com ab73a42f2d List.add is void (returns null). Fix issue 1213.
Review URL: https://chromiumcodereview.appspot.com//9431024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4475 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 17:46:38 +00:00
kmillikin@google.com 552825c221 Required rename on x64 platform.
Due to a name clash, rename class Instruction => InstructionPattern.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9429055

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4466 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 16:38:56 +00:00
ager@google.com 7e4a36278f Implement File.directory() and File.directorySync() to get
containing directory for a file.

BUG=dart:1618
TEST=standalone/FileTest

Review URL: https://chromiumcodereview.appspot.com//9416096

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4464 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 16:18:39 +00:00
srdjan@google.com 7e24821862 Implement more missing pieces in VM's core library. Although it does not seem to make sense to have toStringAsFixed, toStringAsExponential and toStringAsPrecision in integers, the interface 'num' specifies them, most likely because of troubles in Javascript versions.
Note that Double_toStringAsExponential and Double_toStringAsPrecision are still unimplemented in C++. Instead of crashing, throw an exception. Also fix argument passing.
Review URL: https://chromiumcodereview.appspot.com//9416084

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4463 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 15:31:08 +00:00
kmillikin@google.com 41e77a0a9e Initial implementation of a flow-graph builder for Dart's AST.
Visit the AST and generate an instruction (ie, not basic-block) flow
graph.

The flow graph for the simple function:

main() {
  var f = 1;
  var n = 5;
  while (n > 0) {
    f = f * n;
    n = n - 1;
  }
  print(f);
}

is:

       1: StoreLocal(f, #1)
       2: StoreLocal(n, #5)
       3: [join]
       4: t0 <-LoadLocal(n)
       5: t0 <-InstanceCall(>, t0, #0)
       6: if t0 goto(7, 15)
       7: [target]
       8: t0 <-LoadLocal(f)
       9: t1 <-LoadLocal(n)
      10: t0 <-InstanceCall(*, t0, t1)
      11: StoreLocal(f, t0)
      12: t0 <-LoadLocal(n)
      13: t0 <-InstanceCall(-, t0, #1)
      14: StoreLocal(n, t0) goto 3
      15: [target]
      16: t0 <-LoadLocal(f)
      17: StaticCall(print, t0)
      18: return #null

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9414003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4460 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 15:20:13 +00:00
sgjesse@google.com 46e44ecba1 Add both sync and async methods for getting streams for a File
The File class used to have two synchronous methods
openInputStream and openOutputStream for getting streams for a
file. These have now been changed to work asynchronously by the
associated callback inputStreamHandler or outputStreamHandler
when the stream is opened and available.

To support the synchronous API two new methods
openInputStreamSync and openOutputStreamSync which returns the
stream directly as before have been added.

The actual implemnetation of the file streams still uses the
synchronous file API internally. However this change
adds "simulated" handling of noPendingWriteHandler and
closeHandler for file output stream.

R=ager@google.com

BUG=dart:1784

TEST=

Review URL: https://chromiumcodereview.appspot.com//9432023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4452 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 14:11:04 +00:00
cshapiro@google.com fb485357cb Thread the weak persistent handle free-list through the raw_ field.
As free-list pointers are either the address of the next free handle
or NULL, raw_ fields should conveniently appear as a smi and be
ignored during weak reference processing.  Ordinary persistent handles
already reuse the raw_ field for this purpose and rely on confusing
free-list links with tagged smi values.

Of course, nothing strictly requires that the addresses of handles be
aligned in just the right way.  So, just in case, new asserts check
that raw_ field values are not confusable with tagged heap addresses.

Review URL: https://chromiumcodereview.appspot.com//9413003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4423 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 03:52:12 +00:00
jjb@google.com a2f2769ec3 Wrote functions to convert collections and maps to strings and invoked
these functions from the toString methods of all built-in Collection
and Map implementations. Wrote smoke tests and basher tests.
Review URL: https://chromiumcodereview.appspot.com//9431015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4421 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 02:28:01 +00:00
srdjan@google.com c8fa1ae3b4 Fix for 1267: Implement (partially) Math.pow for integers.
Review URL: https://chromiumcodereview.appspot.com//9372078

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4419 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 01:41:13 +00:00
srdjan@google.com a54f33bf92 ICData is now a wrapper object that refers to the calling function, target name, ic data array, etc. The old ICData C++ class that wrapped around an Array is removed. The advantage is that the ICData object remains the same, only its ic_data array object is being modified as classes are added..
TODO: store ICData-s into function so that the type feedback can be easily extracted (currently must traverse the unoptimized code).
Review URL: https://chromiumcodereview.appspot.com//9395016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4417 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 00:40:03 +00:00
iposva@google.com a68ea7e455 - Windows only: Move the BN library link dependency into the standalone binaries.
Review URL: https://chromiumcodereview.appspot.com//9433021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4416 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 00:36:14 +00:00
srdjan@google.com 87089f37f1 Fix cacthing exception object: a null exception is always caught.
Review URL: https://chromiumcodereview.appspot.com//9416067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4411 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 22:07:59 +00:00
srdjan@google.com acb395f713 Fix issue 979: operator arity must be verified.
Review URL: https://chromiumcodereview.appspot.com//9414005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4401 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 17:34:00 +00:00
sgjesse@google.com 18df1964f7 Fix bug from r4390 on Windows
The file handler did not pass the full path.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9428002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4391 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 13:29:52 +00:00
sgjesse@google.com 9390f1577a Run all directory async operations on a separate thread using native ports
R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9310082

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4390 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 11:35:42 +00:00
sgjesse@google.com f02c9e45d6 Add utility functions for creating and accessing Dart_CObject structures
All allocation is done using Dart_ScopeAllocate, so no explicit feeing
is required. This also means that these utilities require an active
ApiZone.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9403012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4388 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 08:59:41 +00:00
ager@google.com e2c233c750 Disallow opening of directories as files.
R=sgjesse@google.com
BUG=1614
TEST=tests/standalone/src/FileTest.dart

Review URL: https://chromiumcodereview.appspot.com//9427014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4387 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 07:22:20 +00:00
sgjesse@google.com 6512d83d74 Move MessageWriter from snapshot files to dart_api_message files
Also renamed MessageWriter to ApiMessageWriter

R=asiva@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9407010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4375 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-18 10:10:28 +00:00
sgjesse@google.com 373074784d Fix Windows build error
R=ricow@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9420044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4349 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-17 07:54:51 +00:00
sgjesse@google.com 2df1d80a02 Add API function Dart_ZoneAllocate
This provides the embedder with the option for allocating temporary C
objects in the current ApiZone.

Zone allocation is especially useful when building a graph of
Dart_CObject structures for posting using Dart_PostCObject.

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

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9347040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4348 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-17 07:43:24 +00:00
kasperl@google.com c34ec0121c Revert "Wrote functions to convert collections and maps to strings and invoked"
This reverts r4345.

R=jjb@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9416053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4347 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-17 06:36:06 +00:00
jjb@google.com b4db1d6cc0 Wrote functions to convert collections and maps to strings and invoked
these functions from the toString methods of all built-in Collection
and Map implementations. Wrote smoke tests and basher tests.

BUG=4466785
Review URL: https://chromiumcodereview.appspot.com//9320028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4345 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-17 01:34:00 +00:00
iposva@google.com 9dc3d0f49d - Add dart:json, dart:uri and dart:utf8 to the known and builtin libraries.
- Unify and simplify the building of the creation of the source file.
Review URL: https://chromiumcodereview.appspot.com//9417012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4336 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-16 19:59:19 +00:00
sigmund@google.com 427d5e5ead remove promise:
- removes promise from corelib (use future instead)
 - move tests that depend on promises and proxies into samples/proxy/
 - remove dependence on promise from the rest of the system and tests

Review URL: https://chromiumcodereview.appspot.com//9401030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4328 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-16 18:20:41 +00:00
srdjan@google.com 29da5d04f9 Fix rethrow by allowing exception object to be Null Object.
Review URL: https://chromiumcodereview.appspot.com//9416006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4303 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-16 09:07:32 +00:00