Commit Graph

2159 Commits

Author SHA1 Message Date
cshapiro@google.com 537010ea16 Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays.
Internal and external representations of each array are provided.  A
single interface type implementing the ByteArray and List interfaces
is shared among the internal and external implementation type.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7311 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-04 05:12:19 +00:00
floitsch@google.com 410e6bf600 Reapply "Set the TZ env to get the UTC-ms since epoch."
This reapplies a fixed version of commit 7285.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7288 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 15:40:40 +00:00
floitsch@google.com a8e31e2a48 Revert "Set the TZ env to get the UTC-ms since epoch."
This reverts commit 7285.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7287 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 14:54:09 +00:00
floitsch@google.com 9cf8b9a36d Set the TZ env to get the UTC-ms since epoch.
Previously we tried to simply subtract the timezone difference from
the local value. Apparently this doesn't work...

Fixes issue 1268.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7285 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 14:46:21 +00:00
floitsch@google.com 1e61443c14 toRadixString returns lower case characters.
Fixes issue 2670.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6955 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 15:50:36 +00:00
srdjan@google.com 130ca2534f A 'fix' for issue 2671, toRadixString.
Review URL: https://chromiumcodereview.appspot.com//10173014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6948 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 15:32:12 +00:00
turnidge@google.com 353b66038e Rework mirrors implementation.
(Note that the current mirrors implementation is just a heartbeat
implementation of a single method)

Use native code instead of dart code to do the work.

Use JSON instead of Lists/Maps for commands/responses.

Reenable disabled tests.
Review URL: https://chromiumcodereview.appspot.com//10175011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6864 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-23 22:26:09 +00:00
turnidge@google.com 9d72035ce5 Use the ThreadPool for all isolates and native ports. Previously,
each isolate or native port had a dedicated thread.

Refactored the MessageHandler api...

- Added a Run function to allow a MessageHandler to run on a
  ThreadPool.  These functions take a start and end callback to allow for
  isolate initialization and shutdown.

- Made the queue private to the MessageHandler and moved all message
  processing code inside the MessageHandler (got rid of all of the
  different flavors of RunLoop).  This helps remove some code
  duplication and hides the details of how messages are handled.

- Moved all locking and notification out of MessageQueue and moved it
  up to MessageHandler.  Moved OOB support out of MessageQueue and up
  to MessageHandler.  These changes make the MessageQueue much
  simpler.

- Refactored native port and isolate MessageHandlers to share more code.

- Improved --trace_isolates output.

- Added tests for MessageHandler.

Refactored lib/isolate code...

- Use the new MessageHandler::Run api.

- Got rid of the LongJump stuff in RunIsolate.  No longer needed.

- Use the new StartIsolateScope/SwitchIsolateScope to make the code
  less verbose and less error-prone.

- Store top-level isolate errors in the sticky_error.

Added StartIsolateScope/SwitchIsolateScope classes.
Review URL: https://chromiumcodereview.appspot.com//9924015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6762 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 19:47:27 +00:00
srdjan@google.com 037cfcf849 Add optional arguments to NullPointerException so that it can report more information (make it similar to what is reported by NoSuchMethodException):
NullPointerException : method: 'foo'
Receiver: null
Arguments: [1, 2]
Review URL: https://chromiumcodereview.appspot.com//10034026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6429 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 19:58:45 +00:00
hausner@google.com 2fc3bb679d Introduce a flag to disable string operator +
If allow_string_plus is set to false, the compiler will report an error
when it finds a string literal followed by +. Invoking the + operator on a
string value throws a noSuchMethod exception.

This is temporary code that we'll eliminate once the + operator on
strings is completely removed.
Review URL: https://chromiumcodereview.appspot.com//9960084

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6423 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 18:23:22 +00:00
asiva@google.com 861297e2a8 Fix build break.
Review URL: https://chromiumcodereview.appspot.com//9999009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6345 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-09 23:17:28 +00:00
asiva@google.com 8f208ad7ca Wire GrowableArray to use the internal VM object.
This also fixes issue (5526318 : Make access to GrowableArray objects through the dart api more efficient)
Review URL: https://chromiumcodereview.appspot.com//10012042

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6341 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-09 21:50:53 +00:00
cshapiro@google.com 0282e0745b Use named constants for the mask values used to narrow byte array values.
Review URL: https://chromiumcodereview.appspot.com//9839071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5796 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 22:26:13 +00:00
zundel@google.com 41cb747374 Fixed some static type warnings in vm core libraries
After running 'dartc' on the VM's core libraries, about 79 static type warnings popped out.
These ten or so were relatively easy to fix.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5794 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 21:27:18 +00:00
cshapiro@google.com 8da7a95afc Narrow when storing to a byte array and implement uint64 get and set.
Previously, the byte array get and set routines for integers would not
correctly narrow an integer when the width of a value being stored was
greater than the element width.  This change implements the behavior in
the Web IDL specification.

In addition, an implementation for uint64 get and set is now provided.

BUG=2042

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5738 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-22 02:50:15 +00:00
cshapiro@google.com 62a5452feb Make failed capturing parenthesis produce null instead of "".
BUG=2068

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5670 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-20 00:36:21 +00:00
iposva@google.com d402068134 - Fix use of String operator + in core libraries.
Previously reviewed as part of https://chromiumcodereview.appspot.com/9690003
Review URL: https://chromiumcodereview.appspot.com//9730009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5656 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 19:42:29 +00:00
cshapiro@google.com 86bd5e8827 Improve the replaceFirst, replaceAll and split methods.
An empty regular expression had caused split to loop infinitely.  Now,
the split method behaves like its namesake in ECMAScript and splits a
string along character boundaries.

The split, replaceFirst, and replaceAll methods only supported RegExp
and String patterns.  Now, these methods are implemented on top of the
allMatches method and work for all subinterfaces of Pattern.

BUG=2171

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5653 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 18:06:42 +00:00
cshapiro@google.com aae5faf7b1 Implement regular expression support for split and replace{First,All}.
BUG=429

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5491 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 22:09:52 +00:00
turnidge@google.com b71faf4528 Fix bogus mistake in get:_port().
Review URL: https://chromiumcodereview.appspot.com//9691063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5443 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 22:22:21 +00:00
turnidge@google.com e61a02c10d Implement spawnFunction from the new isolate api.
Still need to implement spawnUri, which will be the more difficult one.
Review URL: https://chromiumcodereview.appspot.com//9691005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5441 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 22:05:08 +00:00
hausner@google.com 09b97fefd4 Address Ivan's review comments.
Review URL: https://chromiumcodereview.appspot.com//9696048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5438 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 21:07:42 +00:00
hausner@google.com 9655e2af7d Add type checking to some native function arguments
Review URL: https://chromiumcodereview.appspot.com//9693051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5437 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 20:53:37 +00:00
iposva@google.com cd8cdc5fe8 - Now that VM entry points are hardened the checking in the Dart
code is unneeded.
Review URL: https://chromiumcodereview.appspot.com//9677059

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5432 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 19:30:10 +00:00
regis@google.com d74c2008be Fix type check to perform a subtype test at top level instead of an
assignability test. This only makes a difference when assigning an instance of
a function type.
Fix a bad language test.
Disable a bad co19 test (issue 99 filed).
Change error message for dynamic type error.
Review URL: https://chromiumcodereview.appspot.com//9664029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5413 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 16:16:12 +00:00
turnidge@google.com ff26341fd6 Heartbeat implementation of dart:mirrors.
Add the skeleton for the dart:mirrors library in all the appropriate
places.  The only thing we can do right now is ask an Isolate for its
debugName.  Add a few tests.
Review URL: https://chromiumcodereview.appspot.com//9420038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5370 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 23:51:03 +00:00
sigmund@google.com 2b5952ac6c SendPort + ReceivePort changes:
- document what are valid messages in SendPort.send
- change SendPort.call to return a future of the reply
- remove ReceivePort.singleShot

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5368 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 22:52:36 +00:00
srdjan@google.com eddf1bcee9 Fox issue 2108: throw illegal argument exception for RegExp natives. Continue throwin NPE where expected.
Review URL: https://chromiumcodereview.appspot.com//9669054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5343 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 19:00:54 +00:00
iposva@google.com 993cd03e41 - Fix build by rolling back r5324, r5325.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5333 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 16:31:12 +00:00
iposva@google.com 8ca5ba4d15 - Fix use of String operator + in corelib and standalone libraries.
Review URL: https://chromiumcodereview.appspot.com//9690003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5325 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 15:26:55 +00:00
regis@google.com 33bd965e2a Generate a dynamic type error when creating an instance with a bound error.
Review URL: https://chromiumcodereview.appspot.com//9665013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5250 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 21:15:11 +00:00
turnidge@google.com d70bc0e65f Adds new apis Dart_GetField/Dart_SetField.
These are intended to replace Dart_{Get,Set}{Static,Instance}Field.

---

Mess with Library::PrivateName.

Add field/function lookup to Library.
Review URL: https://chromiumcodereview.appspot.com//9616044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5124 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 21:15:58 +00:00
regis@google.com f4ddc43cdf Generate dynamic type errors according to spec.
Fix a few bad tests.
Turn a couple negative tests in multi-tests.
Triage a few co19 failing tests.

Still to do:
Check bounds of generic types at runtime in checked mode.
Stop reporting bounds error in new operator as a compile time error.
Review URL: https://chromiumcodereview.appspot.com//9615035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5064 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 02:23:12 +00:00
floitsch@google.com effc73b1e9 Unify Date.fromString and support more Iso 8601.
Review URL: https://chromiumcodereview.appspot.com//9568011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4923 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-04 14:12:10 +00:00
srdjan@google.com 2f05ee5d11 Some fixes to Math.pow.
Review URL: https://chromiumcodereview.appspot.com//9565035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4848 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 01:16:07 +00:00
regis@google.com 47724a8491 Add support for malformed types and postpone some related errors from compile
time to execution time.

Still to do (once spec is clarified):
- properly handle generic type bounds errors
- properly handle 'instance of' type checks involving malformed types
- fix bad tests
Review URL: https://chromiumcodereview.appspot.com//9515011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4732 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 02:14:18 +00:00
sigmund@google.com 643b772a61 isolates: remove Isolate2 interface, add the top-level spawning functions, add more comments, adapt tests to this API.
Review URL: https://chromiumcodereview.appspot.com//9521007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4729 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 00:54:15 +00:00
asiva@google.com 738f458956 Changes to get rid of dependency on openssl in the dart VM.
(This will enable dartium to be built on the windows platform).
Review URL: https://chromiumcodereview.appspot.com//9481019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4717 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 18:36:39 +00:00
floitsch@google.com 3c2b298a75 Implement Double.{toString, toStringAsExponential, toStringAsPrecision}
Also switch to -0.0.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4681 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 13:19:50 +00:00
sigmund@google.com ee6a907611 isolates refactor: this change introduces 'dart:isolate' as a library. This is a
big global change, so let me explain in more detail. This refactoring CL does
the following:
- moves all the dart code for isolates in a common library (lib/isolate)

- changes frog to understand 'dart:isolate' imoprts by loading the code from the
  location above.

- changes the vm to undernstand 'dart:isolate' imports by creating a separate
  library that is part of the bootstrap. This follows the same code-structure
  that Todd suggested in his CL introducing the mirror library

- changes dartc to use the shared isolate library as the source of truth for
  type checking. I left around some of the internal js code in dartc so that the
  backend continues to work for apps that don't use isolates.

- changes all tests that use isolates to import the library explicitly (this is a large bulk of the files in this CL)

- changes test status for tests we can't fix in this repo (e.g. co19)

- splits the isolate library code to make it possible to preserve some tests
  without exposing internal types (e.g. tests about
  serialization/deserialization)

- changes the create_sdk script to copy the isolate library to the sdk

- includes the isolate library in dartdoc

I'll wait for at least one lgtm from each area (dartc, vm, frog, sdk)

There is one important pending thing this CL doesn't do:
- update test_runner.dart: This should be updated next time we upload the new
  binaries to tool/testing/bin
- dartium specific changes: Vijay, is there anything I need to do for dartium?

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4647 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 22:50:44 +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
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
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
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
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
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
srdjan@google.com 4b3a6e1e57 Fixed a bug in isNegate intrinsified code, fixed negation for doubles (handling of negative zeros). Added tests. Fix issue 1554.
Factored out parts of X86Decoder::InstructionDecode in order to satisfy lint (500 lines max per function).
Review URL: https://chromiumcodereview.appspot.com//9338002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3971 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-06 22:16:44 +00:00
srdjan@google.com c097795d6e Improve repoorting of NoSuchMethod:
NoSuchMethodException: incorrect number of arguments passed to method named 'foo'
Receiver: Instance of 'A'
Tried calling: foo(5, 6, 7)
Found: foo(b, c)
Review URL: https://chromiumcodereview.appspot.com//9317099

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3960 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-06 18:05:16 +00:00