Skip to content

Commit 37e24b1

Browse files
targosBethGriggs
authored andcommittedSep 19, 2019
deps: V8: backport d520ebb
Original commit message: [turbofan] Fix NumberFloor typing. Bug: chromium:841117 Change-Id: I1e83dfc82f87d0b49d3cca96290ae1d738e37d20 Reviewed-on: https://chromium-review.googlesource.com/1051228 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#53083} Refs: v8/v8@d520ebb Fixes: #22810 PR-URL: #27358 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
1 parent a7e5fe1 commit 37e24b1

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed
 

‎deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 414
14-
#define V8_PATCH_LEVEL 77
14+
#define V8_PATCH_LEVEL 78
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

‎deps/v8/src/compiler/typed-optimization.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,13 @@ Reduction TypedOptimization::ReduceNumberFloor(Node* node) {
244244
//
245245
// NumberToUint32(NumberDivide(lhs, rhs))
246246
//
247-
// and just smash the type of the {lhs} on the {node},
248-
// as the truncated result must be in the same range as
249-
// {lhs} since {rhs} cannot be less than 1 (due to the
247+
// and just smash the type [0...lhs.Max] on the {node},
248+
// as the truncated result must be loewr than {lhs}'s maximum
249+
// value (note that {rhs} cannot be less than 1 due to the
250250
// plain-number type constraint on the {node}).
251251
NodeProperties::ChangeOp(node, simplified()->NumberToUint32());
252-
NodeProperties::SetType(node, lhs_type);
252+
NodeProperties::SetType(node,
253+
Type::Range(0, lhs_type->Max(), graph()->zone()));
253254
return Changed(node);
254255
}
255256
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2018 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+
var v = 1e9;
8+
function f() { return Math.floor(v / 10); }
9+
assertEquals(1e8, f());
10+
%OptimizeFunctionOnNextCall(f);
11+
assertEquals(1e8, f());

0 commit comments

Comments
 (0)
Please sign in to comment.