Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 613673002: Support count operations on super named properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index a382dad315b48c6069b42e3a09127ac603d6a17a..d184930bd44b6e4f2452c3cfc9c763afb5822428 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -1932,7 +1932,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
EmitNamedPropertyAssignment(expr);
break;
case NAMED_SUPER_PROPERTY:
- EmitNamedSuperPropertyAssignment(expr);
+ EmitNamedSuperPropertyStore(property);
+ context()->Plug(eax);
break;
case KEYED_PROPERTY:
EmitKeyedPropertyAssignment(expr);
@@ -2551,11 +2552,10 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
}
-void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
+void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
// Assignment to named property of super.
// eax : value
// stack : receiver ('this'), home_object
- Property* prop = expr->target()->AsProperty();
DCHECK(prop != NULL);
Literal* key = prop->key()->AsLiteral();
DCHECK(key != NULL);
@@ -2565,7 +2565,6 @@ void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) {
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
: Runtime::kStoreToSuper_Sloppy),
4);
- context()->Plug(eax);
}
@@ -4332,19 +4331,21 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
// Expression can only be a property, a global or a (parameter or local)
// slot.
- enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
+ enum LhsKind {
+ VARIABLE,
+ NAMED_PROPERTY,
+ KEYED_PROPERTY,
+ NAMED_SUPER_PROPERTY
+ };
LhsKind assign_type = VARIABLE;
Property* prop = expr->expression()->AsProperty();
// In case of a property we use the uninitialized expression context
// of the key to detect a named property.
if (prop != NULL) {
assign_type =
- (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
- if (prop->IsSuperAccess()) {
- // throw exception.
- VisitSuperReference(prop->obj()->AsSuperReference());
- return;
- }
+ (prop->key()->IsPropertyName())
+ ? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
+ : KEYED_PROPERTY;
}
// Evaluate expression and get value.
@@ -4362,6 +4363,13 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
VisitForStackValue(prop->obj());
__ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
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 {
VisitForStackValue(prop->obj());
VisitForStackValue(prop->key());
@@ -4400,6 +4408,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY:
__ mov(Operand(esp, kPointerSize), eax);
break;
+ case NAMED_SUPER_PROPERTY:
+ __ mov(Operand(esp, 2 * kPointerSize), eax);
+ break;
case KEYED_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax);
break;
@@ -4438,6 +4449,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY:
__ mov(Operand(esp, kPointerSize), eax);
break;
+ case NAMED_SUPER_PROPERTY:
+ __ mov(Operand(esp, 2 * kPointerSize), eax);
+ break;
case KEYED_PROPERTY:
__ mov(Operand(esp, 2 * kPointerSize), eax);
break;
@@ -4497,6 +4511,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
}
break;
}
+ case NAMED_SUPER_PROPERTY: {
+ EmitNamedSuperPropertyStore(prop);
+ if (expr->is_postfix()) {
+ if (!context()->IsEffect()) {
+ context()->PlugTOS();
+ }
+ } else {
+ context()->Plug(eax);
+ }
+ break;
+ }
case KEYED_PROPERTY: {
__ pop(StoreDescriptor::NameRegister());
__ pop(StoreDescriptor::ReceiverRegister());
« no previous file with comments | « src/full-codegen.h ('k') | src/x64/full-codegen-x64.cc » ('j') | test/mjsunit/harmony/super.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698