Commit Graph

33 Commits

Author SHA1 Message Date
Alexander Markov 274b4d3ecb [vm/nnbd] Avoid passing null as a non-nullable argument of _AssertionError._create
In kernel files assertion conditions are specified as a range of source
positions. Sometimes source texts are not available and VM cannot
extract assertion condition text, so Script::GetSnippet returns null.

With null safety it is no longer valid to pass null as a non-nullable
argument '_failedAssertion' of _AssertionError._create constructor,
so we should provide a valid String. This change converts 'null'
assertion condition text to "<optimized out>", similarly to AOT mode.

Issue https://github.com/flutter/flutter/issues/63513
Issue https://github.com/dart-lang/sdk/issues/34586

Change-Id: I9c5791e98fdef358068f3f5ddc4cfe98e8c7ed36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158162
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-08-12 00:23:20 +00:00
Alexander Markov 7bbf2921db [vm/nnbd] Non-null assertions in NNBD weak mode
Fixes https://github.com/dart-lang/sdk/issues/42357

Change-Id: I07341ba02361201ec2130fb7b6cb87a25b9b5f51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151662
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-06-18 20:02:42 +00:00
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00
Matthew Dempsky 4ce3aa7af1 [vm] Replace ^= assignments with = where possible
Change-Id: I04ac2e9c4b8bb654b7c660e728be3867aa4e1513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100923
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
2019-05-01 00:04:44 +00:00
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +00:00
Régis Crelier 5f36c5f9d8 [vm] Delete BoundedType class in VM.
In Dart2, type bounds checking is either performed by the common front-end or
by explicitly generated code, but not by type finalization or runtime anymore,
as it was done in Dart1.
Consequently, the class BoundedType is not needed anymore, and malbounded or
malformed types are not seen by the runtime either.

Change-Id: I5d6e4c68d153d6730fa7ff7f6d9dcfa611299c16
Reviewed-on: https://dart-review.googlesource.com/c/86687
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-10 23:15:27 +00:00
Régis Crelier f721d52163 [VM runtime] Introduce a new VM class Bytecode.
Allow pc_marker slot to hold a Code object or a new Bytecode object.

Change-Id: If11c1df6dafc5b1cfcce6f0322c36d1d68e86df9
Reviewed-on: https://dart-review.googlesource.com/c/82526
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-14 02:48:03 +00:00
Ryan Macnak 30b0b9b723 [vm] Code size reductions:
- Remove dead Isolate::IsTopLevelParsing.
 - Remove dead TraceFunctionEntry/Exit.
 - Migrate more tracing flags to flag_list.h to allow code elimination in non-debug modes.
 - Require an explicit Zone parameter for CheckedHandles.
 - Remove side-effects from RuntimeEntry constructor.

out/ProductX64/exe.stripped/dart_precompiled_runtime 4063464 -> 4046952 (-16k)

Change-Id: Iffd3de25a03d2354cdecf2d79aa761c33ab08bd3
Reviewed-on: https://dart-review.googlesource.com/c/83120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-08 02:02:39 +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
Martin Kustermann ac8d2056a3 Fix asserts in StackFrameIterator which were effectively disabled
The assertions which tried to assert that we only use
StackFrameIterator to walk frames of the current thread was incorrect.
We already have cases where other threads will walk the stack of the
mutator thread, see below for an example where this can happen.

Thread::VisitObjectPointers was incorrectly passing Thread::Current() to
the StackFrameIterator instead of 'this'.  (Code in thread_registry.cc will
loop over a number of threads and calls VisitObjectPointers on them)

  Mutator thread:

    0  pthread_cond_wait@@GLIBC_2.3.2
    1  dart::Monitor::WaitMicros
    2  dart::Monitor::Wait
    3  dart::MonitorLocker::Wait
    4  dart::ThreadBarrier::Sync
    5  dart::GCMarker::MarkObjects
    6  dart::PageSpace::MarkSweep
    7  dart::Heap::CollectOldSpaceGarbage
    8  dart::Heap::CollectNewSpaceGarbage
    9  dart::Heap::CollectGarbage
    10 dart::DN_HelperObject_<native>
    11 dart::BootstrapNatives::<native>
    <dart frames>

  MarkTask thread:

    1  dart::EntryFrame::VisitObjectPointers
    2  dart::Thread::VisitObjectPointers          <---- Walks mutator thread stack
    3  dart::ThreadRegistry::VisitObjectPointers  <---- Iterates over a number of threads
    4  dart::Isolate::VisitStackPointers
    5  dart::Isolate::VisitObjectPointers
    6  dart::GCMarker::IterateRoots
    7  dart::MarkTask::Run
    8  dart::ThreadPool::Worker::Loop
    9  dart::ThreadPool::Worker::Main
    10 dart::ThreadStart

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2845053003 .
2017-05-03 10:27:01 +02:00
Matthias Hausner 2c0b605a96 Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

BUG=#24215
R=regis@google.com

Review-Url: https://codereview.chromium.org/2574003003 .
2016-12-14 11:05:19 -08:00
Matthias Hausner 156fdef01d Revert "Add optional message argument to assert statements in the VM."
This reverts commit 67e83dd79d.

BUG=

Review-Url: https://codereview.chromium.org/2558993005 .
2016-12-09 09:50:27 -08:00
Matthias Hausner 67e83dd79d Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

Fixes issue #24215
BUG= http://dartbug.com/24215

This replaces Lasse’s CL  1307363005

patch from issue 1307363005 at patchset 140001 (http://crrev.com/1307363005#ps140001)

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2564623003 .
2016-12-09 09:25:58 -08:00
Florian Schneider 86d62d66f2 Allocate generic types in new-space before canonicalizing.
A previous CL missed the second allocation site (https://github.com/dart-lang/sdk/commit/6418f8f36caf4f6af2f575c2f1a7ca828d82ee00) in Instance::GetType.

Pass space used in GetType() explicitly to use old-space when invoked from the background compiler.

Fixes #27663.

R=regis@google.com

Review URL: https://codereview.chromium.org/2509013002 .
2016-11-16 12:41:32 -08:00
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
John McCutchan d62e41fcea Use old assertion text script in precompiled mode
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2466533003 .
2016-10-31 09:13:55 -07:00
John McCutchan 8007a98b5b Produce the correct assertion failure expression in the face of inlining
Fixes #27671

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2453263002 .
2016-10-27 07:29:22 -07:00
Matthias Hausner 98033d4132 Simplify generated code for assert()
Move the assert condition check and throwing the error into
the Dart library. This eliminates one call to library code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2073623002 .
2016-06-16 10:44:30 -07:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

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

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
Vyacheslav Egorov a9498ee8cb Remove --abort_on_assertion_errors and all associated infrastructure.
R=fschneider@google.com
BUG=http://dartbug.com/25753

Review URL: https://codereview.chromium.org/1703503002 .
2016-02-16 15:32:40 +01: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
Vyacheslav Egorov 6c85aca6d2 Introduce a flag to force program abort on type/assertion errors.
We intend to switch this turn this flag on for dart2js buildbots to collect more
information about impossible type-errors that sporadically occur there.

R=iposva@google.com
BUG=

Review URL: https://codereview.chromium.org/1654153002 .
2016-02-02 01:53:03 +01:00
Regis Crelier 7f57ebcfa1 Remove signature classes from the VM.
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.

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

Review URL: https://codereview.chromium.org/1584223006 .
2016-01-19 16:32:59 -08:00
Lasse R.H. Nielsen da8baacae4 Make root-zone handleUncaughtError rethrow with the correct stack.
Adds _rethrow function which reifies the stack trace of an async
error on the VM. There is no corresponding JS functionality, it still
just throws an AsyncError wrapper.

Fixes issue #24163
BUG= http://dartbug.com/24163
R=iposva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//1383983002.
2015-10-05 08:16:52 +02:00
srdjan@google.com 9c16a399ca Cleanups.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32000 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-24 22:00:04 +00:00
regis@google.com e3da5e16e4 Check type bounds of redirecting factories (issue 14699).
Add tests for malbounded redirecting factories.
Clean up bound checking code and type error reporting code.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30177 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-11 22:59:48 +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
regis@google.com 09bcdc6d6d Fix VM implementation of CastError not to extend TypeError (issue 5280).
Remove non-compliant fields in various Error classes (issue 10144).
Remove implicit constructor when patching in a constructor (issue 12217).
Patch corelib Error classes instead of declaring subclasses.
Update tests and status files.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25782 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-05 18:35:04 +00:00