Commit 7aa7c5dd authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ic] Fix performance regression caused by LoadGlobalIC refactoring.

Bug: chromium:798372
Change-Id: I76d7317ef66dd5005250a10961d6732c39d4d108
Reviewed-on: https://chromium-review.googlesource.com/995445Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52359}
parent 77b076d1
......@@ -294,11 +294,21 @@ class ExitPoint {
typedef compiler::CodeAssemblerVariable CodeAssemblerVariable;
public:
typedef std::function<void(Node* result)> IndirectReturnHandler;
explicit ExitPoint(CodeStubAssembler* assembler)
: ExitPoint(assembler, nullptr, nullptr) {}
: ExitPoint(assembler, nullptr) {}
ExitPoint(CodeStubAssembler* assembler,
const IndirectReturnHandler& indirect_return_handler)
: asm_(assembler), indirect_return_handler_(indirect_return_handler) {}
ExitPoint(CodeStubAssembler* assembler, CodeAssemblerLabel* out,
CodeAssemblerVariable* var_result)
: out_(out), var_result_(var_result), asm_(assembler) {
: ExitPoint(assembler, [=](Node* result) {
var_result->Bind(result);
assembler->Goto(out);
}) {
DCHECK_EQ(out != nullptr, var_result != nullptr);
}
......@@ -308,7 +318,7 @@ class ExitPoint {
if (IsDirect()) {
asm_->TailCallRuntime(function, context, args...);
} else {
IndirectReturn(asm_->CallRuntime(function, context, args...));
indirect_return_handler_(asm_->CallRuntime(function, context, args...));
}
}
......@@ -317,7 +327,7 @@ class ExitPoint {
if (IsDirect()) {
asm_->TailCallStub(callable, context, args...);
} else {
IndirectReturn(asm_->CallStub(callable, context, args...));
indirect_return_handler_(asm_->CallStub(callable, context, args...));
}
}
......@@ -327,7 +337,8 @@ class ExitPoint {
if (IsDirect()) {
asm_->TailCallStub(descriptor, target, context, args...);
} else {
IndirectReturn(asm_->CallStub(descriptor, target, context, args...));
indirect_return_handler_(
asm_->CallStub(descriptor, target, context, args...));
}
}
......@@ -335,21 +346,15 @@ class ExitPoint {
if (IsDirect()) {
asm_->Return(result);
} else {
IndirectReturn(result);
indirect_return_handler_(result);
}
}
bool IsDirect() const { return out_ == nullptr; }
bool IsDirect() const { return !indirect_return_handler_; }
private:
void IndirectReturn(Node* const result) {
var_result_->Bind(result);
asm_->Goto(out_);
}
CodeAssemblerLabel* const out_;
CodeAssemblerVariable* const var_result_;
CodeStubAssembler* const asm_;
IndirectReturnHandler indirect_return_handler_;
};
} // namespace internal
......
......@@ -157,9 +157,10 @@ class InterpreterLoadGlobalAssembler : public InterpreterAssembler {
Node* feedback_slot = BytecodeOperandIdx(slot_operand_index);
AccessorAssembler accessor_asm(state());
Label done(this);
Variable var_result(this, MachineRepresentation::kTagged);
ExitPoint exit_point(this, &done, &var_result);
ExitPoint exit_point(this, [=](Node* result) {
SetAccumulator(result);
Dispatch();
});
LazyNode<Context> lazy_context = [=] { return CAST(GetContext()); };
......@@ -171,10 +172,6 @@ class InterpreterLoadGlobalAssembler : public InterpreterAssembler {
accessor_asm.LoadGlobalIC(feedback_vector, feedback_slot, lazy_context,
lazy_name, typeof_mode, &exit_point,
CodeStubAssembler::INTPTR_PARAMETERS);
BIND(&done);
SetAccumulator(var_result.value());
Dispatch();
}
};
......
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