Commit Graph

151 Commits

Author SHA1 Message Date
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
srdjan@google.com be66ab9a1c Fix for issue 1307: throw runtime exception instead of reporting a compile time error if a static call cannot be resolved.
Review URL: https://chromiumcodereview.appspot.com//9316100

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3922 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-03 22:25:16 +00:00
srdjan@google.com 19c79a3660 If programmer mistakes the number of arguments, VM throws noSuchMethod. Extend reporting to report correct number/name of arguments if a method with the same name exists. Example:
NoSuchMethodException - receiver: 'Instance of 'A'' function name: 'foo' arguments: [1]]
Found 'foo(alpha, beta, message)'
 0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:647 col:3
 1. Function: '::main' url: '/sources/chinstrap/dart/runtime/Test.dart' line:8 col:8
Review URL: https://chromiumcodereview.appspot.com//9307074

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3911 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-03 17:13:09 +00:00
turnidge@google.com 0ddd4c04e9 Dart_PropagateError, take 2.
This change hopefully takes care of the non-mac build issues.  The
checked mode failures are fixed in a separate cl.
Review URL: https://chromiumcodereview.appspot.com//9316071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3863 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 19:05:06 +00:00
sgjesse@google.com 42b70dcddb Change the thread interface in runtime/platform and use it starting all threads
The platform thread interface (dart::thread) is now refactored to an
all static interface as suggested by iposva@ and asiva@. Use this
interface for running all threads in the VM.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3830 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 08:59:26 +00:00
turnidge@google.com ae88492093 Revert Dart_PropagateError until I can track down the problems in
checked mode tests.

Sorry for the hubbub.
Review URL: https://chromiumcodereview.appspot.com//9314053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3823 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 23:39:28 +00:00
turnidge@google.com 9da62c5fea Add Dart_PropagateError.
This function can be used in native functions to properly pass all
errors up the stack.

Set the long jump base in the Compiler instead of outside of the
compiler.  A bunch of errors that used to be propagated through the
sticky_error are now propagated through return values.  This includes
all of the DartEntry and DartLibraryCall functions.

In particular, we no longer use the long jump to cross dart frames.
Instead errors are propagated across dart frames using the same
mechanism that we use for unhandled exceptions.  I've added assertions
to make sure that we only use the long jump when it is "safe".
Review URL: https://chromiumcodereview.appspot.com//9169102

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3815 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 22:34:16 +00:00
ajohnsen@google.com 143de9eb80 Use ByteArray's native for Socket and File.
Review URL: https://chromiumcodereview.appspot.com//9235067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3812 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 21:48:27 +00:00
turnidge@google.com 1f5364cd3b Add support for native ports in the vm.
Dart_NewNativePort creates a port associated with a C handler
function.  When messages come in on this port, they are forwarded to
the C function for processing.

To support this, refactored PortMap so that it operates on a new
MessageHandler type instead of directly on Isolates.

For now, native ports have a dedicated single thread.  Eventually we
will back native ports (and possibly Isolates as well) by a shared
thread pool.
Review URL: https://chromiumcodereview.appspot.com//9169063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3804 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 18:53:40 +00:00