Commit 5621814e authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[CSA] Fix the typed verison of Select to strictly check types.

Previously, typing errors would be hidden by the SloppyTNode cast. Both
lambdas should always return strictly checked types that match the
templated type of the select, otherwise unchecked values can reach
TNodes.

Bug: v8:7479
Change-Id: Icd316c21a30c8c8305b7740c985efaa54c9a7015
Reviewed-on: https://chromium-review.googlesource.com/934455Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51515}
parent 53e00e39
......@@ -356,15 +356,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
template <class A, class F, class G>
TNode<A> Select(SloppyTNode<BoolT> condition, const F& true_body,
const G& false_body, MachineRepresentation rep) {
return UncheckedCast<A>(
Select(condition,
[&]() -> Node* {
return base::implicit_cast<SloppyTNode<A>>(true_body());
},
[&]() -> Node* {
return base::implicit_cast<SloppyTNode<A>>(false_body());
},
rep));
return UncheckedCast<A>(Select(
condition,
[&]() -> Node* { return base::implicit_cast<TNode<A>>(true_body()); },
[&]() -> Node* { return base::implicit_cast<TNode<A>>(false_body()); },
rep));
}
Node* SelectConstant(Node* condition, Node* true_value, Node* false_value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment