Commit 55c88e58 authored by jochen's avatar jochen Committed by Commit bot

Disable API call inline in TF when gather runtime stats

BUG=none
R=epertoso@chromium.org,mvstanton@chromium.org,cbruni@chromium.org

Review-Url: https://codereview.chromium.org/2588363002
Cr-Commit-Position: refs/heads/master@{#41854}
parent fb430215
......@@ -262,6 +262,7 @@ MaybeHandle<Map> InferReceiverMap(Node* node) {
bool CanInlineApiCall(Isolate* isolate, Node* node,
Handle<FunctionTemplateInfo> function_template_info) {
DCHECK(node->opcode() == IrOpcode::kJSCallFunction);
if (V8_UNLIKELY(FLAG_runtime_stats)) return false;
if (function_template_info->call_code()->IsUndefined(isolate)) {
return false;
}
......
......@@ -1011,14 +1011,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
context, target, frame_state);
// Introduce the call to the getter function.
if (access_info.constant()->IsJSFunction()) {
value = effect = graph()->NewNode(
javascript()->CallFunction(
2, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), value);
} else {
if (CanInlineApiCall(access_info)) {
DCHECK(access_info.constant()->IsFunctionTemplateInfo());
Handle<FunctionTemplateInfo> function_template_info(
Handle<FunctionTemplateInfo>::cast(access_info.constant()));
......@@ -1029,6 +1022,13 @@ JSNativeContextSpecialization::BuildPropertyAccess(
value = value_effect_control.value();
effect = value_effect_control.effect();
control = value_effect_control.control();
} else {
value = effect = graph()->NewNode(
javascript()->CallFunction(
2, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), value);
}
break;
}
......@@ -1047,14 +1047,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
context, target, frame_state);
// Introduce the call to the setter function.
if (access_info.constant()->IsJSFunction()) {
effect = graph()->NewNode(
javascript()->CallFunction(
3, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, value, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), effect);
} else {
if (CanInlineApiCall(access_info)) {
DCHECK(access_info.constant()->IsFunctionTemplateInfo());
Handle<FunctionTemplateInfo> function_template_info(
Handle<FunctionTemplateInfo>::cast(access_info.constant()));
......@@ -1065,6 +1058,13 @@ JSNativeContextSpecialization::BuildPropertyAccess(
value = value_effect_control.value();
effect = value_effect_control.effect();
control = value_effect_control.control();
} else {
effect = graph()->NewNode(
javascript()->CallFunction(
3, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, value, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), effect);
}
break;
}
......@@ -1558,6 +1558,13 @@ JSNativeContextSpecialization::BuildElementAccess(
return ValueEffectControl(value, effect, control);
}
bool JSNativeContextSpecialization::CanInlineApiCall(
PropertyAccessInfo const& access_info) {
if (V8_UNLIKELY(FLAG_runtime_stats)) return false;
return access_info.IsAccessorConstant() &&
access_info.constant()->IsFunctionTemplateInfo();
}
JSNativeContextSpecialization::ValueEffectControl
JSNativeContextSpecialization::InlineApiCall(
Node* receiver, Node* context, Node* target, Node* frame_state, Node* value,
......
......@@ -148,6 +148,7 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
// program location.
MaybeHandle<Map> InferReceiverRootMap(Node* receiver);
bool CanInlineApiCall(PropertyAccessInfo const& access_info);
ValueEffectControl InlineApiCall(
Node* receiver, Node* context, Node* target, Node* frame_state,
Node* parameter, Node* effect, Node* control,
......
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