Commit Graph

55 Commits

Author SHA1 Message Date
Aart Bik fa181d94ef [dart/compiler] Refactor negate/flip token utilities
Rationale:
Avoids code duplication, also for planned uses later.
Change-Id: I05b97809f016805a2692c1fca3ec5a26354c527a
Reviewed-on: https://dart-review.googlesource.com/c/87300
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-12-14 17:29:44 +00:00
Régis Crelier f734e7ee38 [VM] Treat 'deferred' as a built-in identifier (fixes #31267 and #25732).
Reject built-in identifiers as prefix names (fixes #25733).
Update co19 status file.

Change-Id: I7fe5014d128bfdad442866e78196fb8dd2764dda
Reviewed-on: https://dart-review.googlesource.com/19860
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-11-09 23:29:52 +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
Régis Crelier 252e75f30d Fix precedence of assert keyword in VM parser (fixes #29990).
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2954713002 .
2017-06-23 13:38:39 -07:00
Matthias Hausner 90b937a4ce Support covariant keyword in the VM parser
For Dart 1.5, the VM ignores the annotation. It is just consumed by the parser, but has otherwise no effect. Errors are reported on illegal covariant declarations.

BUG=#28166
R=regis@google.com

Review-Url: https://codereview.chromium.org/2625823004 .
2017-01-12 14:03:26 -08:00
Ryan Macnak e7040c86eb AOT: Speculate that bitwise operators will have Smi receivers and arguments.
Add shifts to CheckedSmiOps.

Fix invalid load forwarding across CheckedSmiOps and CheckedSmiComparisons.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2487873003 .
2016-11-11 13:33:43 -08: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
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -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
John McCutchan 77101d63e3 Source positions for constructors and lots of async machinery
- Rework token position address space.
- Use ClassifyingTokenPositions::kMethodExtractor for the token position of a method extractor.
- Plumb token positions through all of Ast Transformer.
- Plumb token positions for temporary expressions, etc in Flow Graph Builder.
- Add token positions for parts of the await machinery.
- Move ClassifyingTokenPositions into token.h.
- Remove default token position of Scanner::kNoSourcePos for many IR instructions.
- A couple of unit tests.
- Use synthetic token positions for synthetic AstNodes.
- Fix SLEB128 encoding / decoding + test
- s/Scanner::kNoSourcePos/Token::kNoSourcePos.
- Remove >= 0 and < 0 checks against token positions and use helpers instead.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1589643002 .
2016-01-19 15:01:08 -08:00
Matthias Hausner bdf8124301 Add 3 new tokens and fix all the fallout from changing token values.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1142423003
2015-05-21 09:06:11 -07:00
vegorov@google.com aa48bd4759 Range feedback for arithmetic operations.
In addition to tracking input and output ranges in the IC-stubs with a Smi fastpath (SmiAdd and SmiSub, currently) this CL also introduces two IC stubs that have no fast-path by still track ranges and update the range feedback.

We are able to distinguish between the following ranges (encoding of the lattice is shown in the parens):

- u-smi  (0000)
- smi    (0001)
- uint31 (0010)
- int32  (0011)
- uint32 (0100)
- int64  (1xxx) and (x1x1)

BUG=
R=fschneider@google.com, srdjan@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42370 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 18:48:15 +00:00
hausner@google.com 4bf624ebc0 Implement enum types in VM
Fully support enum types as per language spec version 1.6.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41815 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-18 23:10:07 +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
srdjan@google.com 93cf4041e4 Fix crashes: ComparisonInstr now has also kinds kIS and kISNOT: implement negation for those.
Review URL: https://codereview.chromium.org//251883004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35459 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 23:54:38 +00:00
srdjan@google.com 2b9fad92c7 In preparation of inlining remainder and modulo binary Smi operations:
- Add REM token
- Fix checking of function fingerprints.
- Remove unused intrinsic for remainder (the function gets inlined and intrinsic is not generated)

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29929 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 19:27:46 +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
lrn@google.com ee3dfa414f Change the order of bitwise operators and equality/relational operators.
Gives bitwise operators precedence above that of equality/relational operators.

This means that
  a & mask == something
no longer needs parentheses.

Since bitwise operators didn't work on booleans, and there are probably very few custom operator&'s that accept a boolean, this is expected to not break existing code.

BUG= http://dartbug.com/114
R=hausner@google.com, kasperl@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27613 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 12:32:47 +00:00
hausner@google.com bbcf74a569 Make "as" a built-in identifier aka pseudo keyword
Fixes issues 12551, 13021

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27461 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-12 23:45:41 +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 54dde7ce89 Implement rethrow statement
Or: how to turn a 5 minute task into a 2 hour ordeal.

The actual business of the change is one line in token.h and one line in parser.cc.
Review URL: https://codereview.chromium.org//14012005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21371 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 16:32:37 +00:00
srdjan@google.com c5e562d18d Improve code for !identical(a, b):
"x = (a === b); y = (x !== true)" => "y = (a !== b)".
Review URL: https://codereview.chromium.org//12852007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20550 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-26 23:41:27 +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
hausner@google.com b4527a7465 First stab at mixins in VM compiler
Things not yet supported:
- Type parameters for super class and mixin class
- super call limitation check
Review URL: https://codereview.chromium.org//12210127

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18479 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 21:08:15 +00:00
regis@google.com 91ad9a0180 Remove support for interfaces.
For now, disable tests using obsolete syntax.
Tests disabled in this cl and in previous ones removing default factory classes
will either be deleted or updated in a later cl.
Review URL: https://codereview.chromium.org//11411271

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15562 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-30 01:26:31 +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
hausner@google.com e4880d6698 Revert cl 14446
Review URL: https://codereview.chromium.org//11293054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14448 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 00:19:48 +00:00
hausner@google.com 4c6b490ab8 Make library, import, export, part built-in identifiers
Review URL: https://codereview.chromium.org//11360051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14446 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 23:47:25 +00:00
hausner@google.com 384115d235 Remove built-in identifier 'negate' from VM
Keep the token kNEGATE for the backend to distinguish between
unary and binary - operator.
Review URL: https://codereview.chromium.org//11199002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13700 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 20:19:06 +00:00
hausner@google.com ffedcb612d Make assert a reserved word
Issue 5051.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12861 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-25 17:59:35 +00:00
hausner@google.com 731f692895 Get rid of #resource directive in VM
Review URL: https://codereview.chromium.org//10918226

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12358 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-13 22:25:09 +00:00
kasperl@google.com 55140fd125 Remove support for operator negate and replace occurrences with unary
operator -.

In the VM, I have disabled the operator negate support in the parser but I
have not removed the keyword because the token is used in quite a few other
places.

R=ahe@google.com,iposva@google.com,hausner@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12233 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-12 05:29:03 +00:00
hausner@google.com 22fdbae05b VM can parse and ignore metadata
Support parsing of metadata in all legal locations except library
and import directives. The metadata is simply ignored. It is not
evaluated or validated for correctness.
 
Review URL: https://chromiumcodereview.appspot.com//10913138

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12078 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-07 23:06:48 +00:00
srdjan@google.com b151a744ce Fix Token::kAS and its printing according to Regis' comment.
Review URL: https://chromiumcodereview.appspot.com//10909098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11968 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-06 17:03:43 +00:00
srdjan@google.com 8f313942ed Do not append input value of AS comparison if the check is eliminated. Fixes issue 4944, crash caused by incorrect stack size at exit.
Review URL: https://chromiumcodereview.appspot.com//10919119

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11929 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-06 09:21:35 +00:00
fschneider@google.com bc54c438a0 Separate branch on strict compare into a new IL instruction.
This avoid unnecessary environment uses since the strict compare
can not deoptimize.

This is a first step in refactoring branch instructions so that we
can easily do explicit checks for specialized comparisons (smi, double).
Review URL: https://chromiumcodereview.appspot.com//10867050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11373 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-27 09:30:20 +00:00
fschneider@google.com df23e58a2f Change indexed load and store IL instructions to fit with SSA backend.
Generic indexed operations are implemented as normal instance calls. Specialized
operations are inserted by the flow-graph optimizer. This also avoid a lot of duplicated code
in the code generator.
Review URL: https://chromiumcodereview.appspot.com//10836239

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10727 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 13:54:38 +00:00
hausner@google.com 6a1a13901d Support for new operator -
Implement unary operator -. Operator negate is still recognized,
but internally it is represented like unary -. In particular,
operator negate no longer implies an instance method named
negate.

Marked several co19 tests that use "negate" as failing and filed
co19 issue 169 to have these tests updated.
Review URL: https://chromiumcodereview.appspot.com//10830253

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10523 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 18:30:22 +00:00
iposva@google.com e5a314d222 - Allow parsing of external methods.
Review URL: https://chromiumcodereview.appspot.com//10821076

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10028 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-30 22:46:24 +00:00
iposva@google.com c34b1216f4 - Improve the formatting of generated source text.
Review URL: https://chromiumcodereview.appspot.com//10823028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9952 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 18:07:56 +00:00
hausner@google.com fdd91990f1 Implement cascade operator in VM
- Factoring out parsing of selectors
- Create temp variable holding the receiver of the cascade
  selectors
Review URL: https://chromiumcodereview.appspot.com//10796109

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9857 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 17:20:49 +00:00
regis@google.com 0532a90a2f Implement type cast in the VM.
Review URL: https://chromiumcodereview.appspot.com//10659005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9070 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-25 17:23:11 +00:00
srdjan@google.com 70bc9aa213 Add token kind into InstanceCallComp so that we do not need to extract it from name (addresses vego…
Review URL: https://chromiumcodereview.appspot.com//10536162

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8675 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 17:41:54 +00:00
srdjan@google.com 755790f46f Adding unary op optimizations, missing assembly operations.
Review URL: https://chromiumcodereview.appspot.com//10440099

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8174 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-31 20:38:55 +00:00
srdjan@google.com 742a716dc7 Fix a bug in ia32 shift left , implemented more inlined binary operations in x64.
Review URL: https://chromiumcodereview.appspot.com//10440082

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8119 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 17:35:20 +00:00
iposva@google.com 0b1b94c9e3 - Proper inclusion of gypi files, so that they do not override
existing build flags.
Review URL: https://chromiumcodereview.appspot.com//9701054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5505 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 01:07:15 +00:00
asiva@google.com 33d2e2fe26 Changes to shrink the token stream representation from two words to one word.
On standalone dartium which has about 50000 tokens in the libraries (core, coreimpl, builtin, io etc.) this reduces the heap size by about 180kb. The size of the standalone snapshot buffer reduces by about 72kb.

Also moved the keyword symbol table to the object store so that it does not have to repopulated on every script compilation. Should benefit regular user script load times.
Review URL: https://chromiumcodereview.appspot.com//9462003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4734 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 02:46:29 +00:00
iposva@google.com f0c1954e9b Fix issue 732:
- Add handling for #resource library tags: Ignore at runtime, they are only used
  by the Dart Editor at the moment.
Review URL: https://chromiumcodereview.appspot.com//9431038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4493 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 21:40:07 +00:00
srdjan@google.com 9e77768c91 Fix for bug 1229: Unary operator plus is not allowed ... except for literals.
Add tests for incorrect literals, e.g. "+ 5".

Added a temporary token kTIGHTADD that represents an ADD not terminated by a whitespace. It is temporary and eliminated in the parser (code generator ot AST do not see it). It is used to recognize correct literals.
Review URL: https://chromiumcodereview.appspot.com//9264051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3745 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-31 20:05:24 +00:00