Permalink
Browse files

[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 <caitp@igalia.com>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58161}
  • Loading branch information...
caitp authored and Commit Bot committed Dec 11, 2018
1 parent dc6eed6 commit 5c7797009450e8a154689f0edde2e43b924ebb08
Showing with 14 additions and 2 deletions.
  1. +3 −2 src/builtins/object-fromentries.tq
  2. +11 −0 test/mjsunit/harmony/regress/regress-912504.js
@@ -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;
@@ -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();

0 comments on commit 5c77970

Please sign in to comment.