{
FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT);
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(r2, r4);
- __ push(r2);
- }
-
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(r2, r4);
+ __ push(r2);
__ SmiTag(r0);
__ push(r0);
__ push(r1);
DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset);
__ str(r6, MemOperand(r5, kPointerSize, PostIndex));
// Load the AllocationSite
- __ ldr(r6, MemOperand(sp, 2 * kPointerSize));
+ __ ldr(r6, MemOperand(sp, 3 * kPointerSize));
+ __ AssertUndefinedOrAllocationSite(r6, r0);
DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
__ str(r6, MemOperand(r5, kPointerSize, PostIndex));
} else {
// -- sp[...]: constructor arguments
// -----------------------------------
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
-
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+ __ AssertUndefinedOrAllocationSite(r2, r4);
+ __ push(r2);
+
__ mov(r4, r0);
__ SmiTag(r4);
__ push(r4); // Smi-tagged arguments count.
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
- // Preserve the three incoming parameters on the stack.
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(x2, x10);
- __ Push(x2);
- }
-
+ // Preserve the four incoming parameters on the stack.
Register argc = x0;
Register constructor = x1;
+ Register allocation_site = x2;
Register original_constructor = x3;
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(allocation_site, x10);
__ SmiTag(argc);
- __ Push(argc, constructor, original_constructor);
+ __ Push(allocation_site, argc, constructor, original_constructor);
// sp[0]: new.target
// sp[1]: Constructor function.
// sp[2]: number of arguments (smi-tagged)
+ // sp[3]: allocation site
// Try to allocate the object without transitioning into C code. If any of
// the preconditions is not met, the code bails out to the runtime call.
DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset);
__ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex));
// Load the AllocationSite
- __ Peek(x14, 2 * kXRegSize);
+ __ Peek(x14, 3 * kXRegSize);
+ __ AssertUndefinedOrAllocationSite(x14, x10);
DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
__ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex));
first_prop = NoReg;
// -----------------------------------
ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived");
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
-
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+
+ __ AssertUndefinedOrAllocationSite(x2, x10);
__ Mov(x4, x0);
__ SmiTag(x4);
__ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
- __ Push(x4, x3, x10);
- // sp[0]: number of arguments
+ __ Push(x2, x4, x3, x10);
+ // sp[0]: receiver (the hole)
// sp[1]: new.target
- // sp[2]: receiver (the hole)
+ // sp[2]: number of arguments
+ // sp[3]: allocation site
// Set up pointer to last argument.
__ Add(x2, fp, StandardFrameConstants::kCallerSPOffset);
output_frame->SetFrameSlot(output_offset, value);
DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
+ // The allocation site.
+ output_offset -= kPointerSize;
+ value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value());
+ output_frame->SetFrameSlot(output_offset, value);
+ DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n");
+
// Number of incoming arguments.
output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
}
DCHECK(IsConstructFrame(fp));
STATIC_ASSERT(ConstructFrameConstants::kOriginalConstructorOffset ==
- StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize);
- return GetExpression(fp, 2);
+ StandardFrameConstants::kExpressionsOffset - 3 * kPointerSize);
+ return GetExpression(fp, 3);
}
public:
// FP-relative.
static const int kImplicitReceiverOffset =
- StandardFrameConstants::kExpressionsOffset - 3 * kPointerSize;
+ StandardFrameConstants::kExpressionsOffset - 4 * kPointerSize;
static const int kOriginalConstructorOffset =
- StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize;
+ StandardFrameConstants::kExpressionsOffset - 3 * kPointerSize;
static const int kLengthOffset =
+ StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize;
+ static const int kAllocationSiteOffset =
StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
static const int kCodeOffset =
StandardFrameConstants::kExpressionsOffset - 0 * kPointerSize;
static const int kFrameSize =
- StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
+ StandardFrameConstants::kFixedFrameSize + 5 * kPointerSize;
};
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(ebx);
- __ push(ebx);
- }
-
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(ebx);
+ __ push(ebx);
__ SmiTag(eax);
__ push(eax);
__ push(edi);
__ mov(Operand(esi, AllocationMemento::kMapOffset),
factory->allocation_memento_map());
// Get the cell or undefined.
- __ mov(edx, Operand(esp, kPointerSize*2));
+ __ mov(edx, Operand(esp, 3 * kPointerSize));
+ __ AssertUndefinedOrAllocationSite(edx);
__ mov(Operand(esi, AllocationMemento::kAllocationSiteOffset),
edx);
} else {
// -- edx: original constructor
// -----------------------------------
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
-
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+ // Preserve allocation site.
+ __ AssertUndefinedOrAllocationSite(ebx);
+ __ push(ebx);
+
// Preserve actual arguments count.
__ SmiTag(eax);
__ push(eax);
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(a2, t0);
- __ push(a2);
- }
-
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(a2, t0);
__ SmiTag(a0);
- __ Push(a0, a1, a3);
+ __ Push(a2, a0, a1, a3);
// Try to allocate the object without transitioning into C code. If any of
// the preconditions is not met, the code bails out to the runtime call.
__ sw(t7, MemOperand(t5));
__ Addu(t5, t5, kPointerSize);
// Load the AllocationSite.
- __ lw(t7, MemOperand(sp, 2 * kPointerSize));
+ __ lw(t7, MemOperand(sp, 3 * kPointerSize));
+ __ AssertUndefinedOrAllocationSite(a2, t0);
DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
__ sw(t7, MemOperand(t5));
__ Addu(t5, t5, kPointerSize);
// -- sp[...]: constructor arguments
// -----------------------------------
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
-
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+ __ AssertUndefinedOrAllocationSite(a2, t0);
+ __ push(a2);
+
__ mov(t0, a0);
__ SmiTag(t0);
__ push(t0); // Smi-tagged arguments count.
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(a2, t0);
- __ push(a2);
- }
-
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(a2, t0);
__ SmiTag(a0);
- __ Push(a0, a1, a3);
+ __ Push(a2, a0, a1, a3);
// Try to allocate the object without transitioning into C code. If any of
// the preconditions is not met, the code bails out to the runtime call.
__ sd(t3, MemOperand(t1));
__ Daddu(t1, t1, kPointerSize);
// Load the AllocationSite.
- __ ld(t3, MemOperand(sp, 2 * kPointerSize));
+ __ ld(t3, MemOperand(sp, 3 * kPointerSize));
+ __ AssertUndefinedOrAllocationSite(t3, a0);
DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
__ sd(t3, MemOperand(t1));
__ Daddu(t1, t1, kPointerSize);
// -- sp[...]: constructor arguments
// -----------------------------------
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
-
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+ __ AssertUndefinedOrAllocationSite(a2, t0);
+ __ push(a2);
+
__ mov(a4, a0);
__ SmiTag(a4);
__ push(a4); // Smi-tagged arguments count.
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
- if (create_memento) {
- __ AssertUndefinedOrAllocationSite(rbx);
- __ Push(rbx);
- }
-
// Preserve the incoming parameters on the stack.
+ __ AssertUndefinedOrAllocationSite(rbx);
+ __ Push(rbx);
__ Integer32ToSmi(rax, rax);
__ Push(rax);
__ Push(rdi);
__ Move(Operand(rsi, AllocationMemento::kMapOffset),
factory->allocation_memento_map());
// Get the cell or undefined.
- __ movp(rdx, Operand(rsp, kPointerSize*2));
+ __ movp(rdx, Operand(rsp, 3 * kPointerSize));
+ __ AssertUndefinedOrAllocationSite(rdx);
__ movp(Operand(rsi, AllocationMemento::kAllocationSiteOffset), rdx);
} else {
__ InitializeFieldsWithFiller(rcx, rdi, rdx);
// -- rbx: allocation site or undefined
// -- rdx: original constructor
// -----------------------------------
- // TODO(dslomov): support pretenuring
- CHECK(!FLAG_pretenuring_call_new);
{
FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
+ // Preserve allocation site.
+ __ AssertUndefinedOrAllocationSite(rbx);
+ __ Push(rbx);
+
// Store a smi-tagged arguments count on the stack.
__ Integer32ToSmi(rax, rax);
__ Push(rax);
CcTest::InitializeVM();
if (!i::FLAG_allocation_site_pretenuring) return;
if (!i::FLAG_pretenuring_call_new) return;
+ if (i::FLAG_always_opt) return;
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();