Commit 99385199 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[sparkplug] Cleanup loading feedback_cell in VisitCreateClosure

- Directly use the right target register for the "fast" case as temporary
  register
- Don't load the function to load the feedback since that's unnecessary
  by now
- Deduplicate the cell loading code

Bug: v8:11429
Change-Id: Ia2298315c2db6f228be0821687ff92859169dd97
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2695588
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72755}
parent 760e6797
......@@ -442,8 +442,7 @@ void BaselineCompiler::LoadFeedbackVector(Register output) {
__ RecordComment("]");
}
void BaselineCompiler::LoadClosureFeedbackArray(Register output,
Register closure) {
void BaselineCompiler::LoadClosureFeedbackArray(Register output) {
LoadFeedbackVector(output);
__ LoadTaggedPointerField(output, output,
FeedbackVector::kClosureFeedbackCellArrayOffset);
......@@ -1762,29 +1761,22 @@ void BaselineCompiler::VisitGetTemplateObject() {
}
void BaselineCompiler::VisitCreateClosure() {
BaselineAssembler::ScratchRegisterScope scratch_scope(&basm_);
Register function = scratch_scope.AcquireScratch();
Register closure_feedback_array = scratch_scope.AcquireScratch();
// TODO(v8:11429,verwaest): Use the feedback cell register expected by the
// builtin.
__ LoadFunction(function);
LoadClosureFeedbackArray(closure_feedback_array, function);
Register feedback_cell =
Builtins::CallInterfaceDescriptorFor(Builtins::kFastNewClosure)
.GetRegisterParameter(FastNewClosureDescriptor::kFeedbackCell);
LoadClosureFeedbackArray(feedback_cell);
__ LoadFixedArrayElement(feedback_cell, feedback_cell, Index(1));
uint32_t flags = Flag(2);
if (interpreter::CreateClosureFlags::FastNewClosureBit::decode(flags)) {
Register entry = scratch_scope.AcquireScratch();
__ LoadFixedArrayElement(entry, closure_feedback_array, Index(1));
CallBuiltin(Builtins::kFastNewClosure, Constant<SharedFunctionInfo>(0),
entry);
feedback_cell);
} else {
Runtime::FunctionId function_id =
interpreter::CreateClosureFlags::PretenuredBit::decode(flags)
? Runtime::kNewClosure_Tenured
: Runtime::kNewClosure;
__ LoadFixedArrayElement(kInterpreterAccumulatorRegister,
closure_feedback_array, Index(1));
CallRuntime(function_id, Constant<SharedFunctionInfo>(0),
kInterpreterAccumulatorRegister);
CallRuntime(function_id, Constant<SharedFunctionInfo>(0), feedback_cell);
}
}
......
......@@ -276,7 +276,7 @@ class BaselineCompiler {
// Feedback vector.
MemOperand FeedbackVector();
void LoadFeedbackVector(Register output);
void LoadClosureFeedbackArray(Register output, Register closure);
void LoadClosureFeedbackArray(Register output);
// Position mapping.
void AddPosition();
......
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