Commit Graph

30 Commits

Author SHA1 Message Date
jarin
bb2a830deb [turbofan] Make MachineType a pair of enums.
MachineType is now a class with two enum fields:
- MachineRepresentation
- MachineSemantic

Both enums are usable on their own, and this change switches some places from using MachineType to use just MachineRepresentation. Most notably:
- register allocator now uses just the representation.
- Phi and Select nodes only refer to representations.

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

Cr-Commit-Position: refs/heads/master@{#32738}
2015-12-10 09:03:53 +00:00
jarin
59c616ccd7 [turbofan] Introduce node regions for protection from scheduling.
This CL re-purposes ValueEffect and Finish as delimiters for regions
that are scheduled atomically (renamed to BeginRegion, FinishRegion).

The BeginRegion node takes and produces an effect. For the uses that do
not care about the placement in the effect chain, it is ok to feed
graph->start() as an effect input.

The FinishRegion takes a value and an effect and produces a value and
an effect. It is important that any value or effect produced inside the
region is not used outside the region. The FinishRegion node is the only
way to smuggle an effect and a value out.

At the moment, this does not support control flow inside the region. Control flow would be hard.

During scheduling we do some sanity check, but the checks are not exhaustive. Here is what we check:
- the effect chain between begin and finish is linear (no splitting,
  single effect input and output).
- any value produced is consumed by the FinishRegion node.
- no control flow outputs.

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

Cr-Commit-Position: refs/heads/master@{#31265}
2015-10-14 14:53:12 +00:00
paul.lind
9d66c8813a Fix another gcc 4.9.2 signed-compare error.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#31199}
2015-10-09 20:04:09 +00:00
bradnelson
2e3c36fb1c Adding support for multiple returns in compiled functions.
This will allow exploration of possibilities like passing around buffer base and length.

BUG=None
TEST=test-multiple-return
LOG=N
R=mtrofin@chromium.org,titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#31184}
2015-10-08 18:27:46 +00:00
machenbach
4abfa4e43f [test] Remove unused code.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#30469}
2015-08-31 11:52:33 +00:00
bmeurer
733a246386 [turbofan] Proper dead code elimination as regular reducer.
The three different concerns that the ControlReducer used to deal with
are now properly separated into

  a.) DeadCodeElimination, which is a regular AdvancedReducer, that
      propagates Dead via control edges,
  b.) CommonOperatorReducer, which does strength reduction on common
      operators (i.e. Branch, Phi, and friends), and
  c.) GraphTrimming, which removes dead->live edges from the graph.

This will make it possible to run the DeadCodeElimination together with
other passes that actually introduce Dead nodes, i.e. typed lowering;
and it opens the door for general inlining without two stage fix point
iteration.

To make the DeadCodeElimination easier and more uniform, we basically
reverted the introduction of DeadValue and DeadEffect, and changed the
Dead operator to produce control, value and effect. Note however that
this is not a requirement, but merely a way to make dead propagation
easier and more uniform. We could always go back and decide to have
different Dead operators if some other change requires that.

Note that there are several additional opportunities for cleanup now,
i.e. OSR deconstruction could be a regular reducer now, and we don't
need to use TheHole as dead value marker in the GraphReducer. And we can
actually run the dead code elimination together with the other passes
instead of using separate passes over the graph.  We will do this in
follow up CLs.

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

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

Cr-Commit-Position: refs/heads/master@{#29146}
2015-06-19 12:07:26 +00:00
mstarzinger
eb0e7437d3 [turbofan] Introduce DeadValue and DeadEffect operators.
R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29104}
2015-06-18 08:17:17 +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
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
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
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
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
Ross McIlroy
063fc25122 Replace OVERRIDE->override and FINAL->final since we now require C++11.
R=jochen@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#27937}
2015-04-20 13:08:14 +00:00
mstarzinger
48c185fe75 [turbofan] Fix properties of IrOpcode::kThrow operator.
This changes the IrOpcode::kThrow operator to have kNoThrow property,
which sounds unintuitive, but holds for our graphs. The operators is
used to indicate exceptional control flow out of the function, but in
itself does not throw, the throwing is done by a runtime call.

R=titzer@chromium.org
TEST=unittests/CommonOperatorTest/CommonSharedOperatorTest.Properties

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

Cr-Commit-Position: refs/heads/master@{#27541}
2015-03-31 13:44:04 +00:00
mstarzinger
e9e8ac7afc [turbofan] Project exception value out of calls.
TEST=cctest/test-run-jsexceptions

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

Cr-Commit-Position: refs/heads/master@{#27537}
2015-03-31 12:26:39 +00:00
mstarzinger
6881d7609a Model exceptional edges from call nodes in TurboFan.
R=titzer@chromium.org,bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#26766}
2015-02-20 09:55:00 +00:00
bmeurer
acd9c46ca7 [turbofan] Optimize certain chains of Branch into a Switch.
This adds a new ControlFlowOptimizer that - for now - recognizes chains
of Branches generated by the SwitchBuilder for a subset of javascript
switches into Switch nodes. Those Switch nodes are then lowered to
either table or lookup switches.

Also rename Case to IfValue (and introduce IfDefault) for consistency.

BUG=v8:3872
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#26691}
2015-02-17 13:29:46 +00:00
mstarzinger
ec4305e48b Mark some common operator with Property::kNoThrow.
R=bmeurer@chromium.org
TEST=unittests/CommonOperatorTest

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

Cr-Commit-Position: refs/heads/master@{#26584}
2015-02-11 15:02:41 +00:00
bmeurer
feb2890711 [turbofan] Initial support for Switch.
Adds Switch and Case operators to TurboFan and handles them
appropriately in instruction selection and code generation.

BUG=v8:3872
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#26515}
2015-02-09 08:56:12 +00:00
bmeurer
59a02ebdbe [turbofan] Ensure that NTLs are always properly connected to the end.
Up until now we used a special Terminate node to artifically connect non
terminating loops to the End node, but this was kind of adhoc and didn't
work for the CFG. So without all kinds of weird hacks, the end block in
the CFG will not be connected to NTLs, which makes it impossible to
compute post dominance / control dependence in the current setting.

So instead of Terminate, we add a special Branch to NTLs, whose
condition is the special Always node, which corresponds to True, except
that it cannot be folded away. This way we don't need any special
machinery in the scheduler, since it's just a regular Branch.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#26294}
2015-01-27 14:02:28 +00:00
bmeurer
eeec886e5f [turbofan] Deinlinify OperatorProperties implementation.
TEST=cctest,unittests
R=jochen@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#25935}
2014-12-23 12:50:51 +00:00
Benedikt Meurer
1ec1f5957f [turbofan] Cleanup use of virtual, OVERRIDE, FINAL.
Following the Google/Chromium coding style wrt. virtual, OVERRIDE and
FINAL specifications.

TEST=unittests
R=jochen@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#25924}
2014-12-22 13:48:10 +00:00
titzer@chromium.org
5c25fdb65e Inline trivial OperatorProperties methods.
R=mstarzinger@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#24995}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24995 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-29 18:47:14 +00:00
titzer@chromium.org
6c6a71b3f7 Move input/output counts directly into Operators, simplying OperatorProperties.
This is a first step to refactoring OperatorProperties out of existence.
The next step is to inline OperatorProperties::GetXXXCount into the callers.

R=rossberg@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#24983}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24983 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-29 14:41:18 +00:00
bmeurer@chromium.org
de088f207c [turbofan] Introduce new Select operator to improve bounds checking.
TEST=mjsunit,unittests
R=dcarney@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#24980}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24980 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-29 14:17:14 +00:00
bmeurer@chromium.org
6619a7975d [turbofan] Add support for deferred code.
Branch can now have an optional hint, when the condition is
likely true or false, and if such a hint is present the other
basic block will be marked as deferred and placed at the end
of the function.

We currently use this feature for tagging int32/uint32 in
change lowering, and for load/store bounds checks in simplified
lowering.

TEST=cctest,unittests
R=dcarney@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24802 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-22 11:24:55 +00:00
bmeurer@chromium.org
8617b3acf8 [turbofan] Fix HashCode/Equals for floating point operators.
Those floating point constant operators require bitwise handling of
their parameters, otherwise 0.0 equals -0.0. This is solved in a
general way by adding new base::bit_equal_to and base::bit_hash
function objects.

TEST=unittests
R=svenpanne@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24450 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-08 07:32:07 +00:00
bmeurer@chromium.org
b9afcdcefb [turbofan] Add control input to Load and LoadElements.
Also remove the now obsolete ControlEffect operator.

TEST=cctest,mjsunit,unittests
R=mstarzinger@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24359 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-01 11:08:37 +00:00
bmeurer@chromium.org
bfd37ab267 Move unit tests to test/unittests.
As per discussion on the V8 team, this is the place we want them to live,
not following the Chrome Style Guide for this.

BUG=v8:3489
LOG=y
R=svenpanne@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24350 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-01 08:34:25 +00:00