Skip to content

Commit e8595c5

Browse files
bnoordhuisevanlucas
authored andcommitted
deps: cherry-pick 79aee39 from upstream v8
This is a chery-pick if you consider reducing the context to -C2 a cherry-pick; WordIsSmi has been renamed to TaggedIsSmi upstream. Original commit message: [builtins] Fix pointer comparison in ToString builtin. This fixes the bogus {Word32Equal} comparison in the ToString builtin implementing Object.prototype.toString to be a pointer-size {WordEqual} comparison instead. Comparing just the lower half-word is insufficient on 64-bit architectures. [email protected] TEST=mjsunit/regress/regress-crbug-664506 BUG=chromium:664506 Review-Url: https://codereview.chromium.org/2496043003 Cr-Commit-Position: refs/heads/master@{#40963} Fixes: #12411 PR-URL: #12412 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 675ece4 commit e8595c5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

deps/v8/src/builtins/builtins-object.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ void Builtins::Generate_ObjectProtoToString(CodeStubAssembler* assembler) {
300300
Node* context = assembler->Parameter(3);
301301

302302
assembler->GotoIf(
303-
assembler->Word32Equal(receiver, assembler->UndefinedConstant()),
303+
assembler->WordEqual(receiver, assembler->UndefinedConstant()),
304304
&return_undefined);
305305

306-
assembler->GotoIf(assembler->Word32Equal(receiver, assembler->NullConstant()),
306+
assembler->GotoIf(assembler->WordEqual(receiver, assembler->NullConstant()),
307307
&return_null);
308308

309309
assembler->GotoIf(assembler->WordIsSmi(receiver), &return_number);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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: --expose-gc --predictable --random-seed=-1109634722
6+
7+
gc();
8+
gc();
9+
assertEquals("[object Object]", Object.prototype.toString.call({}));
10+
gc();
11+
assertEquals("[object Array]", Object.prototype.toString.call([]));

0 commit comments

Comments
 (0)