Commit Graph

62 Commits

Author SHA1 Message Date
ajohnsen@google.com 38bfed114d Fix memory-issue String::fromCharCodes, where a GC could invalidate an address.
The constructions is now reordered, so the address is not extracted
until after allocation of the new string.

BUG=https://code.google.com/p/dart/issues/detail?id=17602
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34320 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-24 18:56:36 +00:00
ajohnsen@google.com b26561d41d Fix last commit.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33364 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 09:24:54 +00:00
ajohnsen@google.com c3dfdbe772 Fix fromEnvironment when called from isolates.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33363 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 09:16:41 +00:00
ajohnsen@google.com 1ce402ec78 Revert "Re-apply 'Fix fromEnvironment when called from isolates.'"
This reverts commit 1f2ddd083424a93dc0822c2ae86be971d5a97e21.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33278 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 16:05:21 +00:00
ajohnsen@google.com fb97ee0fe1 Re-apply 'Fix fromEnvironment when called from isolates.'
Old Review URL: https://codereview.chromium.org//186393004

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33274 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 14:22:54 +00:00
ajohnsen@google.com e8ad108bec Revert "Fix fromEnvironment when called from isolates."
This reverts commit f5886c3a1fe96580c13d83d6422a6bb6931ae95a.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33266 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 11:06:39 +00:00
ajohnsen@google.com 7e55a59ce4 Fix fromEnvironment when called from isolates.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33264 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 10:26:17 +00:00
fschneider@google.com 16857e0b13 Revert r32930 (Add more timing information in the VM to track time...)
It caused severe performance regressions that should be addressed.

TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32959 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:15:55 +00:00
asiva@google.com 6d313d3797 Add more timing information in the VM to track time spent is dart code Vs native code.
R=johnmccutchan@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32930 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 21:30:29 +00:00
iposva@google.com f2a6f1b4b6 Another round of cleanups for http://www.dartbug.com/15922
- Address warnings about 64-bit to 32-bit conversions.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32831 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 23:35:55 +00:00
ajohnsen@google.com 03c7cf69f3 Add optimized String.fromCharCodes path for Uint8List and Int8List.
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30496 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 06:12:01 +00:00
lrn@google.com 66959d9dbf Change int.fromEnvironment in VM to use same code as int.parse.
R=fschneider@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29670 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 13:45:39 +00:00
sgjesse@google.com 36a67fa046 Implement fromEnvironment on bool, int and String
This implements const constructor fromEnvironment on bool, int and
String.

The VM have the added -Dname=value option to define the value for the
properties. All values are provided by using the -D - nothing is read
from the environment.

If the resulting value is null or - in the case of int.fromEnvironment
- not a number an ArgumentError is thrown.

This CL does not have any implementation for dart2js.

This is a continuation of the change
https://chromiumcodereview.appspot.com/24975002 by iposva@
BUG=
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29642 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 05:46:57 +00:00
srdjan@google.com cacd63cf7b Improve indexOf for one byte string receiver to work with other string classes.
Optimize access to core class’s class-ids.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29610 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 23:51:42 +00:00
srdjan@google.com a81288c8ca Improve string library performance. String concat and indexOf.
Rename String concatAll to concatRange. Optimize concatRange for OneByteStrings (avoids natives), optimize indexOf for one character onByteStrings.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29472 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-29 18:18:40 +00:00
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