From 5c7797009450e8a154689f0edde2e43b924ebb08 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 11 Dec 2018 10:08:29 -0500 Subject: [PATCH] [esnext] use variadic arguments for Object.fromEntries This makes the deoptimizer happy, and is more consistent with other Torque JS functions. BUG=chromium:912504, v8:8021 R=tebbi@chromium.org, danno@chromium.org, mvstanton@chromium.org, gsathya@chromium.org Change-Id: I4c86db9549c367dfab7f76b49a0cf3c69d3ec50b Reviewed-on: https://chromium-review.googlesource.com/c/1366397 Commit-Queue: Caitlin Potter Reviewed-by: Tobias Tebbi Reviewed-by: Sathya Gunasekaran Reviewed-by: Michael Stanton Reviewed-by: Daniel Clifford Cr-Commit-Position: refs/heads/master@{#58161} --- src/builtins/object-fromentries.tq | 5 +++-- test/mjsunit/harmony/regress/regress-912504.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 test/mjsunit/harmony/regress/regress-912504.js diff --git a/src/builtins/object-fromentries.tq b/src/builtins/object-fromentries.tq index 93f487147d..a04b034085 100644 --- a/src/builtins/object-fromentries.tq +++ b/src/builtins/object-fromentries.tq @@ -33,8 +33,9 @@ namespace object { } transitioning javascript builtin - ObjectFromEntries(implicit context: Context)(receiver: Object): Object { - const iterable: Object = receiver; + ObjectFromEntries(implicit context: Context)(receiver: Object, ...arguments): + Object { + const iterable: Object = arguments[0]; try { if (IsNullOrUndefined(iterable)) goto Throw; return ObjectFromEntriesFastCase(iterable) otherwise IfSlow; diff --git a/test/mjsunit/harmony/regress/regress-912504.js b/test/mjsunit/harmony/regress/regress-912504.js new file mode 100644 index 0000000000..78b1992b14 --- /dev/null +++ b/test/mjsunit/harmony/regress/regress-912504.js @@ -0,0 +1,11 @@ +// Copyright 2018 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: --always-opt --harmony-object-from-entries --allow-natives-syntax + +function test() { + Object.fromEntries([[]]); + %DeoptimizeNow(); +} +test();