Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

Commit 1f5c84c

Browse files
MylesBorinsgibfahn
authored andcommitted
deps/v8z: 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: nodejs/node#7348 Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 55bb636 commit 1f5c84c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,6 @@ namespace {
12851285
String* TypeOfString(HConstant* constant, Isolate* isolate) {
12861286
Heap* heap = isolate->heap();
12871287
if (constant->HasNumberValue()) return heap->number_string();
1288-
if (constant->IsUndetectable()) return heap->undefined_string();
12891288
if (constant->HasStringValue()) return heap->string_string();
12901289
switch (constant->GetInstanceType()) {
12911290
case ODDBALL_TYPE: {
@@ -1314,6 +1313,7 @@ String* TypeOfString(HConstant* constant, Isolate* isolate) {
13141313
return nullptr;
13151314
}
13161315
default:
1316+
if (constant->IsUndetectable()) return heap->undefined_string();
13171317
if (constant->IsCallable()) return heap->function_string();
13181318
return heap->object_string();
13191319
}
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)