MIPS: Support count operations on super named properties.
Port r24290 (98dc7ec) BUG=v8:3330 LOG=N R=paul.lind@imgtec.com Review URL: https://codereview.chromium.org/609403002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24295 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
eb3e3ce240
commit
3aba080773
@ -1992,7 +1992,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
EmitNamedPropertyAssignment(expr);
|
EmitNamedPropertyAssignment(expr);
|
||||||
break;
|
break;
|
||||||
case NAMED_SUPER_PROPERTY:
|
case NAMED_SUPER_PROPERTY:
|
||||||
EmitNamedSuperPropertyAssignment(expr);
|
EmitNamedSuperPropertyStore(property);
|
||||||
|
context()->Plug(v0);
|
||||||
break;
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
EmitKeyedPropertyAssignment(expr);
|
EmitKeyedPropertyAssignment(expr);
|
||||||
@ -2613,11 +2614,10 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
|
void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
|
||||||
// Assignment to named property of super.
|
// Assignment to named property of super.
|
||||||
// v0 : value
|
// v0 : value
|
||||||
// stack : receiver ('this'), home_object
|
// stack : receiver ('this'), home_object
|
||||||
Property* prop = expr->target()->AsProperty();
|
|
||||||
DCHECK(prop != NULL);
|
DCHECK(prop != NULL);
|
||||||
Literal* key = prop->key()->AsLiteral();
|
Literal* key = prop->key()->AsLiteral();
|
||||||
DCHECK(key != NULL);
|
DCHECK(key != NULL);
|
||||||
@ -2627,7 +2627,6 @@ void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
|
|||||||
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
||||||
: Runtime::kStoreToSuper_Sloppy),
|
: Runtime::kStoreToSuper_Sloppy),
|
||||||
4);
|
4);
|
||||||
context()->Plug(v0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4385,19 +4384,21 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
|
|
||||||
// Expression can only be a property, a global or a (parameter or local)
|
// Expression can only be a property, a global or a (parameter or local)
|
||||||
// slot.
|
// slot.
|
||||||
enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
|
enum LhsKind {
|
||||||
|
VARIABLE,
|
||||||
|
NAMED_PROPERTY,
|
||||||
|
KEYED_PROPERTY,
|
||||||
|
NAMED_SUPER_PROPERTY
|
||||||
|
};
|
||||||
LhsKind assign_type = VARIABLE;
|
LhsKind assign_type = VARIABLE;
|
||||||
Property* prop = expr->expression()->AsProperty();
|
Property* prop = expr->expression()->AsProperty();
|
||||||
// In case of a property we use the uninitialized expression context
|
// In case of a property we use the uninitialized expression context
|
||||||
// of the key to detect a named property.
|
// of the key to detect a named property.
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
assign_type =
|
assign_type =
|
||||||
(prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
|
(prop->key()->IsPropertyName())
|
||||||
if (prop->IsSuperAccess()) {
|
? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
|
||||||
// throw exception.
|
: KEYED_PROPERTY;
|
||||||
VisitSuperReference(prop->obj()->AsSuperReference());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate expression and get value.
|
// Evaluate expression and get value.
|
||||||
@ -4416,6 +4417,14 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
VisitForStackValue(prop->obj());
|
VisitForStackValue(prop->obj());
|
||||||
__ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
__ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
||||||
EmitNamedPropertyLoad(prop);
|
EmitNamedPropertyLoad(prop);
|
||||||
|
} else if (assign_type == NAMED_SUPER_PROPERTY) {
|
||||||
|
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
|
||||||
|
EmitLoadHomeObject(prop->obj()->AsSuperReference());
|
||||||
|
__ Push(result_register());
|
||||||
|
const Register scratch = a1;
|
||||||
|
__ lw(scratch, MemOperand(sp, kPointerSize));
|
||||||
|
__ Push(scratch, result_register());
|
||||||
|
EmitNamedSuperPropertyLoad(prop);
|
||||||
} else {
|
} else {
|
||||||
VisitForStackValue(prop->obj());
|
VisitForStackValue(prop->obj());
|
||||||
VisitForStackValue(prop->key());
|
VisitForStackValue(prop->key());
|
||||||
@ -4457,6 +4466,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case NAMED_PROPERTY:
|
case NAMED_PROPERTY:
|
||||||
__ sw(v0, MemOperand(sp, kPointerSize));
|
__ sw(v0, MemOperand(sp, kPointerSize));
|
||||||
break;
|
break;
|
||||||
|
case NAMED_SUPER_PROPERTY:
|
||||||
|
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
break;
|
break;
|
||||||
@ -4490,6 +4502,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case NAMED_PROPERTY:
|
case NAMED_PROPERTY:
|
||||||
__ sw(v0, MemOperand(sp, kPointerSize));
|
__ sw(v0, MemOperand(sp, kPointerSize));
|
||||||
break;
|
break;
|
||||||
|
case NAMED_SUPER_PROPERTY:
|
||||||
|
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
__ sw(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
break;
|
break;
|
||||||
@ -4548,6 +4563,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NAMED_SUPER_PROPERTY: {
|
||||||
|
EmitNamedSuperPropertyStore(prop);
|
||||||
|
if (expr->is_postfix()) {
|
||||||
|
if (!context()->IsEffect()) {
|
||||||
|
context()->PlugTOS();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context()->Plug(v0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case KEYED_PROPERTY: {
|
case KEYED_PROPERTY: {
|
||||||
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
||||||
__ Pop(StoreDescriptor::ReceiverRegister(),
|
__ Pop(StoreDescriptor::ReceiverRegister(),
|
||||||
|
@ -1989,7 +1989,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
EmitNamedPropertyAssignment(expr);
|
EmitNamedPropertyAssignment(expr);
|
||||||
break;
|
break;
|
||||||
case NAMED_SUPER_PROPERTY:
|
case NAMED_SUPER_PROPERTY:
|
||||||
EmitNamedSuperPropertyAssignment(expr);
|
EmitNamedSuperPropertyStore(property);
|
||||||
|
context()->Plug(v0);
|
||||||
break;
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
EmitKeyedPropertyAssignment(expr);
|
EmitKeyedPropertyAssignment(expr);
|
||||||
@ -2613,11 +2614,10 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
|
void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
|
||||||
// Assignment to named property of super.
|
// Assignment to named property of super.
|
||||||
// v0 : value
|
// v0 : value
|
||||||
// stack : receiver ('this'), home_object
|
// stack : receiver ('this'), home_object
|
||||||
Property* prop = expr->target()->AsProperty();
|
|
||||||
DCHECK(prop != NULL);
|
DCHECK(prop != NULL);
|
||||||
Literal* key = prop->key()->AsLiteral();
|
Literal* key = prop->key()->AsLiteral();
|
||||||
DCHECK(key != NULL);
|
DCHECK(key != NULL);
|
||||||
@ -2627,7 +2627,6 @@ void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
|
|||||||
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
||||||
: Runtime::kStoreToSuper_Sloppy),
|
: Runtime::kStoreToSuper_Sloppy),
|
||||||
4);
|
4);
|
||||||
context()->Plug(v0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4385,19 +4384,21 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
|
|
||||||
// Expression can only be a property, a global or a (parameter or local)
|
// Expression can only be a property, a global or a (parameter or local)
|
||||||
// slot.
|
// slot.
|
||||||
enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
|
enum LhsKind {
|
||||||
|
VARIABLE,
|
||||||
|
NAMED_PROPERTY,
|
||||||
|
KEYED_PROPERTY,
|
||||||
|
NAMED_SUPER_PROPERTY
|
||||||
|
};
|
||||||
LhsKind assign_type = VARIABLE;
|
LhsKind assign_type = VARIABLE;
|
||||||
Property* prop = expr->expression()->AsProperty();
|
Property* prop = expr->expression()->AsProperty();
|
||||||
// In case of a property we use the uninitialized expression context
|
// In case of a property we use the uninitialized expression context
|
||||||
// of the key to detect a named property.
|
// of the key to detect a named property.
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
assign_type =
|
assign_type =
|
||||||
(prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
|
(prop->key()->IsPropertyName())
|
||||||
if (prop->IsSuperAccess()) {
|
? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
|
||||||
// throw exception.
|
: KEYED_PROPERTY;
|
||||||
VisitSuperReference(prop->obj()->AsSuperReference());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate expression and get value.
|
// Evaluate expression and get value.
|
||||||
@ -4416,6 +4417,14 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
VisitForStackValue(prop->obj());
|
VisitForStackValue(prop->obj());
|
||||||
__ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
__ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
||||||
EmitNamedPropertyLoad(prop);
|
EmitNamedPropertyLoad(prop);
|
||||||
|
} else if (assign_type == NAMED_SUPER_PROPERTY) {
|
||||||
|
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
|
||||||
|
EmitLoadHomeObject(prop->obj()->AsSuperReference());
|
||||||
|
__ Push(result_register());
|
||||||
|
const Register scratch = a1;
|
||||||
|
__ ld(scratch, MemOperand(sp, kPointerSize));
|
||||||
|
__ Push(scratch, result_register());
|
||||||
|
EmitNamedSuperPropertyLoad(prop);
|
||||||
} else {
|
} else {
|
||||||
VisitForStackValue(prop->obj());
|
VisitForStackValue(prop->obj());
|
||||||
VisitForStackValue(prop->key());
|
VisitForStackValue(prop->key());
|
||||||
@ -4457,6 +4466,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case NAMED_PROPERTY:
|
case NAMED_PROPERTY:
|
||||||
__ sd(v0, MemOperand(sp, kPointerSize));
|
__ sd(v0, MemOperand(sp, kPointerSize));
|
||||||
break;
|
break;
|
||||||
|
case NAMED_SUPER_PROPERTY:
|
||||||
|
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
break;
|
break;
|
||||||
@ -4490,6 +4502,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case NAMED_PROPERTY:
|
case NAMED_PROPERTY:
|
||||||
__ sd(v0, MemOperand(sp, kPointerSize));
|
__ sd(v0, MemOperand(sp, kPointerSize));
|
||||||
break;
|
break;
|
||||||
|
case NAMED_SUPER_PROPERTY:
|
||||||
|
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
__ sd(v0, MemOperand(sp, 2 * kPointerSize));
|
||||||
break;
|
break;
|
||||||
@ -4548,6 +4563,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NAMED_SUPER_PROPERTY: {
|
||||||
|
EmitNamedSuperPropertyStore(prop);
|
||||||
|
if (expr->is_postfix()) {
|
||||||
|
if (!context()->IsEffect()) {
|
||||||
|
context()->PlugTOS();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context()->Plug(v0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case KEYED_PROPERTY: {
|
case KEYED_PROPERTY: {
|
||||||
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
||||||
__ Pop(StoreDescriptor::ReceiverRegister(),
|
__ Pop(StoreDescriptor::ReceiverRegister(),
|
||||||
|
Loading…
Reference in New Issue
Block a user