Commit 06770cef authored by tzik's avatar tzik Committed by Commit Bot

Mark a non-primary path of ExtractHandlerContext as deferred

The performance regression comes from the extra time of
ExtractHandlerContext called by TriggerPromiseReaction,
On the previous code, it takes the current Context from Isolate,
and on the typical case of the new code, the Context is taken from
the promise reaction function, that adds a few memory read ops and
a few conditional branches.

This CL adds Label::kDeferred to non-typical cases of
ExtractHandlerContext, so that newly added instructions have smaller
impact under the speculative execution.
On a local benchmark, this fixes half of the regression.

Bug: chromium:936717
Change-Id: I34ce858f77d7d604dd596711a239160ed8dac383
Reviewed-on: https://chromium-review.googlesource.com/c/1496774
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59964}
parent 7eaaab29
...@@ -117,22 +117,23 @@ PromiseBuiltinsAssembler::CreatePromiseResolvingFunctions( ...@@ -117,22 +117,23 @@ PromiseBuiltinsAssembler::CreatePromiseResolvingFunctions(
void PromiseBuiltinsAssembler::ExtractHandlerContext(Node* handler, void PromiseBuiltinsAssembler::ExtractHandlerContext(Node* handler,
Variable* var_context) { Variable* var_context) {
VARIABLE(var_handler, MachineRepresentation::kTagged, handler); VARIABLE(var_handler, MachineRepresentation::kTagged, handler);
Label loop(this, &var_handler), done(this); Label loop(this, &var_handler), done(this, Label::kDeferred);
Goto(&loop); Goto(&loop);
BIND(&loop); BIND(&loop);
{ {
Label if_bound_function(this), if_proxy(this), if_function(this); Label if_function(this), if_bound_function(this, Label::kDeferred),
if_proxy(this, Label::kDeferred);
GotoIf(TaggedIsSmi(var_handler.value()), &done); GotoIf(TaggedIsSmi(var_handler.value()), &done);
int32_t case_values[] = { int32_t case_values[] = {
JS_FUNCTION_TYPE,
JS_BOUND_FUNCTION_TYPE, JS_BOUND_FUNCTION_TYPE,
JS_PROXY_TYPE, JS_PROXY_TYPE,
JS_FUNCTION_TYPE,
}; };
Label* case_labels[] = { Label* case_labels[] = {
&if_function,
&if_bound_function, &if_bound_function,
&if_proxy, &if_proxy,
&if_function,
}; };
static_assert(arraysize(case_values) == arraysize(case_labels), ""); static_assert(arraysize(case_values) == arraysize(case_labels), "");
TNode<Map> handler_map = LoadMap(var_handler.value()); TNode<Map> handler_map = LoadMap(var_handler.value());
......
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