Chromium Code Reviews| Index: src/compiler/js-native-context-specialization.cc |
| diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc |
| index 408a6cda39ac3f4a343acf831b13afb843779ee5..e531c584e1815193269ddfe9627a6324247055c3 100644 |
| --- a/src/compiler/js-native-context-specialization.cc |
| +++ b/src/compiler/js-native-context-specialization.cc |
| @@ -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 { |
|
Toon Verwaest
2017/01/10 13:34:57
This is broken; if CanInlineApiCall returns false
|
| + 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, |