X87: Keyed stores to super where key is a name.
port r24490. original commit message: Keyed stores to super where key is a name. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/649533002 Patch from Chunyang Dai <chunyang.dai@intel.com>. git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24507 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
e0e844b490
commit
35ab21900c
@ -1807,22 +1807,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
|
|
||||||
Comment cmnt(masm_, "[ Assignment");
|
Comment cmnt(masm_, "[ Assignment");
|
||||||
|
|
||||||
// Left-hand side can only be a property, a global or a (parameter or local)
|
|
||||||
// slot.
|
|
||||||
enum LhsKind {
|
|
||||||
VARIABLE,
|
|
||||||
NAMED_PROPERTY,
|
|
||||||
KEYED_PROPERTY,
|
|
||||||
NAMED_SUPER_PROPERTY
|
|
||||||
};
|
|
||||||
LhsKind assign_type = VARIABLE;
|
|
||||||
Property* property = expr->target()->AsProperty();
|
Property* property = expr->target()->AsProperty();
|
||||||
if (property != NULL) {
|
LhsKind assign_type = GetAssignType(property);
|
||||||
assign_type = (property->key()->IsPropertyName())
|
|
||||||
? (property->IsSuperAccess() ? NAMED_SUPER_PROPERTY
|
|
||||||
: NAMED_PROPERTY)
|
|
||||||
: KEYED_PROPERTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evaluate LHS expression.
|
// Evaluate LHS expression.
|
||||||
switch (assign_type) {
|
switch (assign_type) {
|
||||||
@ -1847,6 +1833,18 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
VisitForStackValue(property->obj());
|
VisitForStackValue(property->obj());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case KEYED_SUPER_PROPERTY:
|
||||||
|
VisitForStackValue(property->obj()->AsSuperReference()->this_var());
|
||||||
|
EmitLoadHomeObject(property->obj()->AsSuperReference());
|
||||||
|
__ Push(result_register());
|
||||||
|
VisitForAccumulatorValue(property->key());
|
||||||
|
__ Push(result_register());
|
||||||
|
if (expr->is_compound()) {
|
||||||
|
__ push(MemOperand(esp, 2 * kPointerSize));
|
||||||
|
__ push(MemOperand(esp, 2 * kPointerSize));
|
||||||
|
__ push(result_register());
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY: {
|
case KEYED_PROPERTY: {
|
||||||
if (expr->is_compound()) {
|
if (expr->is_compound()) {
|
||||||
VisitForStackValue(property->obj());
|
VisitForStackValue(property->obj());
|
||||||
@ -1879,6 +1877,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
EmitNamedPropertyLoad(property);
|
EmitNamedPropertyLoad(property);
|
||||||
PrepareForBailoutForId(property->LoadId(), TOS_REG);
|
PrepareForBailoutForId(property->LoadId(), TOS_REG);
|
||||||
break;
|
break;
|
||||||
|
case KEYED_SUPER_PROPERTY:
|
||||||
|
EmitKeyedSuperPropertyLoad(property);
|
||||||
|
PrepareForBailoutForId(property->LoadId(), TOS_REG);
|
||||||
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
EmitKeyedPropertyLoad(property);
|
EmitKeyedPropertyLoad(property);
|
||||||
PrepareForBailoutForId(property->LoadId(), TOS_REG);
|
PrepareForBailoutForId(property->LoadId(), TOS_REG);
|
||||||
@ -1926,7 +1928,11 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
break;
|
break;
|
||||||
case NAMED_SUPER_PROPERTY:
|
case NAMED_SUPER_PROPERTY:
|
||||||
EmitNamedSuperPropertyStore(property);
|
EmitNamedSuperPropertyStore(property);
|
||||||
context()->Plug(eax);
|
context()->Plug(result_register());
|
||||||
|
break;
|
||||||
|
case KEYED_SUPER_PROPERTY:
|
||||||
|
EmitKeyedSuperPropertyStore(property);
|
||||||
|
context()->Plug(result_register());
|
||||||
break;
|
break;
|
||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
EmitKeyedPropertyAssignment(expr);
|
EmitKeyedPropertyAssignment(expr);
|
||||||
@ -2561,14 +2567,26 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
|
|||||||
Literal* key = prop->key()->AsLiteral();
|
Literal* key = prop->key()->AsLiteral();
|
||||||
DCHECK(key != NULL);
|
DCHECK(key != NULL);
|
||||||
|
|
||||||
__ push(eax);
|
|
||||||
__ push(Immediate(key->value()));
|
__ push(Immediate(key->value()));
|
||||||
|
__ push(eax);
|
||||||
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
|
||||||
: Runtime::kStoreToSuper_Sloppy),
|
: Runtime::kStoreToSuper_Sloppy),
|
||||||
4);
|
4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) {
|
||||||
|
// Assignment to named property of super.
|
||||||
|
// eax : value
|
||||||
|
// stack : receiver ('this'), home_object, key
|
||||||
|
|
||||||
|
__ push(eax);
|
||||||
|
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreKeyedToSuper_Strict
|
||||||
|
: Runtime::kStoreKeyedToSuper_Sloppy),
|
||||||
|
4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||||
// Assignment to a property, using a keyed store IC.
|
// Assignment to a property, using a keyed store IC.
|
||||||
// eax : value
|
// eax : value
|
||||||
@ -4377,24 +4395,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
Comment cmnt(masm_, "[ CountOperation");
|
Comment cmnt(masm_, "[ CountOperation");
|
||||||
SetSourcePosition(expr->position());
|
SetSourcePosition(expr->position());
|
||||||
|
|
||||||
// Expression can only be a property, a global or a (parameter or local)
|
|
||||||
// slot.
|
|
||||||
enum LhsKind {
|
|
||||||
VARIABLE,
|
|
||||||
NAMED_PROPERTY,
|
|
||||||
KEYED_PROPERTY,
|
|
||||||
NAMED_SUPER_PROPERTY
|
|
||||||
};
|
|
||||||
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
|
LhsKind assign_type = GetAssignType(prop);
|
||||||
// of the key to detect a named property.
|
|
||||||
if (prop != NULL) {
|
|
||||||
assign_type =
|
|
||||||
(prop->key()->IsPropertyName())
|
|
||||||
? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
|
|
||||||
: KEYED_PROPERTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evaluate expression and get value.
|
// Evaluate expression and get value.
|
||||||
if (assign_type == VARIABLE) {
|
if (assign_type == VARIABLE) {
|
||||||
@ -4406,25 +4408,50 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
if (expr->is_postfix() && !context()->IsEffect()) {
|
if (expr->is_postfix() && !context()->IsEffect()) {
|
||||||
__ push(Immediate(Smi::FromInt(0)));
|
__ push(Immediate(Smi::FromInt(0)));
|
||||||
}
|
}
|
||||||
if (assign_type == NAMED_PROPERTY) {
|
switch (assign_type) {
|
||||||
// Put the object both on the stack and in the register.
|
case NAMED_PROPERTY: {
|
||||||
VisitForStackValue(prop->obj());
|
// Put the object both on the stack and in the register.
|
||||||
__ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
|
VisitForStackValue(prop->obj());
|
||||||
EmitNamedPropertyLoad(prop);
|
__ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
|
||||||
} else if (assign_type == NAMED_SUPER_PROPERTY) {
|
EmitNamedPropertyLoad(prop);
|
||||||
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
|
break;
|
||||||
EmitLoadHomeObject(prop->obj()->AsSuperReference());
|
}
|
||||||
__ push(result_register());
|
|
||||||
__ push(MemOperand(esp, kPointerSize));
|
case NAMED_SUPER_PROPERTY: {
|
||||||
__ push(result_register());
|
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
|
||||||
EmitNamedSuperPropertyLoad(prop);
|
EmitLoadHomeObject(prop->obj()->AsSuperReference());
|
||||||
} else {
|
__ push(result_register());
|
||||||
VisitForStackValue(prop->obj());
|
__ push(MemOperand(esp, kPointerSize));
|
||||||
VisitForStackValue(prop->key());
|
__ push(result_register());
|
||||||
__ mov(LoadDescriptor::ReceiverRegister(),
|
EmitNamedSuperPropertyLoad(prop);
|
||||||
Operand(esp, kPointerSize)); // Object.
|
break;
|
||||||
__ mov(LoadDescriptor::NameRegister(), Operand(esp, 0)); // Key.
|
}
|
||||||
EmitKeyedPropertyLoad(prop);
|
|
||||||
|
case KEYED_SUPER_PROPERTY: {
|
||||||
|
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
|
||||||
|
EmitLoadHomeObject(prop->obj()->AsSuperReference());
|
||||||
|
__ push(result_register());
|
||||||
|
VisitForAccumulatorValue(prop->key());
|
||||||
|
__ push(result_register());
|
||||||
|
__ push(MemOperand(esp, 2 * kPointerSize));
|
||||||
|
__ push(MemOperand(esp, 2 * kPointerSize));
|
||||||
|
__ push(result_register());
|
||||||
|
EmitKeyedSuperPropertyLoad(prop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case KEYED_PROPERTY: {
|
||||||
|
VisitForStackValue(prop->obj());
|
||||||
|
VisitForStackValue(prop->key());
|
||||||
|
__ mov(LoadDescriptor::ReceiverRegister(),
|
||||||
|
Operand(esp, kPointerSize)); // Object.
|
||||||
|
__ mov(LoadDescriptor::NameRegister(), Operand(esp, 0)); // Key.
|
||||||
|
EmitKeyedPropertyLoad(prop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VARIABLE:
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4462,6 +4489,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ mov(Operand(esp, 2 * kPointerSize), eax);
|
__ mov(Operand(esp, 2 * kPointerSize), eax);
|
||||||
break;
|
break;
|
||||||
|
case KEYED_SUPER_PROPERTY:
|
||||||
|
__ mov(Operand(esp, 3 * kPointerSize), eax);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4503,6 +4533,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
case KEYED_PROPERTY:
|
case KEYED_PROPERTY:
|
||||||
__ mov(Operand(esp, 2 * kPointerSize), eax);
|
__ mov(Operand(esp, 2 * kPointerSize), eax);
|
||||||
break;
|
break;
|
||||||
|
case KEYED_SUPER_PROPERTY:
|
||||||
|
__ mov(Operand(esp, 3 * kPointerSize), eax);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4570,6 +4603,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case KEYED_SUPER_PROPERTY: {
|
||||||
|
EmitKeyedSuperPropertyStore(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());
|
||||||
|
Loading…
Reference in New Issue
Block a user