Commit Graph

47 Commits

Author SHA1 Message Date
srdjan@google.com b6b3e1f400 Factor out throwing of argument error.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28109 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 18:48:37 +00:00
srdjan@google.com 30197aab9d Improve performance of string buffer by modifying concatAll native to allow growable array and an interval. Eliminate unnecessary check for String elements in release mode.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28102 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 16:48:12 +00:00
srdjan@google.com 37e66b3350 Treat final variables initialized with a literal as constants. Also sneak in a small cleanup.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27973 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-26 21:06:56 +00:00
srdjan@google.com ab188d327c Improve performance of String.fromCharCodes by implementing it in Dart. Add tow internal natives to Dart in order to be able to allocate and fill a String. Next step is to implement String.concatAll in Dart as well and to inline String._setAt operation (currently intrinsified).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22399 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-03 23:48:10 +00:00
srdjan@google.com 596f203f2a Do not copy immutable arrays in String.createFromCharCodes. Tighten the types a little in string_patch.dart.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22338 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-02 20:45:06 +00:00
fschneider@google.com 86da5111ad Replace scalarlist optimizations and split external array loads into two IL instructions.
This CL removes optimized access for scalarlist, and only the new TypedData classes
are optimized. I changed the runtime libraries core and math to use typedData
instead of scalarlist (Uint16List is used in StringBuffer, Uint32List by Math.random).

Instead of using LoadIndexed for internal and external arrays,
split external loads into a load of the backing store and a load
of the element.

v3 <- LoadIndexed(v1, index)

becomes

v2 <- LoadUntagged(v1, ExternalTypedData::data_offset)
v3 <- LoadIndexed(v2, index);

For this I introduce two new representations in the IL:

 kUntagged (for values that hold a untagged pointer) and
 
 kNoRepresentation (for instructions accept any input
 representation)

Deoptimization does not need to know about kUntagged
since these values can never occur in the environment.

Also with this change:
* fix COMPILE_ASSERT and use it in one place.
* Cleanup IL printer output of deopt ids.
Review URL: https://codereview.chromium.org//12871010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20198 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 12:06:23 +00:00
lrn@google.com bab488a4fc Allow String.fromCharCodes to work directly on a GrowableObjectArray.
Avoids copying the data from the internal ObjectArray into a new
ObjectArray before creating the string.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20060 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-15 07:22:12 +00:00
lrn@google.com a5a93492d9 Change VM's string-buffer patch to use a Uin16Array as backing buffer.
Review URL: https://codereview.chromium.org//12421002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19679 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 10:21:52 +00:00
lrn@google.com 3c0ac360e7 Remove deprecated string features.
Make String.codeUnits return a List.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18960 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 10:48:09 +00:00
asiva@google.com f4fe42c280 Added macros OBJECT_IMPLEMENTATION and FINAL_OBJECT_IMPLEMENTATION
which have different implementations of 'operator=' and 'operator^='.
In the case of FINAL_OBJECT_IMPLEMENTATION we do not do the vtable setting
in these methods (Note the |= operator functionality is now subsumed into
the new implementation of "operator^=")
Review URL: https://codereview.chromium.org//12052033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17491 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-23 20:01:31 +00:00
srdjan@google.com 7159a6f103 Some more ^= to |=
Review URL: https://codereview.chromium.org//12017020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17310 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 20:43:33 +00:00
asiva@google.com 7ea520f10f Create read only handles for empty_array and sentinel objects
(trying out a basic framework and will extend it to others once this
works).
Review URL: https://codereview.chromium.org//11648006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16416 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-21 02:33:05 +00:00
asiva@google.com 8af296c9c8 Cleanup the exceptions create code to use Arrays instead GrowableArrays so
that it is consistent with the DartEntry invoke code that it calls finally.
Review URL: https://codereview.chromium.org//11639007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16295 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 23:47:35 +00:00
asiva@google.com 6eec2410ec Restructure Add and SetAt to not create a Handle.
Review URL: https://codereview.chromium.org//11443024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15926 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 19:28:14 +00:00
regis@google.com dd6a0ec349 Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT.
Introduce new GET_NATIVE_ARGUMENT macro accepting null.
Add test.
Review URL: https://codereview.chromium.org//11468016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15919 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 17:59:40 +00:00
srdjan@google.com e3863daaba Improve C++ code for string splittig (Dromaeo benchmark).
Review URL: https://codereview.chromium.org//11308337

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15710 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-04 21:52:02 +00:00
srdjan@google.com 5f4ad90c85 Added native to split OneByteString with a char code as pattern.
Review URL: https://codereview.chromium.org//11414273

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15615 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-01 00:22:18 +00:00
cshapiro@google.com 39ee2fdfeb Move various top-level Unicode definitions into classes and methods.
Review URL: https://codereview.chromium.org//11414249

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15568 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-30 03:33:37 +00:00
asiva@google.com 9d41d29b1a Fix StringBase_createFromCodePoints to correctly accept Latin-1 characters
as one_byte_string.

Rename Dart_NewExternalUTF8String to Dart_NewExternalLatin1String, this reflects
the functionality correctly.
Review URL: https://codereview.chromium.org//11280241

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15554 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-29 23:43:47 +00:00
srdjan@google.com bf3bac3884 Implement faster splitting with empty string as pattern. Add special native for computing substring of OneByteString (preparation for instrinsic).
Review URL: https://codereview.chromium.org//11416270

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15548 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-29 22:55:09 +00:00
cshapiro@google.com 979571d3ee Use a signed 32-bit integer for representing code points.
Review URL: https://codereview.chromium.org//11419086

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15188 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-21 00:30:27 +00:00
erikcorry@google.com 84da84c22d Revert "Add some support for the code-point code-unit distinction."
This reverts commit r15150

R=karlklose@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15152 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-20 15:23:41 +00:00
erikcorry@google.com 547cbf9da6 Add some support for the code-point code-unit distinction.
Adds String.fromCodeUnits and String.codeUnitAt, and modifies
String.fromCodePoints and String.codePointAt to actually use code points.
Fixes String.charCodes to use code points and adds String.codeUnits.
Reenables some tests, and adds new ones for non-BMP characters.
Fixes issues 6418, 6501 and 1357.

R=floitsch@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15150 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-20 14:51:25 +00:00
lrn@google.com 22309b260c Remove NullPointerException.
Accessing non-existing members on null now throws NoSuchMethodError.
Throwing a null value fails by throwing a NullThrownError.
Methods checking for null now generally throw new ArgumentError(null).

Committed: https://code.google.com/p/dart/source/detail?r=15061

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15136 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-20 09:21:52 +00:00
fschneider@google.com ecda9dd804 Add one-char string table for faster String.charAt to the VM.
This is used for a fast lookup when executing String.charAt.
Currently it is only used in the C-runtime, but the plan is to
generate optimized code for the table lookup for speeding up
String.charAt.
Review URL: https://codereview.chromium.org//11369259

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15088 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 16:06:19 +00:00
lrn@google.com 0c8dce77f1 Revert "Remove NullPointerException."
Crashes in the x64 VM.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15065 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 09:59:59 +00:00
lrn@google.com e211c2f0ee Remove NullPointerException.
Accessing non-existing members on null now throws NoSuchMethodError.
Throwing a null value fails by throwing a NullThrownError.
Methods checking for null now generally throw new ArgumentError(null).

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15061 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 08:51:49 +00:00
hausner@google.com 7eb3efc2ba Fix native argument handling
Native functions need to fetch arguments differently if they are
called through a closure.

fixes issue 6696.
Review URL: https://codereview.chromium.org//11293290

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14937 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 01:14:01 +00:00
lrn@google.com 7e6ae8ea09 Renaming IndexOutOfRangeException to RangeError.
It now extends ArgumentError.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14405 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 13:46:30 +00:00
asiva@google.com ebbb7c4134 - Represent strings internally in UTF-16 format, this makes it
compatible with webkit and will allow for easy externalization of
  strings. One byte strings are retained for pure ASCII strings.
  (The language specification was changed recently to reflect this as
   follows "A string is a sequence of UTF-16 code units").
- Remove four byte string class and all references to it.
- Rename some of the string functions in Dart API to make them
  consistent and better describe the underlying functionality
  Dart_NewString => Dart_NewStringFromCString
  Dart_NewString8 => Dart_NewStringFromUTF8
  Dart_NewString16 => Dart_NewStringFromUTF16
  Dart_NewString32 => Dart_NewStringFromUTF32
  Dart_NewExternalString8 => Dart_NewExternalUTF8String
  Dart_NewExternalString16 => Dart_NewExternalUTF16String
  Dart_NewExternalString32 => Dart_NewExternalUTF32String
  Dart_StringGet8 => Dart_StringToUTF8
  Dart_StringGet16 => Dart_StringToUTF16
  Dart_StringToCString => Dart_StringToCString
  Dart_IsString8 => Removed
  Dart_IsString16 -> Removed
  Dart_StringToBytes -> Removed
  Dart_StringGet32 -> Removed
Review URL: https://codereview.chromium.org//11318018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14357 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 17:56:46 +00:00
floitsch@google.com 9074fd0178 Make hashCode a getter and not a method.
Review URL: https://codereview.chromium.org//11191078

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13866 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-22 12:41:04 +00:00
tball@google.com 2cd8436c5a Changed StackZone and ApiZone to be containers for Zone.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13707 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 22:05:40 +00:00
tball@google.com 76d7c9b105 Renamed Zone->StackZone, BaseZone->Zone, in preparation for changing isolate->get_zone() to return what was called the BaseZone instead of its wrapper. The GetBaseZone() methods were not renamed, to help the next CL.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13314 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-05 19:52:55 +00:00
lrn@google.com a1faa6f135 Change IllegalArgumentException to ArgumentError.
Review URL: https://codereview.chromium.org//10989013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12841 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-25 12:27:52 +00:00
turnidge@google.com 14f614da12 Use the return value of vm native methods to set the return value,
based on Siva's earlier suggestion (he actually suggested putting it
in the generated stub, which I haven't done).

Added SetReturnUnsafe and use it exactly one place so far.
Review URL: https://chromiumcodereview.appspot.com//10874072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11633 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 17:41:19 +00:00
iposva@google.com 093c16d6ea - GET_NATIVE_ARGUMENT uses the isolate which is passed in to allocate the handle.
- Avoid frequent calls to Isolate::Current().
- Avoid handle allocation in a loop for StringBase.createFromCodepoints.
- Avoid copying in StringBase._interpolate.
Review URL: https://chromiumcodereview.appspot.com//10878037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11279 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-24 00:22:07 +00:00
turnidge@google.com bfc3132e94 Missing file from last commit.
Review URL: https://chromiumcodereview.appspot.com//10874043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11263 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-23 21:59:28 +00:00
turnidge@google.com be1824962e Make StringBase._substringUnchecked a native function.
This avoids making a throw-away list on every substring operation.
Fixed the underscore on the function name while I was at it.
Review URL: https://chromiumcodereview.appspot.com//10874038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11262 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-23 21:48:40 +00:00
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +00:00
asiva@google.com ec7f44f025 Create frequently used symbols in the vm isolate
- Avoids the need for doing a NewSymbol on these everytime
- saves space as they get shared by isolates
Review URL: https://chromiumcodereview.appspot.com//10783035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9834 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 00:01:50 +00:00
hausner@google.com a7f542becb Remove obsolete String + code
Review URL: https://chromiumcodereview.appspot.com//10562038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8810 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 18:00:25 +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
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
srdjan@google.com 59b79d8171 Fix more co19 crashes. Introduce GET_NATIVE_ARGUMENT that throws an illegal argument exception if the native argument is of incorrect type.
Review URL: http://codereview.chromium.org//8476002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1205 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 16:30:29 +00:00
srdjan@google.com 6a0e00c33c Fix crashes in String natives.
Review URL: http://codereview.chromium.org//8455004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1199 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 15:00:04 +00:00
cshapiro@google.com f52039f03c Implement case mapping using the Unicode default case mapping algorithm.
BUG=5425968

Review URL: http://codereview.chromium.org//8333001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@616 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-21 20:33:29 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00