| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 31154a5 commit 5372f1f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | # Reset this number to 0 on major V8 upgrades. | |
| 38 | 38 | # Increment by one for each non-official patch applied to deps/v8. | |
| 39 | - 'v8_embedder_string': '-node.30', | ||
| 39 | + 'v8_embedder_string': '-node.31', | ||
| 40 | 40 | ||
| 41 | 41 | ##### V8 defaults for Node.js ##### | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -178,10 +178,16 @@ void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) { | |||
| 178 | 178 | } | |
| 179 | 179 | ||
| 180 | 180 | bool CanOverflowSigned32(const Operator* op, Type left, Type right, | |
| 181 | - Zone* type_zone) { | ||
| 182 | - // We assume the inputs are checked Signed32 (or known statically | ||
| 183 | - // to be Signed32). Technically, the inputs could also be minus zero, but | ||
| 184 | - // that cannot cause overflow. | ||
| 181 | + TypeCache const* type_cache, Zone* type_zone) { | ||
| 182 | + // We assume the inputs are checked Signed32 (or known statically to be | ||
| 183 | + // Signed32). Technically, the inputs could also be minus zero, which we treat | ||
| 184 | + // as 0 for the purpose of this function. | ||
| 185 | + if (left.Maybe(Type::MinusZero())) { | ||
| 186 | + left = Type::Union(left, type_cache->kSingletonZero, type_zone); | ||
| 187 | + } | ||
| 188 | + if (right.Maybe(Type::MinusZero())) { | ||
| 189 | + right = Type::Union(right, type_cache->kSingletonZero, type_zone); | ||
| 190 | + } | ||
| 185 | 191 | left = Type::Intersect(left, Type::Signed32(), type_zone); | |
| 186 | 192 | right = Type::Intersect(right, Type::Signed32(), type_zone); | |
| 187 | 193 | if (left.IsNone() || right.IsNone()) return false; | |
@@ -1457,7 +1463,8 @@ class RepresentationSelector { | |||
| 1457 | 1463 | if (lower<T>()) { | |
| 1458 | 1464 | if (truncation.IsUsedAsWord32() || | |
| 1459 | 1465 | !CanOverflowSigned32(node->op(), left_feedback_type, | |
| 1460 | - right_feedback_type, graph_zone())) { | ||
| 1466 | + right_feedback_type, type_cache_, | ||
| 1467 | + graph_zone())) { | ||
| 1461 | 1468 | ChangeToPureOp(node, Int32Op(node)); | |
| 1462 | 1469 | ||
| 1463 | 1470 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,22 @@ | |||
| 1 | + // Copyright 2020 the V8 project authors. All rights reserved. | ||
| 2 | + // Use of this source code is governed by a BSD-style license that can be | ||
| 3 | + // found in the LICENSE file. | ||
| 4 | + | ||
| 5 | + // Flags: --allow-natives-syntax | ||
| 6 | + | ||
| 7 | + function foo(b) { | ||
| 8 | + var x = -0; | ||
| 9 | + var y = -0x80000000; | ||
| 10 | + | ||
| 11 | + if (b) { | ||
| 12 | + x = -1; | ||
| 13 | + y = 1; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + return (x - y) == -0x80000000; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + %PrepareFunctionForOptimization(foo); | ||
| 20 | + assertFalse(foo(true)); | ||
| 21 | + %OptimizeFunctionOnNextCall(foo); | ||
| 22 | + assertFalse(foo(false)); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments