X87: Support count operations on super named properties.

port r24290.

original commit message:

   Support count operations on super named properties.

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8c413806
...@@ -1919,7 +1919,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { ...@@ -1919,7 +1919,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(eax);
break; break;
case KEYED_PROPERTY: case KEYED_PROPERTY:
EmitKeyedPropertyAssignment(expr); EmitKeyedPropertyAssignment(expr);
...@@ -2538,11 +2539,10 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { ...@@ -2538,11 +2539,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.
// eax : value // eax : 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);
...@@ -2552,7 +2552,6 @@ void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) { ...@@ -2552,7 +2552,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(eax);
} }
...@@ -4321,19 +4320,21 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4321,19 +4320,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.
...@@ -4351,6 +4352,13 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4351,6 +4352,13 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
VisitForStackValue(prop->obj()); VisitForStackValue(prop->obj());
__ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 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());
__ push(MemOperand(esp, kPointerSize));
__ push(result_register());
EmitNamedSuperPropertyLoad(prop);
} else { } else {
VisitForStackValue(prop->obj()); VisitForStackValue(prop->obj());
VisitForStackValue(prop->key()); VisitForStackValue(prop->key());
...@@ -4389,6 +4397,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4389,6 +4397,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: case NAMED_PROPERTY:
__ mov(Operand(esp, kPointerSize), eax); __ mov(Operand(esp, kPointerSize), eax);
break; break;
case NAMED_SUPER_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax);
break;
case KEYED_PROPERTY: case KEYED_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax); __ mov(Operand(esp, 2 * kPointerSize), eax);
break; break;
...@@ -4427,6 +4438,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4427,6 +4438,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: case NAMED_PROPERTY:
__ mov(Operand(esp, kPointerSize), eax); __ mov(Operand(esp, kPointerSize), eax);
break; break;
case NAMED_SUPER_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax);
break;
case KEYED_PROPERTY: case KEYED_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax); __ mov(Operand(esp, 2 * kPointerSize), eax);
break; break;
...@@ -4486,6 +4500,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4486,6 +4500,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(eax);
}
break;
}
case KEYED_PROPERTY: { case KEYED_PROPERTY: {
__ pop(StoreDescriptor::NameRegister()); __ pop(StoreDescriptor::NameRegister());
__ pop(StoreDescriptor::ReceiverRegister()); __ pop(StoreDescriptor::ReceiverRegister());
......
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