[fullcodegen] Remove deprecated support for new.target and rest parameters.

This code is no longer used by full-codegen since all functions which
use new.target, rest parameters or the internal this function binding
now grow through Ignition first, and never tier up to fullcodegen.

BUG=v8:5657
R=rmcilroy@chromium.org

Review-Url: https://codereview.chromium.org/2528293002
Cr-Commit-Position: refs/heads/master@{#41298}
This commit is contained in:
bmeurer 2016-11-28 00:59:19 -08:00 committed by Commit bot
parent c69f8fbd78
commit 65fd9c4306
12 changed files with 47 additions and 362 deletions

View File

@ -589,8 +589,13 @@ void AstNumberingVisitor::VisitRewritableExpression(
bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
DeclarationScope* scope = node->scope();
if (scope->new_target_var()) DisableFullCodegenAndCrankshaft(kSuperReference);
if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) {
if (scope->new_target_var() != nullptr ||
scope->this_function_var() != nullptr) {
DisableFullCodegenAndCrankshaft(kSuperReference);
}
if (scope->arguments() != nullptr &&
!scope->arguments()->IsStackAllocated()) {
DisableFullCodegenAndCrankshaft(kContextAllocatedArguments);
}

View File

@ -335,18 +335,6 @@ Node* AstGraphBuilder::GetFunctionContext() {
return function_context_.get();
}
Node* AstGraphBuilder::GetNewTarget() {
if (!new_target_.is_set()) {
int params = info()->num_parameters_including_this();
int index = Linkage::GetJSCallNewTargetParamIndex(params);
const Operator* op = common()->Parameter(index, "%new.target");
Node* node = NewNode(op, graph()->start());
new_target_.set(node);
}
return new_target_.get();
}
Node* AstGraphBuilder::GetEmptyFrameState() {
if (!empty_frame_state_.is_set()) {
const Operator* op = common()->FrameState(
@ -425,15 +413,10 @@ void AstGraphBuilder::CreateGraphBody(bool stack_check) {
// Build the arguments object if it is used.
BuildArgumentsObject(scope->arguments());
// Build rest arguments array if it is used.
Variable* rest_parameter = scope->rest_parameter();
BuildRestArgumentsArray(rest_parameter);
// Build assignment to {.this_function} variable if it is used.
BuildThisFunctionVariable(scope->this_function_var());
// Build assignment to {new.target} variable if it is used.
BuildNewTargetVariable(scope->new_target_var());
// We don't support new.target and rest parameters here.
DCHECK_NULL(scope->new_target_var());
DCHECK_NULL(scope->rest_parameter());
DCHECK_NULL(scope->this_function_var());
// Emit tracing call if requested to do so.
if (FLAG_trace) {
@ -2794,52 +2777,6 @@ Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) {
return object;
}
Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest) {
if (rest == nullptr) return nullptr;
// Allocate and initialize a new arguments object.
CreateArgumentsType type = CreateArgumentsType::kRestParameter;
const Operator* op = javascript()->CreateArguments(type);
Node* object = NewNode(op, GetFunctionClosure());
PrepareFrameState(object, BailoutId::None());
// Assign the object to the {rest} variable. This should never lazy
// deopt, so it is fine to send invalid bailout id.
DCHECK(rest->IsContextSlot() || rest->IsStackAllocated());
BuildVariableAssignment(rest, object, Token::ASSIGN, VectorSlotPair(),
BailoutId::None());
return object;
}
Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) {
if (this_function_var == nullptr) return nullptr;
// Retrieve the closure we were called with.
Node* this_function = GetFunctionClosure();
// Assign the object to the {.this_function} variable. This should never lazy
// deopt, so it is fine to send invalid bailout id.
BuildVariableAssignment(this_function_var, this_function, Token::INIT,
VectorSlotPair(), BailoutId::None());
return this_function;
}
Node* AstGraphBuilder::BuildNewTargetVariable(Variable* new_target_var) {
if (new_target_var == nullptr) return nullptr;
// Retrieve the new target we were called with.
Node* object = GetNewTarget();
// Assign the object to the {new.target} variable. This should never lazy
// deopt, so it is fine to send invalid bailout id.
BuildVariableAssignment(new_target_var, object, Token::INIT, VectorSlotPair(),
BailoutId::None());
return object;
}
Node* AstGraphBuilder::BuildHoleCheckThenThrow(Node* value, Variable* variable,
Node* not_hole,
BailoutId bailout_id) {

View File

@ -94,7 +94,6 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
// Nodes representing values in the activation record.
SetOncePointer<Node> function_closure_;
SetOncePointer<Node> function_context_;
SetOncePointer<Node> new_target_;
// Temporary storage for building node input lists.
int input_buffer_size_;
@ -161,9 +160,6 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
// Get or create the node that represents the incoming function context.
Node* GetFunctionContext();
// Get or create the node that represents the incoming new target value.
Node* GetNewTarget();
// Get or create the node that represents the empty frame state.
Node* GetEmptyFrameState();
@ -269,15 +265,6 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
// Builder to create an arguments object if it is used.
Node* BuildArgumentsObject(Variable* arguments);
// Builder to create an array of rest parameters if used.
Node* BuildRestArgumentsArray(Variable* rest);
// Builder that assigns to the {.this_function} internal variable if needed.
Node* BuildThisFunctionVariable(Variable* this_function_var);
// Builder that assigns to the {new.target} internal variable if needed.
Node* BuildNewTargetVariable(Variable* new_target_var);
// Builders for variable load and assignment.
Node* BuildVariableAssignment(Variable* variable, Node* value,
Token::Value op, const VectorSlotPair& slot,

View File

@ -253,37 +253,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_r1) {
__ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, r1, r0, r2);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, r3, r0, r2);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_r1) {
__ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_r1 = false;
SetVar(rest_param, r0, r1, r2);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -255,37 +255,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_x1) {
__ Ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, x1, x0, x2);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, x3, x0, x2);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_x1) {
__ Ldr(x1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_x1 = false;
SetVar(rest_param, x0, x1, x2);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -245,37 +245,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register) {
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, edi, ebx, ecx);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, edx, ebx, ecx);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register) {
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register = false;
SetVar(rest_param, eax, ebx, edx);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -263,37 +263,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_a1) {
__ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, a1, a0, a2);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, a3, a0, a2);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_a1) {
__ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_a1 = false;
SetVar(rest_param, v0, a1, a2);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -262,36 +262,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_a1) {
__ ld(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, a1, a0, a2);
}
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, a3, a0, a2);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_a1) {
__ ld(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_a1 = false;
SetVar(rest_param, v0, a1, a2);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -261,37 +261,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_r4) {
__ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, r4, r3, r5);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, r6, r3, r5);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_r4) {
__ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_r4 = false;
SetVar(rest_param, r3, r4, r5);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -265,39 +265,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register_r3) {
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, r3, r2, r4);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, r5, r2, r4);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_r3) {
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register_r3 = false;
SetVar(rest_param, r2, r3, r4);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {

View File

@ -241,37 +241,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register) {
__ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, rdi, rbx, rcx);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, rdx, rbx, rcx);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register) {
__ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register = false;
SetVar(rest_param, rax, rbx, rdx);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
// Possibly allocate an arguments object.
DCHECK_EQ(scope(), info->scope());

View File

@ -242,37 +242,10 @@ void FullCodeGenerator::Generate() {
PrepareForBailoutForId(BailoutId::FunctionContext(),
BailoutState::NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = info->scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
if (!function_in_register) {
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
// The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, edi, ebx, ecx);
}
// Possibly set up a local binding to the new target value.
Variable* new_target_var = info->scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
SetVar(new_target_var, edx, ebx, ecx);
}
// Possibly allocate RestParameters
Variable* rest_param = info->scope()->rest_parameter();
if (rest_param != nullptr) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register) {
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
function_in_register = false;
SetVar(rest_param, eax, ebx, edx);
}
// We don't support new.target and rest parameters here.
DCHECK_NULL(info->scope()->new_target_var());
DCHECK_NULL(info->scope()->rest_parameter());
DCHECK_NULL(info->scope()->this_function_var());
Variable* arguments = info->scope()->arguments();
if (arguments != NULL) {