[maglev] Fix RootConstant<Undefined> and Call order 2

Take 1:
https://chromium-review.googlesource.com/c/v8/v8/+/3557331

Undefined node needs to be constructed before Call in
BuildCallFromRegisterList as well.

Bug: v8:7700
Change-Id: I58bc647a3b34437a0a143e1f252c2fa2a01df3d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3557235
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79672}
This commit is contained in:
Victor Gomes 2022-03-30 12:00:48 +02:00 committed by V8 LUCI CQ
parent b0f9b4df3d
commit c50337c945

View File

@ -372,13 +372,19 @@ void MaglevGraphBuilder::BuildCallFromRegisterList(
ValueNode* context = GetContext();
size_t input_count = args.register_count() + Call::kFixedInputCount;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) input_count++;
RootConstant* undefined_constant;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
// The undefined constant node has to be created before the call node.
undefined_constant =
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue);
input_count++;
}
Call* call = AddNewNode<Call>(input_count, receiver_mode, function, context);
int arg_index = 0;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
call->set_arg(arg_index++,
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue));
call->set_arg(arg_index++, undefined_constant);
}
for (int i = 0; i < args.register_count(); ++i) {
call->set_arg(arg_index++, current_interpreter_frame_.get(args[i]));