Commit Graph

90 Commits

Author SHA1 Message Date
Ryan Macnak 7e54844fe7 [vm] Fix build for gcc 7.3.0.
Change-Id: I02ead73679c3a6e1e5c9313f78c5f02ad6ca79b0
Reviewed-on: https://dart-review.googlesource.com/53521
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-03 17:59:44 +00:00
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
Alexander Aprelev ce427ac14f Revert "Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures.""
This reverts commit ade37f931e.

This re-lands RebindRule change with fixes for the "-mdebug--hot-reload" test failures.

Original commit is reverted in patch set 1.
Fixes are in following patch sets.

Bug:
Change-Id: I49375af9b891323fe05c670d77cbf880964aae54
Reviewed-on: https://dart-review.googlesource.com/9361
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-28 19:43:32 +00:00
Dmitry Stefantsov ade37f931e Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures."
This reverts commit 97393fd961.

TBR=aam@google.com

Change-Id: I8fc5f644e994faa20aa8b5c54f8d6227a054e39d
Reviewed-on: https://dart-review.googlesource.com/9220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 08:44:48 +00:00
Alexander Aprelev 97393fd961 Introduce StaticCallNode::kNoRebind and use that in implicit closures.
Change-Id: I6219462fed278dbb90361c2084eed886c9245097

Revert "Revert "Introduce inline cache reload rule attribute to static call AST node and ICData.""

This reverts commit 162283c2f3.

This re-lands the change with original revert in Patch set 1, actual bug fix in next patch set.

Bug:
Change-Id: I6219462fed278dbb90361c2084eed886c9245097
Reviewed-on: https://dart-review.googlesource.com/8760
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-28 03:26:22 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00
Aske Simon Christensen 8cb752f73b Revised "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Explicitly clear unbox_numeric_fields flag in PRODUCT builds. Fixes code bloat introduced by previous CL. New changes in Patch Set 2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/3006923002 .
2017-09-04 13:13:26 +02:00
Ryan Macnak 9ce7fb5929 Revert "Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime.""
This reverts commit 8ee4436355.

This change caused a 63% increase in AOT snapshot size of Flutter Gallery.

Issue #30472

Review-Url: https://codereview.chromium.org/2997993002 .
2017-08-17 13:33:37 -07:00
Aske Simon Christensen 8ee4436355 Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Also exclude references to disassembler in precompiled mode.

New edits are in patch set #2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994863002 .
2017-08-12 02:15:23 +02:00
Ryan Macnak 3afd223f90 [gardening] Revert "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
This reverts commit 46c53882cc.

This changes introduced link errors on Windows.

Review-Url: https://codereview.chromium.org/3001463002 .
2017-08-09 15:49:51 -07:00
Aske Simon Christensen 46c53882cc Eliminate dependencies on assemblers and code stubs in precompiled runtime.
Guard all excluded code behind conditional compilation.

Removed precompiled runtime flag. Only preprocessor flag remains.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2976723003 .
2017-08-09 22:21:34 +02: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
John McCutchan 8061bd5a8a Add local variable declaration token position to service protocol
- [x] Add three public fields to the "BoundVariable" service type: declarationTokenPos, visibleStartTokenPos, and visibleEndTokenPos. (naming suggestions welcome!)
- [x] Extend LocalVarDescriptors to hold the declaration token position (it already had the scope visibility boundaries).
- [x] Extend ContextScope to hold the declaration token position.
- [x] Add a unit test which verifies this works for local variables, function parameters, and closure captured variables.

Fixes https://github.com/dart-lang/sdk/issues/25569

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2419013004 .
2016-10-17 11:18:24 -07:00
Florian Schneider 1217e539e9 VM: Remove _leftShiftWithMask32.
It was used for the Javascript integer overflow warnings which were already
removed from the VM.

BUG=
R=regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1900863004 .
2016-04-19 19:06:53 +02: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
Florian Schneider 5c38712ce9 Clean up more flags using flag list.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1766573003 .
2016-03-04 15:15:40 -08:00
Srdjan Mitrovic 5a69e3661b In background compilation make a copy of Field in order to freeze its state. Add flag --force_clone_compiler_objects for debugging purpose.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1722733002 .
2016-02-26 09:07:49 -08:00
Ivan Posva 8d18298fed - Remove Isolate::Flags structure and store flags directly in isolate.
- Make enable_asserts, enable_type_checks, error_on_bad_override and
  error_on_bad_type release mode flags only.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1737693003 .
2016-02-25 18:06:56 -08:00
Regis Crelier 3ffe9922b7 Simplify various name flavors in VM.
R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1723733002 .
2016-02-25 11:21:27 -08: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
Lasse R.H. Nielsen 693628e99e Implement ?? as compile-time constant in VM.
Extracted from https://codereview.chromium.org/1493693002/

R=hausner@google.com

Review URL: https://codereview.chromium.org/1575383002 .
2016-01-22 12:39:16 +01:00
John McCutchan 958e713f5e Use classifying token position for control flow IR instructions
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1574363002 .
2016-01-12 12:52:02 -08:00
Florian Schneider 4a037f0ccb VM: Use read-only handle Object::dynamic_type() where possible.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1528873002 .
2015-12-16 11:31:53 +01:00
Matthias Hausner 29e8118403 Handle potentially const interpolation
Fixes issue reported in 24970. As with all analysis for "potentially constant" expressions, this fix is too permissive. (See issue 392 for details.)

BUG=24970
R=iposva@google.com

Review URL: https://codereview.chromium.org/1455213002 .
2015-11-30 14:37:49 -08:00
Srdjan Mitrovic d4365bc6f4 Lookup getter/setter symbols before alllocating them, thus eliminating extra String allocations in new space.
Various old space allocations, cleanups.
Add a test for Symbols concatenation.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1320673012 .
2015-09-03 14:09:34 -07:00
Srdjan Mitrovic fafbe30eb0 Fix #23871: identical on consts should be always const
BUG=23871
R=hausner@google.com

Review URL: https://codereview.chromium.org//1259813003 .
2015-07-28 11:37:22 -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
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
srdjan@google.com 3ac643115f Remove unneeded flag declaratiosn (enable_type_checks, enable_asserts).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45647 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 16:48:43 +00:00
hausner@google.com 21ca62f8bc Properly resolve top-level setters
Fixes issue 4386.

When converting a getter to a setter (converting a right-hand
side expression to a left-hand side, assignable entity),
we need to know where to look for the setter function.
Top-level setters need to be resolved in the library or prefix
scope in which the getter was found.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45316 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-21 17:36:34 +00:00
hausner@google.com c9400962f7 Cleanup obsolete setter code
Early on in Dart, it was ok to have a static getter and dynamic setter
with the same name. This is no longer the case. Remove code that handles
the obsolete case.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45122 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 21:23:10 +00:00
regis@google.com 4d09e6a9dd Accept constant string concatenation and constant string length as constant
expressions (fix issue 22408).

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43831 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 00:38:40 +00:00
zra@google.com 1299ad1485 Allows turning on checked mode on a per-isolate basis
using the embedding API.

R=regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43481 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 18:32:48 +00:00
mlippautz@google.com 648dca65ba This CL deals with handling of return statements in functions modified as
async. These functions contain a so-called async closure (with the actual body)
that should not just return when encountering a return statement, but rather call
the completer first and then return (null).

Previously the last return node has been replaced with a completer.complete call.
This does not work for return statements in nested blocks or try-catch-finally
blocks.

Instead of replacing return statements we now call the completer after
resolving all steps necessary for return nodes, i.e., right after inlining all
finally blocks.

We also need "continuation" returns later on that do not complete the
completer. We differentiate by whether a return node has its scope set or not.

BUG=
R=hausner@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39167 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 21:50:37 +00:00
fschneider@google.com 9eb97cb338 Don't require eliminating certain type checks in unoptimized compilation.
The compiler relied on the graph builder to eliminate certain type
checks so that running without type check elimination required a
hack in the code generator to deal with the transition sentinel.

This CL makes type checks explicit in the AST and avoid inserting
them where they're not necessary (e.g. assigning null, sentinal values).

R=regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36734 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 10:16:05 +00:00
regis@google.com 989aa3348a Fix an undetected Smi overflow on ARM.
Fix wrongly triggered overflow in optimized code on Intel.
Add a test.
Address a few TODOs.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36186 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 19:57:04 +00:00
hausner@google.com 2b4e3c7c99 Implement deferred constant support
Compile time constants lose their const-ness if they are referred
to through a deferred prefix. This CL adds a flag to some ast node
types that remembers whether a field or closure was referred to
via a deferred prefix. If so, the compile-time const analysis flags
the value as non-const.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34785 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 17:31:32 +00:00
hausner@google.com f847f1831b boolean expressions with null are never potentially const
Fix issue 13394

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29914 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 16:51:50 +00:00
srdjan@google.com 3a8252f90d Cleanups: int -> intptr_t for "array" lengths, memory sizes.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28324 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-07 20:19:37 +00:00
hausner@google.com 3f238a01a5 Add type check to const conditional expression evaluation
issue 13746

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28182 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-02 21:08:24 +00:00
hausner@google.com 4882c514b0 Support compile time constant conditional expressions
Per latest spec (section 12.1, 0.61 draft)

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28131 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 23:00:08 +00:00
kmillikin@google.com e9eec70cad Change --print-ast output to be more regular.
The print-ast output is useful for debugging front end issues.  It is a mix
of fully-parenthesized prefix notation (i.e., Lisp S-expressions) with some
infix.

It is not valid S-expressions for various other reasons.  Most obviously, it
uses ' (single quote) instead of " (double quote) to delimit strings.

This change makes the print-ast output a valid Scheme S-expression.  It can
be pretty printed by copying it, quoting it (by preceding it with a single
quote), and evaluating it at the REPL of a Scheme implementation.

Also, the AST node pretty names are changed to predictably match the class
name.  It doesn't seem helpful to have them be arbitrary.

BUG=
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27282 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 10:20:55 +00:00
kmillikin@google.com 2b19ed632d Disentangle AstNode::Name and AstNode::ShortName.
The Name function is used for pretty printing except that for a few
node types we rely on a specific name for implementation correctness.
Overriding the pretty printing function to get out a type name, or a
variable name, or an operator symbol name, is risky.

1. Code that relies on the semantics of the name will break if the
   pretty name is changed.

2. Pretty printing is less useful.  For instance, LoadLocalNode just
   prints the variable name (twice, once as the AST constructor and
   once in quotes as the variable name).  This is confusing if the
   variable happens to have the same name as one of the other pretty
   names, e.g., args or seq.

Now, there is a virtual function to get the pretty name but classes do
not change it to communicate other information (type names, variable
names, operator names).

BUG=
R=regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27244 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 11:54:26 +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
srdjan@google.com 1f31dcc424 Fix for running with --throw_on_javascript_int_overflow: recognize pattern (a << b) & mask and test for overflow only after the mask.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26122 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 15:12:39 +00:00
regis@google.com 191d2673c8 Use proper internal name for implicit static final getters.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25053 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 16:29:59 +00:00
regis@google.com e8a722870b Support type parameters and classes as expression in the vm.
Turn many compile-time errors into runtime errors per latest spec.
Triage affected tests.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24861 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-09 19:35:56 +00:00
hausner@google.com 98883150d6 Partial solution to analyze potentially constant expressions
This change adds code that detects if an expression can definitively
never be constant. We use this to analyze the initializer expressions
in const constructors. This check is not entirely water tight, but
together with the checks in canonicalization code catches most
illegal initializer expressions.

The const constructor of class Symbol turns out to be illegal. The
name verification check can't be part of the constructor code.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24749 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-03 20:47:14 +00:00
fschneider@google.com be806854c9 Simplify AST by extending LetNode and replace CommaNode.
LetNode now supports a list of expressions as the body.

The last expression is the result value of the let-expression.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23678 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-06 12:32:42 +00:00