Commit fbd7e788 authored by Creddy's avatar Creddy Committed by Commit Bot

Emit Call node for CallNoFeedback node instead of soft-deopt

Emit call node instead of soft-deopt for CallNoFeedback to
avoid performance penalty incase one-shot code gets optimized.
Tweek the inling heuristic to avoid recurisve inling with stress-opt.

Bug: v8:8106, v8:8072
Change-Id: I09643c0648b6c880f491d08a8a73f1960ca999c0
Reviewed-on: https://chromium-review.googlesource.com/1239075Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Chandan Reddy <chandanreddy@google.com>
Cr-Commit-Position: refs/heads/master@{#56200}
parent 68deca9b
...@@ -1791,19 +1791,33 @@ void BytecodeGraphBuilder::VisitCallAnyReceiver() { ...@@ -1791,19 +1791,33 @@ void BytecodeGraphBuilder::VisitCallAnyReceiver() {
} }
void BytecodeGraphBuilder::VisitCallNoFeedback() { void BytecodeGraphBuilder::VisitCallNoFeedback() {
DCHECK_EQ(interpreter::Bytecodes::GetReceiverMode(
bytecode_iterator().current_bytecode()),
ConvertReceiverMode::kAny);
PrepareEagerCheckpoint(); PrepareEagerCheckpoint();
// CallNoFeedback is emitted only for one-shot code. Normally the compiler Node* callee =
// will not have to optimize one-shot code. But when the --always-opt or environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
// --stress-opt flags are set compiler is forced to optimize one-shot code.
// Emiting SoftDeopt to prevent compiler from inlining CallNoFeedback in interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
// one-shot. size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
Node* effect = environment()->GetEffectDependency();
Node* control = environment()->GetControlDependency(); // The receiver is the first register, followed by the arguments in the
// consecutive registers.
int arg_count = static_cast<int>(reg_count) - 1;
// The arity of the Call node -- includes the callee, receiver and function
// arguments.
int arity = 2 + arg_count;
JSTypeHintLowering::LoweringResult deoptimize = // Setting call frequency to a value less than min_inlining frequency to
type_hint_lowering().BuildSoftDeopt(effect, control, // prevent inlining of one-shot call node.
DeoptimizeReason::kDeoptimizeNow); DCHECK(CallFrequency::kNoFeedbackCallFrequency < FLAG_min_inlining_frequency);
ApplyEarlyReduction(deoptimize); const Operator* call = javascript()->Call(
arity, CallFrequency(CallFrequency::kNoFeedbackCallFrequency));
Node* const* call_args = ProcessCallVarArgs(ConvertReceiverMode::kAny, callee,
first_reg, arg_count);
Node* value = ProcessCallArguments(call, call_args, arity);
environment()->BindAccumulator(value, Environment::kAttachFrameState);
} }
void BytecodeGraphBuilder::VisitCallProperty() { void BytecodeGraphBuilder::VisitCallProperty() {
......
...@@ -52,6 +52,8 @@ class CallFrequency final { ...@@ -52,6 +52,8 @@ class CallFrequency final {
return bit_cast<uint32_t>(f.value_); return bit_cast<uint32_t>(f.value_);
} }
static constexpr float kNoFeedbackCallFrequency = -1;
private: private:
float value_; float 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