Commit 77419488 authored by bmeurer's avatar bmeurer Committed by Commit bot

[builtins] Remove the unused AllocationSite slot from ConstructFrame.

This slot is completely unused and always undefined anyways, so there's
no need to maintain the slot during object construction.

R=yangguo@chromium.org
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2423323002
Cr-Commit-Position: refs/heads/master@{#40377}
parent 5bbf88bc
......@@ -547,14 +547,14 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- r0 : number of arguments
// -- r1 : constructor function
// -- r2 : allocation site or undefined
// -- r3 : new target
// -- cp : context
// -- lr : return address
......@@ -568,10 +568,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT);
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(r2, r4);
__ Push(cp);
__ SmiTag(r0);
__ Push(r2, r0);
__ Push(cp, r0);
if (create_implicit_receiver) {
// Allocate the new receiver object.
......@@ -701,6 +699,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Jump(lr);
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -535,14 +535,14 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- x0 : number of arguments
// -- x1 : constructor function
// -- x2 : allocation site or undefined
// -- x3 : new target
// -- lr : return address
// -- cp : context pointer
......@@ -560,14 +560,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// Preserve the four incoming parameters on the stack.
Register argc = x0;
Register constructor = x1;
Register allocation_site = x2;
Register new_target = x3;
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(allocation_site, x10);
__ Push(cp);
__ SmiTag(argc);
__ Push(allocation_site, argc);
__ Push(cp, argc);
if (create_implicit_receiver) {
// Allocate the new receiver object.
......@@ -703,6 +700,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Ret();
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -110,15 +110,15 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- eax: number of arguments
// -- esi: context
// -- edi: constructor function
// -- ebx: allocation site or undefined
// -- edx: new target
// -----------------------------------
......@@ -127,10 +127,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameScope scope(masm, StackFrame::CONSTRUCT);
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(ebx);
__ push(esi);
__ push(ebx);
__ SmiTag(eax);
__ push(esi);
__ push(eax);
if (create_implicit_receiver) {
......@@ -197,12 +195,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
Label use_receiver, exit;
// If the result is a smi, it is *not* an object in the ECMA sense.
__ JumpIfSmi(eax, &use_receiver);
__ JumpIfSmi(eax, &use_receiver, Label::kNear);
// If the type of the result (stored in its map) is less than
// FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense.
__ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx);
__ j(above_equal, &exit);
__ j(above_equal, &exit, Label::kNear);
// Throw away the result of the constructor invocation and use the
// on-stack receiver as the result.
......@@ -244,6 +242,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ ret(0);
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -548,14 +548,14 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- a0 : number of arguments
// -- a1 : constructor function
// -- a2 : allocation site or undefined
// -- a3 : new target
// -- cp : context
// -- ra : return address
......@@ -569,9 +569,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameScope scope(masm, StackFrame::CONSTRUCT);
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(a2, t0);
__ SmiTag(a0);
__ Push(cp, a2, a0);
__ Push(cp, a0);
if (create_implicit_receiver) {
// Allocate the new receiver object.
......@@ -698,6 +697,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Ret();
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -546,14 +546,14 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- a0 : number of arguments
// -- a1 : constructor function
// -- a2 : allocation site or undefined
// -- a3 : new target
// -- cp : context
// -- ra : return address
......@@ -567,9 +567,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameScope scope(masm, StackFrame::CONSTRUCT);
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(a2, t0);
__ SmiTag(a0);
__ Push(cp, a2, a0);
__ Push(cp, a0);
if (create_implicit_receiver) {
__ Push(a1, a3);
......@@ -693,6 +692,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Ret();
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -112,15 +112,15 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
GenerateTailCallToSharedCode(masm);
}
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
namespace {
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
bool create_implicit_receiver,
bool check_derived_construct) {
// ----------- S t a t e -------------
// -- rax: number of arguments
// -- rsi: context
// -- rdi: constructor function
// -- rbx: allocation site or undefined
// -- rdx: new target
// -----------------------------------
......@@ -129,10 +129,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameScope scope(masm, StackFrame::CONSTRUCT);
// Preserve the incoming parameters on the stack.
__ AssertUndefinedOrAllocationSite(rbx);
__ Push(rsi);
__ Push(rbx);
__ Integer32ToSmi(rcx, rax);
__ Push(rsi);
__ Push(rcx);
if (create_implicit_receiver) {
......@@ -197,13 +195,13 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// on page 74.
Label use_receiver, exit;
// If the result is a smi, it is *not* an object in the ECMA sense.
__ JumpIfSmi(rax, &use_receiver);
__ JumpIfSmi(rax, &use_receiver, Label::kNear);
// If the type of the result (stored in its map) is less than
// FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense.
STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
__ CmpObjectType(rax, FIRST_JS_RECEIVER_TYPE, rcx);
__ j(above_equal, &exit);
__ j(above_equal, &exit, Label::kNear);
// Throw away the result of the constructor invocation and use the
// on-stack receiver as the result.
......@@ -246,6 +244,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ ret(0);
}
} // namespace
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
Generate_JSConstructStubHelper(masm, false, true, false);
}
......
......@@ -1602,12 +1602,6 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
output_frame->SetFrameSlot(output_offset, value);
DebugPrintOutputSlot(value, frame_index, output_offset, "context\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));
......
......@@ -308,10 +308,9 @@ class ConstructFrameConstants : public TypedFrameConstants {
public:
// FP-relative.
static const int kContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kAllocationSiteOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static const int kImplicitReceiverOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
DEFINE_TYPED_FRAME_SIZES(4);
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kImplicitReceiverOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
DEFINE_TYPED_FRAME_SIZES(3);
};
class StubFailureTrampolineFrameConstants : public InternalFrameConstants {
......
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