Unreviewed changes
6 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/maglev/maglev-truncation.h
Insertions: 17, Deletions: 9.
@@ -96,7 +96,13 @@
return ProcessResult::kContinue;
}
- ProcessResult Process(Identity* node) { return ProcessResult::kContinue; }
+ ProcessResult Process(Identity* node) {
+ return ProcessSingleInputSpecialNode(node);
+ }
+ ProcessResult Process(ReturnedValue* node) {
+ return ProcessSingleInputSpecialNode(node);
+ }
+
ProcessResult Process(Dead* node) { return ProcessResult::kContinue; }
// TODO(victorgomes): We can only truncate CheckedHoleyFloat64ToInt32
@@ -129,14 +135,6 @@
if constexpr (IsFixedInputNode<NodeT>()) {
return UnsetCanTruncateToInt32ForFixedInputNodes<NodeT, 0>(node);
}
- if constexpr (std::is_same_v<NodeT, ReturnedValue> ||
- std::is_same_v<NodeT, Identity>) {
- ValueNode* input_node = node->input_node(0);
- if (input_node->value_representation() != ValueRepresentation::kTagged) {
- input_node->set_can_truncate_to_int32(false);
- }
- return;
- }
#ifdef DEBUG
for (Input input : node->inputs()) {
DCHECK(!input.node()->can_truncate_to_int32());
@@ -144,6 +142,16 @@
#endif // DEBUG
}
+ ProcessResult ProcessSingleInputSpecialNode(ValueNode* node) {
+ if (!node->can_truncate_to_int32()) {
+ ValueNode* input_node = node->input_node(0);
+ if (input_node->value_representation() != ValueRepresentation::kTagged) {
+ input_node->set_can_truncate_to_int32(false);
+ }
+ }
+ return ProcessResult::kContinue;
+ }
+
void UnsetCanTruncateToInt32ForDeoptFrameInput(ValueNode* node) {
// TODO(victorgomes): Technically if node is in the int32 range, this use
// would still allow truncation.
```
Change information
Commit message:
[maglev] Fix a bug in (a+b)|0 omitting overflow checks
If a function returns the result of (a+b)|0, we cannot omit the overflow
check.
This gotcha here is that UnsetCanTruncateToInt32Inputs only worked for
FixedInputNodes, and ReturnedValue is not a FixedInputNode.
Fixed: 454314508
Change-Id: Id3a5ae99332031bc864bd9928f96102f44f10802
Cr-Commit-Position: refs/heads/main@{#103360}
Files:
- M src/maglev/maglev-truncation.h
- A test/mjsunit/turbolev/regress-454314508.js
Change size: M
Delta: 2 files changed, 61 insertions(+), 8 deletions(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Leszek Swirski