Commit c50337c9 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[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: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79672}
parent b0f9b4df
......@@ -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]));
......
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