This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[crankshaft] Fix invalid ToNumber optimization.
We cannot optimize away ToNumber conversions based on the Type that we see in Crankshaft, as this might be the (unchecked or even pretruncated) lower bound. We can only use the HType, which is based on the definition. R=jkummerow@chromium.org BUG=chromium:590989 LOG=n Review URL: https://codereview.chromium.org/1757013002 Cr-Commit-Position: refs/heads/master@{#34445}
- Loading branch information
Showing
4 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2016 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Flags: --allow-natives-syntax | ||
|
||
var o = {} | ||
var p = {foo: 1.5} | ||
|
||
function g(x) { return x.foo === +x.foo; } | ||
|
||
assertEquals(false, g(o)); | ||
assertEquals(false, g(o)); | ||
%OptimizeFunctionOnNextCall(g); | ||
assertEquals(false, g(o)); // Still fine here. | ||
assertEquals(true, g(p)); | ||
%OptimizeFunctionOnNextCall(g); | ||
assertEquals(false, g(o)); // Confused by type feedback. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2016 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Flags: --allow-natives-syntax | ||
|
||
function f(x) { return x === +x; } | ||
|
||
assertEquals(false, f(undefined)); | ||
assertEquals(false, f(undefined)); | ||
%OptimizeFunctionOnNextCall(f); | ||
assertEquals(false, f(undefined)); // Interestingly this fails right away. |