Commit Graph

414 Commits

Author SHA1 Message Date
jacob.bramley
065b2374aa Reland [arm64][turbofan]: Handle any immediate shift.
With this patch, we can generate simple immediate-shift instructions for
immediates outside the range "0 <= imm < width". Several related
instruction selectors have also been updated accordingly.

Example of generated code:

    ---- Before ---         ---- After ----
    movz w0, #33            lsr w0, w1, #1
    lsr  w0, w1, w0

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28977}
2015-06-12 05:03:18 +00:00
martyn.capewell
b702cd97d4 [turbofan] Prefer add/shift over madd on ARM64
Before selecting multiply-accumulate for a multiplication with add operation,
check that the multiply can't be reduced to add-with-shift. This prevents
simple multiplications by 3, 5, etc turning into register moves and madd
instructions.

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

Cr-Commit-Position: refs/heads/master@{#28976}
2015-06-12 05:01:07 +00:00
martyn.capewell
1f876f245a [turbofan] Merge sar/shr into MulHigh on ARM64
Merge a following arithmetic or logical right shift into the existing shift
of ARM64's Int32MulHigh or Uint32MulHigh code.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28945}
2015-06-11 14:50:13 +00:00
jacob.bramley
14755c0a2d Revert of [arm64][turbofan]: Handle any immediate shift. (patchset #1 id:1 of https://codereview.chromium.org/1179733004/)
Reason for revert:
Breaks InstructionSelectorTest.Word64ShrWithWord64AndWithImmediate on debug builds (but not optdebug builds). I'll investigate.

Original issue's description:
> [arm64][turbofan]: Handle any immediate shift.
>
> With this patch, we can generate simple immediate-shift instructions for
> immediates outside the range "0 <= imm < width". Several related
> instruction selectors have also been updated accordingly.
>
> Example of generated code:
>
>     ---- Before ---         ---- After ----
>     movz w0, #33            lsr w0, w1, #1
>     lsr  w0, w1, w0
>
> BUG=
>
> Committed: https://crrev.com/36d771bbfa4af5efcc1c1dcf5b234445cb7ee722
> Cr-Commit-Position: refs/heads/master@{#28943}

TBR=bmeurer@chromium.org,ulan@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28944}
2015-06-11 14:46:42 +00:00
jacob.bramley
36d771bbfa [arm64][turbofan]: Handle any immediate shift.
With this patch, we can generate simple immediate-shift instructions for
immediates outside the range "0 <= imm < width". Several related
instruction selectors have also been updated accordingly.

Example of generated code:

    ---- Before ---         ---- After ----
    movz w0, #33            lsr w0, w1, #1
    lsr  w0, w1, w0

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28943}
2015-06-11 13:51:03 +00:00
mstarzinger
3548c5c6f1 [turbofan] Make IfException projections consume effects.
This is needed in order to allow expansion of a throwing node into a
set of nodes that produce different effects for the successful and the
exceptional continuation.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28918}
2015-06-11 04:22:11 +00:00
mstarzinger
23d7123cff [turbofan] Deprecate NodeProperties::ReplaceWithValue.
This deprecates the aforementioned mutator in favor of a simpler
NodeProperties::ReplaceUses that doesn't perform any relaxation.
Preparation for enabling support for try-catch statements.

R=bmeurer@chromium.org
TEST=unittests/NodePropertiesTest

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

Cr-Commit-Position: refs/heads/master@{#28897}
2015-06-10 09:14:03 +00:00
mvstanton
662a5585ee Turbofan: Make type feedback vector a Node.
This improves code generation. Before, it was a constant loaded in a register
every time.

R=mstarzinger@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28874}
2015-06-09 16:02:33 +00:00
mstarzinger
5ca1f24dd5 [turbofan] Optimized lowering of DYNAMIC_LOCAL lookup slot loads.
This adds handling of JSLoadDynamicContext nodes to JSTypedLowering to
perform extension checks and an inline fast path. The fast path is a
context slot load targeting a specific context.

R=bmeurer@chromium.org
BUG=v8:4131
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28823}
2015-06-08 08:59:05 +00:00
mstarzinger
5cefb367ce [turbofan] Turn LoadElimination into an AdvancedReducer.
This in turn allows usage of AdvancedReducer::ReplaceWithValue which
has access to the underlying graph reducer.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28817}
2015-06-05 16:40:58 +00:00
mstarzinger
a6f23850a5 [turbofan] Turn JSBuiltinReducer into an AdvancedReducer.
This in turn allows usage of AdvancedReducer::ReplaceWithValue which
has access to the underlying graph reducer. It will allow us to deal
with exception continuations correctly.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28813}
2015-06-05 12:37:48 +00:00
mstarzinger
8f4d9a0a1e [turbofan] Allow ReplaceWithValue to kill control.
This allows any AdvancedReducer to remove exception projections from
graphs. This is the common case when JS-operators are being replaced
with pure values. The old NodeProperties::ReplaceWithValue is being
deprecated in favor of AdvancedReducer::ReplaceWithValue.

R=titzer@chromium.org
TEST=unittests/AdvancedReducerTest

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

Cr-Commit-Position: refs/heads/master@{#28810}
2015-06-05 12:02:09 +00:00
paul.lind
21585d55c1 Fix more -Wsign-compare bugs with GCC 4.9.2.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28798}
2015-06-04 01:28:27 +00:00
bmeurer
e0fa875858 [turbofan] Use reference equal to zero instead of a smi check.
In typed lowering we can use the ReferenceEqual simplified operator
instead of ObjectIsSmi to check for context extensions. This generates
the desired code.

R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28776}
2015-06-03 05:10:55 +00:00
martyn.capewell
afd0367f5d [arm64] Use ubfiz in ARM64 instruction selector
Select ubfiz for (x & mask) << imm where mask is contiguous and imm is non-zero.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28755}
2015-06-02 10:57:44 +00:00
mstarzinger
440d099c5c [turbofan] Optimized lowering of DYNAMIC_GLOBAL lookup slot loads.
This adds handling of JSLoadDynamicGlobal nodes to JSTypedLowering to
perform extension checks and an inline fast path. The fast path is a
global variable load from the global object.

R=bmeurer@chromium.org
BUG=v8:4131
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28750}
2015-06-02 09:37:59 +00:00
bmeurer
86b30420a8 [turbofan] Enable typed lowering of string addition.
Unfortunately StringAdd is not pure in V8 because we might throw an
exception if the resulting string length is outside the valid bounds, so
there's no point in having a simplified StringAdd operator.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28747}
2015-06-02 08:50:53 +00:00
mstarzinger
d8b94f34cc [turbofan] Introduce prediction for exception handlers.
This introduces a conservative prediction for each exception handler
whether it will locally catch an exception or re-throw it to outside
the code bondaries. It will allow for a more intuitive prediction of
whether an exception is considered "caught" or "uncaught".

R=bmeurer@chromium.org,yangguo@chromium.org
BUG=chromium:492522
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28681}
2015-05-28 13:23:03 +00:00
bmeurer
b77df02713 [turbofan] Remove the JSGraph dependency from the ControlFlowOptimizer.
The control flow optimization should work independent of the JSGraph. We
used the JSGraph there because it was convinient, not because it was
necessary.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28674}
2015-05-28 09:13:05 +00:00
bmeurer
19482d29e5 [turbofan] Remove the useless SimplifiedOperatorReducer.
The SimplifiedOperatorReducer is (mostly) unused, except for the very
rough store elimination, and just eats compilation time.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28673}
2015-05-28 08:38:13 +00:00
bmeurer
b66226a9d9 [turbofan] Optimize strict equality of unique values.
If both inputs to JSStrictEqual/JSStrictNotEqual are unique values (i.e.
values with a canonical representation), we can lower the comparison to
ReferenceEqual instead of StringEqual or CompareIC.

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

Cr-Commit-Position: refs/heads/master@{#28646}
2015-05-27 04:23:41 +00:00
bmeurer
f6fb5eb197 [turbofan] Connect loops to end via Terminate during graph building.
This way we don't need to connect (potentially) non-terminating loops
later during control reduction, which saves one forward pass over the
control graph.  Long term we will move the trimming functionality of
the control reducer to the GraphReducer, and get rid of the Finish
method again.

As a bonus, this change also properly rewires Terminate, Throw and
Deoptimize during inlining.

R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28625}
2015-05-26 12:18:07 +00:00
bmeurer
2b93b8aa41 [turbofan] Change End to take a variable number of inputs.
This simplifies the handling of the End node. Based on this CL we will
finally fix terminating every loop from the beginning (via Terminate
nodes) and fix inlining of Throw, Deoptimize and Terminate.

R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28620}
2015-05-26 10:32:10 +00:00
titzer
65b66634de [turbofan] Rework Node guts to save space.
This reduces the storage per-Node storage from 7 words to 6 and per-edge
storage from 6 words to 4.
On average this is about 10%-15% space savings over the whole graph.

Remove the use of std::deque as the out-of-line storage for inputs.
Reduce size of Use links and use pointer arithmetic to find Node
from Use.

R=mstarzinger@chromium.org,jarin@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28583}
2015-05-22 11:12:47 +00:00
titzer
41795b8ae2 [turbofan] Add bounds check to Node::InputAt(index) and fix tests that go out of bounds.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28540}
2015-05-21 10:59:40 +00:00
bmeurer
4a1ab1cac4 [turbofan] Pass deoptimization mode to type feedback specializer.
R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28524}
2015-05-20 17:01:17 +00:00
bmeurer
8236bfbae3 [turbofan] Pass deoptimization mode to intrinsic lowering.
R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28515}
2015-05-20 13:11:24 +00:00
ulan
f2f8001f1b Take freed handles into account when scheduling idle GCs.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28508}
2015-05-20 12:09:52 +00:00
ulan
39491c5168 Restore NothingOrDone action in idle time handler.
This also adjusts transitioning between modes so that crbug.com/460090 remains fixed.

BUG=chromium:489323, chromium:460090
LOG=NO

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

Cr-Commit-Position: refs/heads/master@{#28490}
2015-05-19 18:12:07 +00:00
mstarzinger
c06b1e05ca [turbofan] Turn JSIntrinsicLowering into an AdvancedReducer.
This in turn allows usage of AdvancedReducer::ReplaceWithValue which
has access to the underlying graph reducer. It will allow us to deal
with exception continuations correctly.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28485}
2015-05-19 15:10:23 +00:00
mstarzinger
329a3f220c [turbofan] Turn JSTypedLowering into an AdvancedReducer.
This in turn allows usage of AdvancedReducer::ReplaceWithValue which
has access to the underlying graph reducer. It will allow us to deal
with exception continuations correctly.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28468}
2015-05-19 09:57:42 +00:00
titzer
178c0f5f05 [turbofan] Fix Node::TrimInputCount() followed by Node::AppendInput() bug.
R=mstarzinger@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28452}
2015-05-18 15:49:04 +00:00
titzer
029a2d61a6 [turbofan] JSTypeFeedbackSpecializer is now an AdvancedReducer.
R=bmeurer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28441}
2015-05-18 11:54:00 +00:00
hpayer
6ead193b51 Make sure that idle scavenges are just performed when enough objects are allocated in new space.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28428}
2015-05-15 16:06:08 +00:00
bmeurer
1643671f1b [turbofan] Pass closure as node to FrameState.
First step towards support for inlining based on SharedFunctionInfo
instead of JSFunction.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28419}
2015-05-15 12:17:05 +00:00
hpayer
bc9e53406e When context disposal rate is high and we cannot perform a full GC, we do nothing until the context disposal rate becomes lower.
BUG=chromium:473351
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#28416}
2015-05-15 07:48:07 +00:00
martyn.capewell
cdc43bc5fd ARM64: Enable shorten-64-to-32 warning
Enable clang's shorten-64-to-32 warning flag on ARM64, and fix the warnings
that arise.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28412}
2015-05-15 05:13:11 +00:00
titzer
29e15dad16 [turbofan] Add FrameStates before all property accesses.
R=jarin@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28392}
2015-05-13 12:29:32 +00:00
bmeurer
2111d18dba [turbofan] Add frame state before JavaScript comparisons.
Use these check points to optimize comparisons where we already know
that one side cannot be a String (or turn into a string via
ToPrimitive).

Also remove bunch of useless DoNotCrash tests for the scheduler that are
painful to maintain and add almost no value.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28383}
2015-05-13 07:38:35 +00:00
ulan
bbca83c398 Make transition to reduce memory mode more conservative in idle time handler.
BUG=chromium:486005
LOG=NO

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

Cr-Commit-Position: refs/heads/master@{#28378}
2015-05-12 17:24:58 +00:00
titzer
e5d5cac7d9 [turbofan] Add AdvancedReducer::ReplaceWithValue() method and convert JSInlining to an AdvancedReducer.
Note that this is just a duplication for now. We'll want to get rid of the
NodeProperties::ReplaceWithValue() method in the long run.

R=bmeurer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28363}
2015-05-12 12:41:36 +00:00
wingo
004bb77ec5 Fix more -Werror=sign-compare bugs with GCC 4.9.2
R=svenpanne@chromium.org
LOG=N
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28337}
2015-05-11 11:07:15 +00:00
martyn.capewell
6e6d956e11 [turbofan] Use sbfx in ARM64 instruction selector
Select sbfx for ((x << k) >> k) in ARM64 instruction selector, and similarly
for ubfx. This is a more generic version of the previous sxtb/h selector.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#28318}
2015-05-08 12:51:43 +00:00
bmeurer
189609e197 [turbofan] Float32Abs and Float64Abs are supported by all backends.
The Float32Abs and Float64Abs operators are supported by all TurboFan
backends, so we no longer need the flags for them.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28310}
2015-05-08 08:25:05 +00:00
ulan
ae6a0b8075 Add mode to reduce memory usage in idle notification.
While the mutator is active, the idle time handler optimizes for latency by doing only incremental steps and scavenges.

When the mutator becomes inactive, the idle time handler forces few incremental GCs to reclaim memory and then stops until mutator is active again.

BUG=460090
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28300}
2015-05-07 14:41:54 +00:00
ulan
d77839fd01 Add aggregated memory histograms.
This introduces V8.MemoryHeapCommitted and V8.MemoryHeapUsed histograms.

In contrast to the existing memory histograms, the new histograms are uniform in time, i.e. their samples happen at regular time intervals. The --histogram-interval specifies the length of the interval.

We implement this by linearly interpolating memory stats between GC and idle notification events.

BUG=chromium:485472
LOG=NO

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

Cr-Commit-Position: refs/heads/master@{#28292}
2015-05-07 10:03:41 +00:00
bmeurer
203438d9bc [turbofan] Connect non-terminating loops via Terminate.
This revives the Terminate operator and removes the weird Always
operator. As a first step we let the ControlReducer connect non
terminating loops via Terminate. The next step will be to change the
graph builder to insert Terminate nodes into every loop.

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

Cr-Commit-Position: refs/heads/master@{#28259}
2015-05-06 12:51:44 +00:00
bmeurer
7b33409ba3 [turbofan] Add support for advanced reducers.
An AdvancedReducer is basically a regular Reducer with an editor
that can perform graph editing operations beyond changing or
replacing the node that is currently being reduced. The GraphReducer
is the default implementation of the AdvancedReducer::Editor interface.

The ControlReducerImpl is now just an AdvancedReducer, which
temporarily requires a Finish method in the reducer to implement
the dead node trimming until we move that to the GraphReducer
(which in turn requires that all loops are connected to End).

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

Cr-Commit-Position: refs/heads/master@{#28251}
2015-05-06 10:12:52 +00:00
bmeurer
d21de2a48b [turbofan] Fix tail call optimization.
Tail calls are matched on the graph, with a dedicated tail call
optimization that is actually testable. The instruction selection can
still fall back to a regular if the platform constraints don't allow to
emit a tail call (i.e. the return locations of caller and callee differ
or the callee takes non-register parameters, which is a restriction that
will be removed in the future).

Also explicitly limit tail call optimization to stubs for now and drop
the global flag.

BUG=v8:4076
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#28219}
2015-05-05 09:43:02 +00:00
mstarzinger
d6945db703 [turbofan] Add SimplifiedOperator::Allocate operator.
This introduces a simplified allocation operator which can be used to
model inline allocations in TurboFan. It is currently used for context
allocations, but still disabled because change lowering introduces
floating allocations outside the effect chain that interfere.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28195}
2015-05-04 12:07:12 +00:00