From 2df4ba026327d864f93a36327916ed0682b8998a Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 18 Jun 2018 17:30:44 +0200 Subject: [PATCH] Convert empty_fixed_double_array to empty_fixed_array in call/construct Bug: chromium:850005, chromium:852085, Change-Id: I777321306b1b68330e39e43aacc715478764649f Reviewed-on: https://chromium-review.googlesource.com/1104470 Commit-Queue: Camillo Bruni Reviewed-by: Georg Neis Cr-Commit-Position: refs/heads/master@{#54007} --- src/builtins/builtins-call-gen.cc | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/builtins/builtins-call-gen.cc b/src/builtins/builtins-call-gen.cc index 6730434218..35aaee5ec2 100644 --- a/src/builtins/builtins-call-gen.cc +++ b/src/builtins/builtins-call-gen.cc @@ -191,19 +191,32 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike( Label if_not_double(this), if_double(this); TNode args_count = Int32Constant(0); // args already on the stack - TNode elements = var_elements.value(); TNode length = var_length.value(); - GotoIf(Word32Equal(length, Int32Constant(0)), &if_not_double); + { + Label normalize_done(this); + GotoIfNot(Word32Equal(length, Int32Constant(0)), &normalize_done); + // Make sure we don't accidentally pass along the + // empty_fixed_double_array since the tailed-called stubs cannot handle + // the normalization yet. + var_elements = EmptyFixedArrayConstant(); + Goto(&normalize_done); + + BIND(&normalize_done); + } + + TNode elements = var_elements.value(); Branch(IsFixedDoubleArray(elements), &if_double, &if_not_double); BIND(&if_not_double); - if (new_target == nullptr) { - Callable callable = CodeFactory::CallVarargs(isolate()); - TailCallStub(callable, context, target, args_count, elements, length); - } else { - Callable callable = CodeFactory::ConstructVarargs(isolate()); - TailCallStub(callable, context, target, new_target, args_count, elements, - length); + { + if (new_target == nullptr) { + Callable callable = CodeFactory::CallVarargs(isolate()); + TailCallStub(callable, context, target, args_count, elements, length); + } else { + Callable callable = CodeFactory::ConstructVarargs(isolate()); + TailCallStub(callable, context, target, new_target, args_count, + elements, length); + } } BIND(&if_double);