Browse Source

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: https://github.com/nodejs/node/pull/7348
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
v6.x
Myles Borins 9 years ago
committed by Myles Borins
parent
commit
c544213717
  1. 2
      deps/v8/src/crankshaft/hydrogen-instructions.cc
  2. 12
      deps/v8/test/mjsunit/regress/regress-opt-typeof-null.js

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

@ -1283,7 +1283,6 @@ namespace {
String* TypeOfString(HConstant* constant, Isolate* isolate) {
Heap* heap = isolate->heap();
if (constant->HasNumberValue()) return heap->number_string();
if (constant->IsUndetectable()) return heap->undefined_string();
if (constant->HasStringValue()) return heap->string_string();
switch (constant->GetInstanceType()) {
case ODDBALL_TYPE: {
@ -1312,6 +1311,7 @@ String* TypeOfString(HConstant* constant, Isolate* isolate) {
return nullptr;
}
default:
if (constant->IsUndetectable()) return heap->undefined_string();
if (constant->IsCallable()) return heap->function_string();
return heap->object_string();
}

12
deps/v8/test/mjsunit/regress/regress-opt-typeof-null.js

@ -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() {
return typeof null === "object";
};
%OptimizeFunctionOnNextCall(f);
assertTrue(f());
Loading…
Cancel
Save