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) { ...@@ -262,6 +262,7 @@ MaybeHandle<Map> InferReceiverMap(Node* node) {
bool CanInlineApiCall(Isolate* isolate, Node* node, bool CanInlineApiCall(Isolate* isolate, Node* node,
Handle<FunctionTemplateInfo> function_template_info) { Handle<FunctionTemplateInfo> function_template_info) {
DCHECK(node->opcode() == IrOpcode::kJSCallFunction); DCHECK(node->opcode() == IrOpcode::kJSCallFunction);
if (V8_UNLIKELY(FLAG_runtime_stats)) return false;
if (function_template_info->call_code()->IsUndefined(isolate)) { if (function_template_info->call_code()->IsUndefined(isolate)) {
return false; return false;
} }
......
...@@ -1011,14 +1011,7 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1011,14 +1011,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
context, target, frame_state); context, target, frame_state);
// Introduce the call to the getter function. // Introduce the call to the getter function.
if (access_info.constant()->IsJSFunction()) { if (CanInlineApiCall(access_info)) {
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 {
DCHECK(access_info.constant()->IsFunctionTemplateInfo()); DCHECK(access_info.constant()->IsFunctionTemplateInfo());
Handle<FunctionTemplateInfo> function_template_info( Handle<FunctionTemplateInfo> function_template_info(
Handle<FunctionTemplateInfo>::cast(access_info.constant())); Handle<FunctionTemplateInfo>::cast(access_info.constant()));
...@@ -1029,6 +1022,13 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1029,6 +1022,13 @@ JSNativeContextSpecialization::BuildPropertyAccess(
value = value_effect_control.value(); value = value_effect_control.value();
effect = value_effect_control.effect(); effect = value_effect_control.effect();
control = value_effect_control.control(); 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; break;
} }
...@@ -1047,14 +1047,7 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1047,14 +1047,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
context, target, frame_state); context, target, frame_state);
// Introduce the call to the setter function. // Introduce the call to the setter function.
if (access_info.constant()->IsJSFunction()) { if (CanInlineApiCall(access_info)) {
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 {
DCHECK(access_info.constant()->IsFunctionTemplateInfo()); DCHECK(access_info.constant()->IsFunctionTemplateInfo());
Handle<FunctionTemplateInfo> function_template_info( Handle<FunctionTemplateInfo> function_template_info(
Handle<FunctionTemplateInfo>::cast(access_info.constant())); Handle<FunctionTemplateInfo>::cast(access_info.constant()));
...@@ -1065,6 +1058,13 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1065,6 +1058,13 @@ JSNativeContextSpecialization::BuildPropertyAccess(
value = value_effect_control.value(); value = value_effect_control.value();
effect = value_effect_control.effect(); effect = value_effect_control.effect();
control = value_effect_control.control(); 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; break;
} }
...@@ -1558,6 +1558,13 @@ JSNativeContextSpecialization::BuildElementAccess( ...@@ -1558,6 +1558,13 @@ JSNativeContextSpecialization::BuildElementAccess(
return ValueEffectControl(value, effect, control); 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::ValueEffectControl
JSNativeContextSpecialization::InlineApiCall( JSNativeContextSpecialization::InlineApiCall(
Node* receiver, Node* context, Node* target, Node* frame_state, Node* value, Node* receiver, Node* context, Node* target, Node* frame_state, Node* value,
......
...@@ -148,6 +148,7 @@ class JSNativeContextSpecialization final : public AdvancedReducer { ...@@ -148,6 +148,7 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
// program location. // program location.
MaybeHandle<Map> InferReceiverRootMap(Node* receiver); MaybeHandle<Map> InferReceiverRootMap(Node* receiver);
bool CanInlineApiCall(PropertyAccessInfo const& access_info);
ValueEffectControl InlineApiCall( ValueEffectControl InlineApiCall(
Node* receiver, Node* context, Node* target, Node* frame_state, Node* receiver, Node* context, Node* target, Node* frame_state,
Node* parameter, Node* effect, Node* control, 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