Commit ad7537ae authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[TurboFan] Use regular arrays instead of vector for checkpoint params

We don't need dynamic allocation for these arrays.

Change-Id: I12095ec0e3b6e9d70be56adfb77aded5c25eb3d5
Reviewed-on: https://chromium-review.googlesource.com/c/908462
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59824}
parent 993e4520
...@@ -1089,9 +1089,9 @@ Reduction JSCallReducer::ReduceArrayForEach( ...@@ -1089,9 +1089,9 @@ Reduction JSCallReducer::ReduceArrayForEach(
simplified()->LoadField(AccessBuilder::ForJSArrayLength(kind)), receiver, simplified()->LoadField(AccessBuilder::ForJSArrayLength(kind)), receiver,
effect, control); effect, control);
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
// Check whether the given callback function is callable. Note that this has // Check whether the given callback function is callable. Note that this has
// to happen outside the loop to make sure we also throw on empty arrays. // to happen outside the loop to make sure we also throw on empty arrays.
...@@ -1287,13 +1287,12 @@ Reduction JSCallReducer::ReduceArrayReduce( ...@@ -1287,13 +1287,12 @@ Reduction JSCallReducer::ReduceArrayReduce(
Builtins::Name builtin_lazy = Builtins::Name builtin_lazy =
left ? Builtins::kArrayReduceLoopLazyDeoptContinuation left ? Builtins::kArrayReduceLoopLazyDeoptContinuation
: Builtins::kArrayReduceRightLoopLazyDeoptContinuation; : Builtins::kArrayReduceRightLoopLazyDeoptContinuation;
const std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, k, original_length,
{receiver, fncallback, k, original_length, jsgraph()->UndefinedConstant()};
jsgraph()->UndefinedConstant()}); const int stack_parameters = arraysize(checkpoint_params);
const int stack_parameters = static_cast<int>(checkpoint_params.size());
check_frame_state = CreateJavaScriptBuiltinContinuationFrameState( check_frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, builtin_lazy, node->InputAt(0), context, jsgraph(), shared, builtin_lazy, node->InputAt(0), context,
checkpoint_params.data(), stack_parameters - 1, outer_frame_state, &checkpoint_params[0], stack_parameters - 1, outer_frame_state,
ContinuationFrameStateMode::LAZY); ContinuationFrameStateMode::LAZY);
} }
Node* check_fail = nullptr; Node* check_fail = nullptr;
...@@ -1315,13 +1314,12 @@ Reduction JSCallReducer::ReduceArrayReduce( ...@@ -1315,13 +1314,12 @@ Reduction JSCallReducer::ReduceArrayReduce(
Builtins::Name builtin_eager = Builtins::Name builtin_eager =
left ? Builtins::kArrayReducePreLoopEagerDeoptContinuation left ? Builtins::kArrayReducePreLoopEagerDeoptContinuation
: Builtins::kArrayReduceRightPreLoopEagerDeoptContinuation; : Builtins::kArrayReduceRightPreLoopEagerDeoptContinuation;
const std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, original_length};
{receiver, fncallback, original_length}); const int stack_parameters = arraysize(checkpoint_params);
const int stack_parameters = static_cast<int>(checkpoint_params.size());
Node* find_first_element_frame_state = Node* find_first_element_frame_state =
CreateJavaScriptBuiltinContinuationFrameState( CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, builtin_eager, node->InputAt(0), context, jsgraph(), shared, builtin_eager, node->InputAt(0), context,
checkpoint_params.data(), stack_parameters, outer_frame_state, &checkpoint_params[0], stack_parameters, outer_frame_state,
ContinuationFrameStateMode::EAGER); ContinuationFrameStateMode::EAGER);
Node* vloop = k = WireInLoopStart(k, &control, &effect); Node* vloop = k = WireInLoopStart(k, &control, &effect);
...@@ -1385,12 +1383,12 @@ Reduction JSCallReducer::ReduceArrayReduce( ...@@ -1385,12 +1383,12 @@ Reduction JSCallReducer::ReduceArrayReduce(
Builtins::Name builtin_eager = Builtins::Name builtin_eager =
left ? Builtins::kArrayReduceLoopEagerDeoptContinuation left ? Builtins::kArrayReduceLoopEagerDeoptContinuation
: Builtins::kArrayReduceRightLoopEagerDeoptContinuation; : Builtins::kArrayReduceRightLoopEagerDeoptContinuation;
const std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, k, original_length,
{receiver, fncallback, k, original_length, curloop}); curloop};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, builtin_eager, node->InputAt(0), context, jsgraph(), shared, builtin_eager, node->InputAt(0), context,
checkpoint_params.data(), stack_parameters, outer_frame_state, &checkpoint_params[0], stack_parameters, outer_frame_state,
ContinuationFrameStateMode::EAGER); ContinuationFrameStateMode::EAGER);
effect = effect =
graph()->NewNode(common()->Checkpoint(), frame_state, effect, control); graph()->NewNode(common()->Checkpoint(), frame_state, effect, control);
...@@ -1431,12 +1429,12 @@ Reduction JSCallReducer::ReduceArrayReduce( ...@@ -1431,12 +1429,12 @@ Reduction JSCallReducer::ReduceArrayReduce(
Builtins::Name builtin_lazy = Builtins::Name builtin_lazy =
left ? Builtins::kArrayReduceLoopLazyDeoptContinuation left ? Builtins::kArrayReduceLoopLazyDeoptContinuation
: Builtins::kArrayReduceRightLoopLazyDeoptContinuation; : Builtins::kArrayReduceRightLoopLazyDeoptContinuation;
const std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, next_k, original_length,
{receiver, fncallback, next_k, original_length, curloop}); curloop};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, builtin_lazy, node->InputAt(0), context, jsgraph(), shared, builtin_lazy, node->InputAt(0), context,
checkpoint_params.data(), stack_parameters - 1, outer_frame_state, &checkpoint_params[0], stack_parameters - 1, outer_frame_state,
ContinuationFrameStateMode::LAZY); ContinuationFrameStateMode::LAZY);
next_cur = control = effect = next_cur = control = effect =
...@@ -1557,9 +1555,9 @@ Reduction JSCallReducer::ReduceArrayMap(Node* node, ...@@ -1557,9 +1555,9 @@ Reduction JSCallReducer::ReduceArrayMap(Node* node,
array_constructor, array_constructor, original_length, context, array_constructor, array_constructor, original_length, context,
outer_frame_state, effect, control); outer_frame_state, effect, control);
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg,
{receiver, fncallback, this_arg, a, k, original_length}); a, k, original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
// Check whether the given callback function is callable. Note that this has // Check whether the given callback function is callable. Note that this has
// to happen outside the loop to make sure we also throw on empty arrays. // to happen outside the loop to make sure we also throw on empty arrays.
...@@ -1781,9 +1779,9 @@ Reduction JSCallReducer::ReduceArrayFilter( ...@@ -1781,9 +1779,9 @@ Reduction JSCallReducer::ReduceArrayFilter(
// checkpoint_params yet, but that's okay because it'll never be called. // checkpoint_params yet, but that's okay because it'll never be called.
// Therefore, "to" is mentioned twice, once standing in for the k_value // Therefore, "to" is mentioned twice, once standing in for the k_value
// value. // value.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, a,
{receiver, fncallback, this_arg, a, k, original_length, to, to}); k, original_length, to, to};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation,
...@@ -1809,9 +1807,9 @@ Reduction JSCallReducer::ReduceArrayFilter( ...@@ -1809,9 +1807,9 @@ Reduction JSCallReducer::ReduceArrayFilter(
control = if_true; control = if_true;
{ {
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, a,
{receiver, fncallback, this_arg, a, k, original_length, to}); k, original_length, to};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayFilterLoopEagerDeoptContinuation, jsgraph(), shared, Builtins::kArrayFilterLoopEagerDeoptContinuation,
...@@ -1866,9 +1864,9 @@ Reduction JSCallReducer::ReduceArrayFilter( ...@@ -1866,9 +1864,9 @@ Reduction JSCallReducer::ReduceArrayFilter(
{ {
// This frame state is dealt with by hand in // This frame state is dealt with by hand in
// Builtins::kArrayFilterLoopLazyDeoptContinuation. // Builtins::kArrayFilterLoopLazyDeoptContinuation.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, a,
{receiver, fncallback, this_arg, a, k, original_length, element, to}); k, original_length, element, to};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation,
...@@ -1895,10 +1893,10 @@ Reduction JSCallReducer::ReduceArrayFilter( ...@@ -1895,10 +1893,10 @@ Reduction JSCallReducer::ReduceArrayFilter(
// point in this case. This is safe, because re-evaluating a [ToBoolean] // point in this case. This is safe, because re-evaluating a [ToBoolean]
// coercion is safe. // coercion is safe.
{ {
std::vector<Node*> checkpoint_params({receiver, fncallback, this_arg, a, k, Node* checkpoint_params[] = {receiver, fncallback, this_arg,
original_length, element, to, a, k, original_length,
callback_value}); element, to, callback_value};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArrayFilterLoopLazyDeoptContinuation,
node->InputAt(0), context, &checkpoint_params[0], stack_parameters, node->InputAt(0), context, &checkpoint_params[0], stack_parameters,
...@@ -2016,9 +2014,9 @@ Reduction JSCallReducer::ReduceArrayFind(Node* node, ArrayFindVariant variant, ...@@ -2016,9 +2014,9 @@ Reduction JSCallReducer::ReduceArrayFind(Node* node, ArrayFindVariant variant,
simplified()->LoadField(AccessBuilder::ForJSArrayLength(kind)), receiver, simplified()->LoadField(AccessBuilder::ForJSArrayLength(kind)), receiver,
effect, control); effect, control);
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
// Check whether the given callback function is callable. Note that this has // Check whether the given callback function is callable. Note that this has
// to happen outside the loop to make sure we also throw on empty arrays. // to happen outside the loop to make sure we also throw on empty arrays.
...@@ -2091,11 +2089,10 @@ Reduction JSCallReducer::ReduceArrayFind(Node* node, ArrayFindVariant variant, ...@@ -2091,11 +2089,10 @@ Reduction JSCallReducer::ReduceArrayFind(Node* node, ArrayFindVariant variant,
// Call the callback. // Call the callback.
Node* callback_value = nullptr; Node* callback_value = nullptr;
{ {
std::vector<Node*> call_checkpoint_params({receiver, fncallback, this_arg, Node* call_checkpoint_params[] = {receiver, fncallback,
next_k, original_length, this_arg, next_k,
if_found_return_value}); original_length, if_found_return_value};
const int call_stack_parameters = const int call_stack_parameters = arraysize(call_checkpoint_params);
static_cast<int>(call_checkpoint_params.size());
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, after_callback_lazy_continuation_builtin, jsgraph(), shared, after_callback_lazy_continuation_builtin,
...@@ -2351,9 +2348,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node, ...@@ -2351,9 +2348,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node,
// This frame state doesn't ever call the deopt continuation, it's only // This frame state doesn't ever call the deopt continuation, it's only
// necessary to specifiy a continuation in order to handle the exceptional // necessary to specifiy a continuation in order to handle the exceptional
// case. // case.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayEveryLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArrayEveryLoopLazyDeoptContinuation,
...@@ -2377,9 +2374,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node, ...@@ -2377,9 +2374,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node,
control = if_true; control = if_true;
{ {
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayEveryLoopEagerDeoptContinuation, jsgraph(), shared, Builtins::kArrayEveryLoopEagerDeoptContinuation,
...@@ -2433,9 +2430,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node, ...@@ -2433,9 +2430,9 @@ Reduction JSCallReducer::ReduceArrayEvery(Node* node,
{ {
// This frame state is dealt with by hand in // This frame state is dealt with by hand in
// Builtins::kArrayEveryLoopLazyDeoptContinuation. // Builtins::kArrayEveryLoopLazyDeoptContinuation.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArrayEveryLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArrayEveryLoopLazyDeoptContinuation,
...@@ -2701,9 +2698,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node, ...@@ -2701,9 +2698,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node,
// This frame state doesn't ever call the deopt continuation, it's only // This frame state doesn't ever call the deopt continuation, it's only
// necessary to specifiy a continuation in order to handle the exceptional // necessary to specifiy a continuation in order to handle the exceptional
// case. // case.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* check_frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArraySomeLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArraySomeLoopLazyDeoptContinuation,
...@@ -2732,9 +2729,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node, ...@@ -2732,9 +2729,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node,
control = if_true; control = if_true;
{ {
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArraySomeLoopEagerDeoptContinuation, jsgraph(), shared, Builtins::kArraySomeLoopEagerDeoptContinuation,
...@@ -2788,9 +2785,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node, ...@@ -2788,9 +2785,9 @@ Reduction JSCallReducer::ReduceArraySome(Node* node,
{ {
// This frame state is dealt with by hand in // This frame state is dealt with by hand in
// Builtins::kArrayEveryLoopLazyDeoptContinuation. // Builtins::kArrayEveryLoopLazyDeoptContinuation.
std::vector<Node*> checkpoint_params( Node* checkpoint_params[] = {receiver, fncallback, this_arg, k,
{receiver, fncallback, this_arg, k, original_length}); original_length};
const int stack_parameters = static_cast<int>(checkpoint_params.size()); const int stack_parameters = arraysize(checkpoint_params);
Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState( Node* frame_state = CreateJavaScriptBuiltinContinuationFrameState(
jsgraph(), shared, Builtins::kArraySomeLoopLazyDeoptContinuation, jsgraph(), shared, Builtins::kArraySomeLoopLazyDeoptContinuation,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment