Skip to content

Commit c544213

Browse files
MylesBorinsMyles Borins
authored and
Myles Borins
committed
deps: backport 7dfb5beeec from V8 upstream
This commit backports a fix to a JIT bug in V8. After 100 or so comparisons `typeof null ==="undefined"` is returning `true` instead of `false`. Original commit message: Fix 'typeof null' canonicalization in crankshaft BUG= Review URL: https://codereview.chromium.org/1912553002 Cr-Commit-Position: refs/heads/master@{#35699} Ref: https://bugs.chromium.org/p/chromium/issues/detail?id=604033 PR-URL: #7348 Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 1e7a7be commit c544213

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

deps/v8/src/crankshaft/hydrogen-instructions.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ namespace {
12831283
String* TypeOfString(HConstant* constant, Isolate* isolate) {
12841284
Heap* heap = isolate->heap();
12851285
if (constant->HasNumberValue()) return heap->number_string();
1286-
if (constant->IsUndetectable()) return heap->undefined_string();
12871286
if (constant->HasStringValue()) return heap->string_string();
12881287
switch (constant->GetInstanceType()) {
12891288
case ODDBALL_TYPE: {
@@ -1312,6 +1311,7 @@ String* TypeOfString(HConstant* constant, Isolate* isolate) {
13121311
return nullptr;
13131312
}
13141313
default:
1314+
if (constant->IsUndetectable()) return heap->undefined_string();
13151315
if (constant->IsCallable()) return heap->function_string();
13161316
return heap->object_string();
13171317
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2016 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 f() {
8+
return typeof null === "object";
9+
};
10+
11+
%OptimizeFunctionOnNextCall(f);
12+
assertTrue(f());

0 commit comments

Comments
 (0)