Generate correct bytecode for calls of optional chains
The receiver may be undefined when calling optionally chained properties, so CallAnyReceiver should be used instead of CallProperty. TBR=rmcilroy@chromium.org Bug: chromium:1038178 Change-Id: Id91f2ecda1a5b38f6d1c9a6b6f90c0ae7dcbe638 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1986205 Commit-Queue: Shu-yu Guo <syg@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#65580}
This commit is contained in:
parent
eb2d9591b8
commit
4c2379e582
@ -1733,16 +1733,8 @@ class Call final : public Expression {
|
||||
PRIVATE_CALL,
|
||||
SUPER_CALL,
|
||||
OTHER_CALL,
|
||||
|
||||
FIRST_NON_SUPER_PROPERTY_CALL = NAMED_PROPERTY_CALL,
|
||||
LAST_NON_SUPER_PROPERTY_CALL = KEYED_OPTIONAL_CHAIN_PROPERTY_CALL
|
||||
};
|
||||
|
||||
static bool IsNonSuperPropertyCall(CallType call_type) {
|
||||
return base::IsInRange(call_type, FIRST_NON_SUPER_PROPERTY_CALL,
|
||||
LAST_NON_SUPER_PROPERTY_CALL);
|
||||
}
|
||||
|
||||
enum PossiblyEval {
|
||||
IS_POSSIBLY_EVAL,
|
||||
NOT_EVAL,
|
||||
|
@ -4834,7 +4834,8 @@ void BytecodeGenerator::VisitCall(Call* expr) {
|
||||
} else if (optimize_as_one_shot) {
|
||||
DCHECK(!implicit_undefined_receiver);
|
||||
builder()->CallNoFeedback(callee, args);
|
||||
} else if (Call::IsNonSuperPropertyCall(call_type)) {
|
||||
} else if (call_type == Call::NAMED_PROPERTY_CALL ||
|
||||
call_type == Call::KEYED_PROPERTY_CALL) {
|
||||
DCHECK(!implicit_undefined_receiver);
|
||||
builder()->CallProperty(callee, args,
|
||||
feedback_index(feedback_spec()->AddCallICSlot()));
|
||||
|
Loading…
Reference in New Issue
Block a user