Commit Graph

47 Commits

Author SHA1 Message Date
Florian Schneider 890bfa8015 AOT: Fix bug in receiver type propagation after unique selector calls.
Insert Redefinition instructions to prohibit unsafe code motion. If we propagate
the receiver type downwards from a call to a unique selector, we must not hoist
instructions that were optimized using this type information across the call.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2498073004 .
2016-11-16 10:14:40 -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
Siva Annamalai e0164a0ceb More guarding of code under #ifndef PRODUCT ... #endif
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2147363002 .
2016-07-14 17:44:24 -07:00
Ryan Macnak 2d9087648d More ifndef PRODUCT.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2153593002 .
2016-07-14 15:30:32 -07:00
Zachary Anderson e933f28a18 Remove some uses of STL map.
This CL removes the use of STL map from freelist.cc by adding
MallocDirectChainedHashMap in hash_map.h and adding an iterator for
BaseDirectChainedHashMap there.

It also removes a use of STL map from hash_table.h that was dead code.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2083103002 .
2016-06-22 08:32:37 -07:00
Florian Schneider 220b040c4a Simplify and improve optimization of is-tests in the precompiler.
The optimizer now also deals with is-checks for num, double, _Smi in the
same way as it did for int before.

This CL eliminates many is-tests of constants that appear after inlining.

Also, make a better distinction between deoptimizing and non-deoptimizing
cases when replacing is-tests. e.g. InstanceOfInstr can't cause eager
deoptimization.

Also, improve tracing output when running e.g. --trace-inlining

Minor fix in raw_object.h.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2074533002 .
2016-06-16 08:54:27 -07:00
Florian Schneider d8677964a3 Move precompilation-related flags to flags list.
They become compile-time constants in the precompiled runtime, and in product mode.

In precompiled product mode, the precompiled value has precedence.

BUG=
R=rmacnak@google.com

Committed: https://github.com/dart-lang/sdk/commit/5c9f18c6c87284395564051a052cc4acc9b6f59a

Review URL: https://codereview.chromium.org/1731743003 .
2016-02-25 07:53:39 -08:00
Ryan Macnak bd85deaf4e Revert "Move precompilation-related flags to flags list."
The default value of print_stop_message was architecture specific.

TBR=fschneider@google.com

Review URL: https://codereview.chromium.org/1739593002 .
2016-02-24 18:08:01 -08:00
Florian Schneider 5c9f18c6c8 Move precompilation-related flags to flags list.
They become compile-time constants in the precompiled runtime, and in product mode.

In precompiled product mode, the precompiled value has precedence.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1731743003 .
2016-02-24 17:31:08 -08:00
John McCutchan e2e7af1229 Remove more feature in product mode
- Remove Timeline.
- Remove more vmservice code.
- Remove AST printing.
- Remove IL printing.
- Remove profiler.
- Remove thread interrupter.
- Remove disassembler.
- Remove Library::CheckFunctionFingerprints.

- Update test status files for product mode.

Size of dart_bootstrap before: 5287631
Size of dart_bootstrap after: 5112783

Reduction in size: 174848 bytes.

Total reduction in size (382734 + 174848): 557582 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1678203002 .
2016-02-09 08:45:32 -08:00
Florian Schneider d76fe1eacd Clean up global variables related to precompilation.
Replace always_optimize_ and allow_recompilation_ with
 FLAG_precompilation and !FLAG_precompilation.

They are equivalent and set only once according to the
--precompilation flag

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1657153002 .
2016-02-01 19:11:42 -08:00
Florian Schneider dce89b9b5b VM: Speculative inlining in precompiled code.
Enable inlining of certain smi- and array-operations based on propagated
types and range analysis:

If bounds checks and class checks can not be eliminated, bail out of the
current optimization and retry without speculative inlining using the same
mechanism as we use for far jumps on MIPS.

Allow more speculative inlining attempts with up to n deopt ids black-listed.
For now set n=1 since precompilation time will be proportional to n.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1423063005 .
2015-11-18 14:56:06 +01:00
Florian Schneider 97e48123d8 VM: Fix imprecision in array bounds check elimination.
Don't eagerly canonicalize the index boundary before getting
the constant value for comparison. Canonicalization may drop more
precise boundaries defined by already inserted constraints.

This enables eliminating the bounds-check in the following example:

test() {
  var a = new Float64List(4);
  for (var i = 0; i < 4; ++i) {
    a[i] = 1.0;
  }
  return a;
}

Also, add pass of flow-graph canonicalization after load-optimization.
This enables more opportunities for ABCE in examples like:

o.f = new List(4);
o.f[0] = ...

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1434213005 .
2015-11-12 15:18:24 +01:00
Srdjan Mitrovic 6f53350611 Move deopt_id and related helpers/definitions from Isolate to Thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1390153004 .
2015-10-13 10:08:14 -07:00
Daniel Andersson a1bc527306 Migrate logging infrastructure Isolate->Thread
This enables thread-safe logging (e.g., ISL_Print, which will soon be renamed to THR_Print), which is needed for concurrent
marking (DetachCode) and compilation.

Make finalization of GC marking tasks concurrent, now that it's thread-safe.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1314673008 .
2015-09-09 15:30:38 -07:00
Daniel Andersson c089a152ac Migrate most uses of Isolate::current_zone to Thread::zone.
After https://codereview.chromium.org/1204303003/ is submitted, the last remaining uses can go.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1220193009 .
2015-07-08 09:59:32 -07:00
Florian Schneider 5daa5646ef VM: Fix issue with optimizing compiler's range analysis.
Narrowing of ranges should only occur if the new range is actually
narrower than the old range. It can happen that a symbolic range
is worse than the already computed one. Ignore the new range in this
case.

BUG=dartbug.com/23693
R=vegorov@google.com

Review URL: https://codereview.chromium.org//1219623004.
2015-06-29 16:14:06 +02: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
vegorov@google.com 094e899972 Fix Range::Mul for fully non-positive ranges.
BUG=http://dartbug.com/22541
R=fschneider@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44046 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 12:40:55 +00:00
johnmccutchan@google.com 635ba4bbd9 Port flow_graph*, disassembler to ISL_Print
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43609 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 20:49:32 +00:00
srdjan@google.com 110a74f954 Cleanups: parsed_function()->function() => function()
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43213 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 22:09:31 +00:00
koda@google.com 99127744c6 Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces.
Remove deprecated Isolate-based BitVector constructor.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43136 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 14:54:02 +00:00
srdjan@google.com f116c94dfc Cleanup access to Instruction's fields (especially deopt_id_).
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42405 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 18:27:24 +00:00
vegorov@google.com 4a5d1bc80d Improve bitwise OR, AND ranges by using the same approximation we use for XOR.
BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42258 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-10 18:36:37 +00:00
zerny@google.com 4fb54d853d Support use of external strings as inputs to LoadCodeUnitsInstr.
R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42099 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 09:26:48 +00:00
srdjan@google.com bad6a61899 Cleanups.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42069 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 18:48:12 +00:00
zerny@google.com 8e807c8550 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

Committed: https://code.google.com/p/dart/source/detail?r=41949

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41983 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-26 09:32:43 +00:00
zerny@google.com 84a4135901 Revert "Integrate the Irregexp Regular Expression Engine."
This reverts commit https://code.google.com/p/dart/source/detail?r=41949

TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41950 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:36:40 +00:00
zerny@google.com 43ac0c6f33 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41949 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:10:21 +00:00
vegorov@google.com 8f7f26c0a4 Reland "Suppress canonicalization of Unbox() instruction that can deoptimize."
This relands commit r41693 with additional fixes in canonicalization pass.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41736 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-14 11:19:42 +00:00
vegorov@google.com 29f021439a Infer range for BIT_XOR.
When selecting representations unbox integer phis that have Int32 range and have only constants or boxing operations flowing into them.

BUG=http://dartbug.com/13869
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41667 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-11 14:51:10 +00:00
vegorov@google.com 0a8e45ae35 Improve precision of range analysis by allowing it to track ranges across all int typed phis.
Even when range of the integer definition is unknown we can optimistically assign full int64-range to it even though tagged integer definition can contain instance of the Bigint. This is based on the following observation: we only use ranges when working with unboxed arithmetic in the optimized code, but the widest possible unboxed arithmetic is 64-bit (mint) one and corresponding unboxing operations will deoptimize if they get Bigint as an input. This makes it safe to assume that any integer definition fits into 64-bit range *once unboxed*.

Additional small fixes:

- Fix ranges assigned to loads from Int32/Uint32 arrays on 64-bit platform - it was overly conservative;

- Add UnboxUint32 range inference to ensure that range is not lost when it passes through box-unbox pair;

- When canonicalizing Binary/Unary Integer operations ensure that we unwrap UnboxUint32(Constant(C)) -> C.

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41640 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-10 17:16:14 +00:00
vegorov@google.com e6847ac17c IR refactoring: consolidate all boxing and unboxing instructions.
BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41437 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 12:17:12 +00:00
vegorov@google.com 3d0ddfce79 BoundsCheckGeneralizer::Simplify should ignore unsupported binary ops.
R=fschneider@google.com
BUG=http://dartbug.com/21324

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41118 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 10:26:37 +00:00
vegorov@google.com 71c15a979c Fix clang based build after r40969.
TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40972 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-07 19:09:32 +00:00
vegorov@google.com e6113cc0f5 If bounds check 0 <= index < length is not redundant we attempt to
replace it with a sequence of checks that guarantee

          0 <= LowerBound(index) < UpperBound(index) < length

and hoist all of those checks out of the enclosing loop.

Upper/Lower bounds are symbolic arithmetic expressions with +, -, *
operations and are computed based on discovered simple induction variables.

Simple induction variable is a variable that follows the pattern v1 <- phi(v0, v1 + 1)

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40969 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-07 18:50:29 +00:00
fschneider@google.com 217dab63db Fix assertion failure in range analysis.
The resulting range was correct, but not precise, as expected (too large by a constant)

BUG=dartbug.com/21245
TEST=tests/language/vm/regress_21245_test.dart
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40932 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 14:52:05 +00:00
srdjan@google.com b8891bf412 Pass isolate to BitVector constructor.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40528 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-19 23:14:34 +00:00
vegorov@google.com d61a330d7c Initial steps towards cleaning up integer arithmetic IR.
Introduce base classes for binary and unary integer operations and move all shared logic (e.g. canonicalization) into these classes.

Start removing special cases dispatch from instructions patterns - it goes into Canonicalization pass.

Start removing duplication between instruction patterns where meaningful and possible.

Cleanup the notion of truncation in the operations: is_truncating implies !can_overflow, not the other way around.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40375 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-17 13:31:13 +00:00
fschneider@google.com 300909afb5 Fix bug in range analysis.
A definition that is in the same block as a phi can never
dominate the phi, since phis are at the very start of a block.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40102 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-10 18:56:45 +00:00
vegorov@google.com c8e5382693 Address review comments for r39595.
R=srdjan@google.com, srdjan@googe.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39697 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-29 11:36:11 +00:00
vegorov@google.com 9f9e250e92 Support Int32 representation for selected binary operations.
BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39595 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 14:49:19 +00:00
vegorov@google.com a8e81404e7 Don't check for reaching type in the RangeAnalysis::GetRange.
Canonicalizer rewrites

v1 = _Int32Array._new(v0)
v2 = v1.length
use(v2)

as

v1 = _Int32Array._new(v0)
use(v0)

without changing reaching type of v0 to Smi at the use.

This means right now we can't expect that uses at Smi operations have propagated smi type.

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39331 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-18 15:04:46 +00:00
vegorov@google.com 336dbd4cbf Reland r39293.
Switch to a fix-point based range analysis to improve its precision.

Dominator based algorithm was very imprecise for loop phis.

Use widening to ensure fast convergence and narrowing to improve precision.

Fixed compared to r39293:

Type propagation is more sophisticated now compared to the time
when range analysis was originally implemented and is able to derive Smi-ness
from more than just CheckSmi instruction (e.g. GuardFieldClass). This creates
situations when use's reaching type is Smi but definition itself is not a Smi
and thus will never have range assigned to it.

It is incorrect to treat ranges of such uses as unknown (_|_), because unknown
means "not yet computed". Instead we must use the widest possible approximation:
full smi range.

InferRange methods were rewritten to use a newly introduced GetRange helper
instead of accessing value()->definition()->range() directly.

As a side-effect we no longer need to insert artificial constraints after CheckSmi instructions.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39327 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-18 11:06:27 +00:00
vegorov@google.com f2c3859068 Revert "Switch to a fix-point based range analysis to improve its precision."
This reverts r39293.

The dart2js part of the tree is on fire.

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39296 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-15 15:44:31 +00:00
vegorov@google.com 2b42387699 Switch to a fix-point based range analysis to improve its precision.
Dominator based algorithm was very imprecise for loop phis.

Use widening to ensure fast convergence and narrowing to improve precision.

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39293 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-15 15:29:31 +00:00
vegorov@google.com 1acb21443f Consolidate all range analysis related code in a separate file.
This makes working with it easier, similar to how we have all type propagation code in flow_graph_type_propagator.{cc,h}

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38928 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-06 12:43:49 +00:00