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}
This commit is contained in:
jochen 2016-12-20 04:10:49 -08:00 committed by Commit bot
parent fb43021511
commit 55c88e586b
3 changed files with 25 additions and 16 deletions

View File

@ -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;
} }

View File

@ -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(
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(
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(
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(
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,

View File

@ -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,