Commit 77774035 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Fix uninitialized new.target register in InvokeBuiltin.

On some architectures the InvokeBuiltin sequence does not go through
InvokeFunctionCode, which initializes the new.target register. This
initializes the register explicitly on these architectures for now.

R=ishell@chromium.org
BUG=chromium:565046
LOG=n

Review URL: https://codereview.chromium.org/1499953002

Cr-Commit-Position: refs/heads/master@{#32622}
parent 0f2bffa1
......@@ -2517,6 +2517,9 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
// You can't call a builtin without a valid frame.
DCHECK(flag == JUMP_FUNCTION || has_frame());
// Always initialize new target.
LoadRoot(r3, Heap::kUndefinedValueRootIndex);
LoadNativeContextSlot(native_context_index, r1);
ldr(r2, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
if (flag == CALL_FUNCTION) {
......
......@@ -1707,6 +1707,9 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
// You can't call a builtin without a valid frame.
DCHECK(flag == JUMP_FUNCTION || has_frame());
// Always initialize new target.
LoadRoot(x3, Heap::kUndefinedValueRootIndex);
// Get the builtin entry in x2 and setup the function object in x1.
LoadNativeContextSlot(native_context_index, x1);
Ldr(x2, FieldMemOperand(x1, JSFunction::kCodeEntryOffset));
......
......@@ -4502,6 +4502,9 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
// You can't call a builtin without a valid frame.
DCHECK(flag == JUMP_FUNCTION || has_frame());
// Always initialize new target.
LoadRoot(a3, Heap::kUndefinedValueRootIndex);
LoadNativeContextSlot(native_context_index, a1);
lw(t9, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
if (flag == CALL_FUNCTION) {
......
......@@ -4898,6 +4898,9 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
// You can't call a builtin without a valid frame.
DCHECK(flag == JUMP_FUNCTION || has_frame());
// Always initialize new target.
LoadRoot(a3, Heap::kUndefinedValueRootIndex);
LoadNativeContextSlot(native_context_index, a1);
ld(t9, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
if (flag == CALL_FUNCTION) {
......
......@@ -2342,6 +2342,9 @@ void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
// You can't call a builtin without a valid frame.
DCHECK(flag == JUMP_FUNCTION || has_frame());
// Always initialize new target.
LoadRoot(r6, Heap::kUndefinedValueRootIndex);
LoadNativeContextSlot(native_context_index, r4);
LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
if (flag == CALL_FUNCTION) {
......
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