Ryan Macnak
558a931409
[vm] Move some string utils from runtime/vm to runtime/platform.
...
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-03-01 02:07:46 +00:00
Zachary Anderson
6cd8a79078
VM: Re-format to use at most one newline between functions
...
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Zachary Anderson
a1bcf051d8
clang-format runtime/vm
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Lasse R.H. Nielsen
574ae435f3
Allow surrogates in string literals.
...
Fixes issue #26620
BUG: http://dartbug.com/26620
R=asiva@google.com , brianwilkerson@google.com , floitsch@google.com , hausner@google.com , sigmund@google.com
Review URL: https://codereview.chromium.org/2304923002 .
2016-09-26 13:23:41 +02:00
Matthias Hausner
68a6060794
Eliminate GrowableTokenStream
...
Eliminate building an intermediate array of tokens in the scanner. Build
the compressed TokenStream directly instead.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1969563002 .
2016-05-11 14:09:45 -07:00
Matthias Hausner
444665465c
Small fix in Scanner
...
Use intptr_t instead of TokenPosition to denote the index of
a token in the token stream.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1968143002 .
2016-05-11 10:49:40 -07:00
Siva Annamalai
d5583d6a79
Use a reusable handle in SubString instead of creating one as this path is now used when creating Symbols of identifiers.
...
R=hausner@google.com
Review URL: https://codereview.chromium.org/1933933002 .
2016-04-29 14:53:07 -07:00
Siva Annamalai
ebd92bf3e0
Do not add a private identifier twice into the symbol table, once without the private key appended and once with the private key.
...
R=hausner@google.com
Review URL: https://codereview.chromium.org/1925413003 .
2016-04-29 13:19:01 -07:00
Ivan Posva
5be5d54529
- Refactor Symbol allocation to expect a thread parameter.
...
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.
BUG=
R=fschneider@google.com
Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
John McCutchan
d77d376124
Replace intptr_t with TokenDescriptor
...
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).
There are some cleanups I plan on doing as a follow up CL:
- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()
R=iposva@google.com , rmacnak@google.com
Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Matthias Hausner
d3a2f619bb
Fix compiler stats
...
Prints the stats into a zone-allocated string that can either be dumped to the console, or displayed as a whole in the observatory.
Distinguish token consumption between class parsing and function parsing when compiling.
Change stat counter macros use thread instead of isolate.
Review URL: https://codereview.chromium.org//1300033002 .
2015-09-04 13:13:56 -07:00
Srdjan Mitrovic
4280716656
Remove new space allocation in optimizing compiler, use Symbols::FromConcat where appropriate
...
BUG=
R=hausner@google.com
Review URL: https://codereview.chromium.org//1303923002 .
2015-08-20 15:13:06 -07:00
Matthias Hausner
0535e37619
Implement ?? ??= and ?. operators
...
BUG=23455
R=srdjan@google.com
Review URL: https://codereview.chromium.org//1180903002 .
2015-06-18 11:05:16 -07:00
koda@google.com
9c181ec6d5
Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
...
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.
Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.
Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).
R=iposva@google.com
Review URL: https://codereview.chromium.org//982873004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +00:00
iposva@google.com
14ecdbd66a
- Separate the thread implementation used in bin/ and vm/
...
to allow us to make VM specific changes.
R=asiva@google.com
Review URL: https://codereview.chromium.org//463993002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
srdjan@google.com
c2d30c3c0b
Scanner cleanups: use isolates to allocate handles and zone objects; remove C-heap allocation of structs.
...
R=hausner@google.com
Review URL: https://codereview.chromium.org//316253003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37053 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-05 22:04:17 +00:00
srdjan@google.com
5f80480eea
Improve scanner performance by remembering string's CharAt function as the string type does not change during scanner's lifetime.
...
R=zra@google.com
Review URL: https://codereview.chromium.org//315303002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37052 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-05 21:06:24 +00:00
ajohnsen@google.com
ed29c2b81f
Speed up identifying keywords in scanner, by using extra table.
...
The table maps the first character of a identifier, to the first keyword
intry in the sorted token-list. If no keyword exists that starts with a
given character, we don't enter the loop at all.
BUG=
R=hausner@google.com
Review URL: https://codereview.chromium.org//316633002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36934 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-03 20:14:24 +00:00
iposva@google.com
ba4fef1136
- Make use of the fact that idents and literals are symbols.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//289893002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36250 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 22:52:22 +00:00
turnidge@google.com
bb6003d9b7
Fix line number table generation for multiline strings with interpolation.
...
Share the line number table generation code between debugger and vm service.
R=hausner@google.com
Review URL: https://codereview.chromium.org//219993004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34606 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-01 18:16:27 +00:00
hausner@google.com
a64a32382b
Small cleanup: move all library private key code to Library class
...
R=regis@google.com
Review URL: https://codereview.chromium.org//149643007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32522 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-10 22:28:07 +00:00
hausner@google.com
5e90c211c7
Add Dart keyword symbols to the VM isolate
...
Remove the keyword symbol table from object store, and remove
keyword table initialization from Scanner constructor.
R=regis@google.com
Review URL: https://codereview.chromium.org//72923002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30285 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-14 19:14:16 +00:00
iposva@google.com
d369b7a0c9
- Ensure that the token stream from generated source matches the
...
original token stream in the presence of combinations of
multiline string and string interpolation. If not this will
cause mismatches when accessing code snippets, e.g when
reporting parser errors or assertions.
- Ensure that ScanAll and ScanTo are in sync when adding or
counting tokens.
- Added unit test for multiline strings and interpolation.
- Expanded GenerateSource unit test to iterate through all
loaded libraries.
- Do not report columns for compilation errors in snapshotted
code.
- Do not report columns from exceptions and errors when dealing
with snapshotted code.
- Remove length field from TokenDescriptor. It was unused.
- Remove TokenStream::ComputeTokenPosition. It was unused.
R=fschneider@google.com , hausner@google.com
Review URL: https://codereview.chromium.org//36323003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29110 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 19:08:36 +00:00
srdjan@google.com
86606af254
Forgot to submit the cleanup.
...
Review URL: https://codereview.chromium.org//27271002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28620 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-14 23:32:00 +00:00
hausner@google.com
7eaea8b300
Discard first line of multiline string if only whitespace
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//24493007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27895 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 17:26:55 +00:00
mlippautz@google.com
728c46ca4f
Make Script::GetTokenLocation() and Script::TokenRangeAtLine() use token streams
...
where possible.
BUG=
R=hausner@google.com , iposva@google.com
Review URL: https://codereview.chromium.org//24359005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27786 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-23 23:24:59 +00:00
mlippautz@google.com
4fa46b7148
Introduce newline tokens into the token stream.
...
CL only introduces the tokens into the compressed token stream. We do not
use the newline tokens (yet).
Overhead:
snapshot: 6.4% (860k/808k)
compressed token stream (gen_snapshot): 21% (314312/259907)
BUG=
R=asiva@google.com , hausner@google.com
Review URL: https://codereview.chromium.org//23452043
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27677 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 21:46:50 +00:00
hausner@google.com
f3baeeb6a5
Implement symbol literals in the VM compiler
...
Issue 12171
R=iposva@google.com
Review URL: https://codereview.chromium.org//24240010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27668 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 17:39:16 +00:00
hausner@google.com
50f1dc5034
Be consistent with number scanning
...
If 1.e+2 is interpreted as an integer literal followed by other tokens, then
so should 1e be interpreted as an integer literal followed by identifier e.
Review URL: https://codereview.chromium.org//23996003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27218 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 22:27:52 +00:00
hausner@google.com
5c0b92e347
Fix number scanning
...
Removing an old, Dash-era hack that makes 2is a faulty number
literal rather than the number 2 followed by the identifier or
keyword "is".
Also fix number_identifier_test.dart which contains an access
to a non-existent getter "memberName" of class NoSuchMethodError.
Review URL: https://codereview.chromium.org//23711004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27216 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 22:11:50 +00:00
jacobr@google.com
605b33c1bc
fix cpp11 compile errors
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//23072026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
zra@google.com
a810497666
Fixes scanning of Utf16 surrogate pairs in string literals.
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//23000008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26130 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 17:34:31 +00:00
rmacnak@google.com
ed4fbd6255
Removed dead code: ConsumeIdentChar
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//17609004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24377 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 23:47:00 +00:00
johnmccutchan@google.com
db9f4d4ef7
Remove --disable_privacy
...
BUG=https://code.google.com/p/dart/issues/detail?id=11493
R=hausner@google.com
Review URL: https://codereview.chromium.org//17621003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24374 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 22:45:12 +00:00
hausner@google.com
457bb1bdcb
Remove support for + prefix in number literals
...
Also fix some tests that expected + prefix in hex numbers to be illegal. According to our documentation, int.parse() accepts + for numbers in all formats/radixes.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//17103002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24051 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 21:16:46 +00:00
hausner@google.com
bf5835d89e
BREAKING CHANGE: Remove === and !== in the VM compiler
...
This change is long overdue. Fixed the last places where we
still used ===.
R=iposva@google.com
Review URL: https://codereview.chromium.org//16398006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23751 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-07 16:31:33 +00:00
hausner@google.com
89346f3e3a
Remove legacy syntax support for library import
...
Remove legacy syntax for #import, #library and #source
Update test programs
Recalc fingerprints of inlined functions that were apparently
affected by the change of library name from "dart:io" to dart.io.
Review URL: https://codereview.chromium.org//12880023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20466 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-25 18:11:08 +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
hausner@google.com
7e70aaddf7
Support for embedded Dart scripts
...
Add a line and column offset to scripts so that errors and exceptions
in embedded Dart scripts are reported at the proper location.
New API call Dart_LoadEmbeddedScript() that allows to specify
line and column offsets.
Stumbled on and fixed a bug. Script::kind field was not externalized to snapshot.
Review URL: https://codereview.chromium.org//11824067
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16934 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-10 21:47:09 +00:00
asiva@google.com
7022b39e35
Convert all symbol accessors to return read only handles so that it is not necessary to create a new handle in the code that uses it.
...
Added a few more strings to the symbols list.
Review URL: https://codereview.chromium.org//11667012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16584 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-02 19:31:59 +00:00
asiva@google.com
02049c689e
Fix for issue 7089 (Symbols::New was not quite working correctly
...
when there are non ASCII Latin-1 characters in the string).
Review URL: https://codereview.chromium.org//11411341
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15711 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-04 22:18:12 +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
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
hausner@google.com
f116c93cf9
Proper reporting of illegal characters in source code
...
Fixes bug 6778.
Review URL: https://codereview.chromium.org//11417074
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15122 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 23:46:23 +00:00
iposva@google.com
7ae807a19c
- Move MathNatives from dart:core to dart:math.
...
- Split out double and integer parsing from MathNatives.
Review URL: https://codereview.chromium.org//11316031
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15032 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-16 19:42:02 +00:00
hausner@google.com
95c79712da
Make library, import, export, part pseudo-keywords
...
Resubmit cl 14446 after Ivan's keyword table fix.
Review URL: https://codereview.chromium.org//11367069
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14500 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 20:30:08 +00:00
iposva@google.com
4d410f0ebb
- Prepopulate the keyword symbol table otherwise we can end up
...
with empty spots when reading from a snapshot.
Review URL: https://codereview.chromium.org//11366058
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14453 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 07:29:12 +00:00