[turbofan] Fix context size in promise constructor

The promise constructor fast-path did allocate contexts that were
too large, resulting in GC overhead compared to the slow-path which
contributes to a performance regression we are currently dealing with.

Bug: chromium:829253
Change-Id: I82883358933df9ce5241bad53b85867455046cc1
Reviewed-on: https://chromium-review.googlesource.com/1007054
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52550}
This commit is contained in:
Sigurd Schneider 2018-04-11 14:29:23 +02:00 committed by Commit Bot
parent 845aa75f6a
commit 638c950743

View File

@ -5442,9 +5442,11 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
// 8. CreatePromiseResolvingFunctions // 8. CreatePromiseResolvingFunctions
// Allocate a promise context for the closures below. // Allocate a promise context for the closures below.
Node* promise_context = effect = graph()->NewNode( Node* promise_context = effect =
javascript()->CreateFunctionContext( graph()->NewNode(javascript()->CreateFunctionContext(
PromiseBuiltinsAssembler::kPromiseContextLength, FUNCTION_SCOPE), PromiseBuiltinsAssembler::kPromiseContextLength -
Context::MIN_CONTEXT_SLOTS,
FUNCTION_SCOPE),
context, context, effect, control); context, context, effect, control);
effect = effect =
graph()->NewNode(simplified()->StoreField(AccessBuilder::ForContextSlot( graph()->NewNode(simplified()->StoreField(AccessBuilder::ForContextSlot(
@ -5749,7 +5751,8 @@ Reduction JSCallReducer::ReducePromisePrototypeFinally(Node* node) {
// Allocate shared context for the closures below. // Allocate shared context for the closures below.
context = etrue = graph()->NewNode( context = etrue = graph()->NewNode(
javascript()->CreateFunctionContext( javascript()->CreateFunctionContext(
PromiseBuiltinsAssembler::kPromiseFinallyContextLength, PromiseBuiltinsAssembler::kPromiseFinallyContextLength -
Context::MIN_CONTEXT_SLOTS,
FUNCTION_SCOPE), FUNCTION_SCOPE),
context, context, etrue, if_true); context, context, etrue, if_true);
etrue = etrue =