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

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

Issue 687633002: MIPS: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 6760b3c00ab55a4298f44bd813372fbab2c34879..8e829e9e29a1f8baffdd28784e2524bd789a9380 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -2482,6 +2482,74 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
}
+void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
+ // Constructor is in v0.
+ DCHECK(lit != NULL);
+ __ push(v0);
+
+ // No access check is needed here since the constructor is created by the
+ // class literal.
+ Register scratch = a1;
+ __ lw(scratch,
+ FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset));
+ __ push(scratch);
+
+ for (int i = 0; i < lit->properties()->length(); i++) {
+ ObjectLiteral::Property* property = lit->properties()->at(i);
+ Literal* key = property->key()->AsLiteral();
+ Expression* value = property->value();
+ DCHECK(key != NULL);
+
+ if (property->is_static()) {
+ __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor
+ } else {
+ __ lw(scratch, MemOperand(sp, 0)); // prototype
+ }
+ __ push(scratch);
+ VisitForStackValue(key);
+
+ switch (property->kind()) {
+ case ObjectLiteral::Property::CONSTANT:
+ case ObjectLiteral::Property::MATERIALIZED_LITERAL:
+ case ObjectLiteral::Property::COMPUTED:
+ case ObjectLiteral::Property::PROTOTYPE:
+ VisitForStackValue(value);
+ __ li(scratch, Operand(Smi::FromInt(NONE)));
+ __ push(scratch);
+ __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
+ break;
+
+ case ObjectLiteral::Property::GETTER:
+ VisitForStackValue(value);
+ __ LoadRoot(scratch, Heap::kNullValueRootIndex);
+ __ push(scratch);
+ __ li(scratch, Operand(Smi::FromInt(NONE)));
+ __ push(scratch);
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
+ break;
+
+ case ObjectLiteral::Property::SETTER:
+ __ LoadRoot(scratch, Heap::kNullValueRootIndex);
+ __ push(scratch);
+ VisitForStackValue(value);
+ __ li(scratch, Operand(Smi::FromInt(NONE)));
+ __ push(scratch);
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ // prototype
+ __ CallRuntime(Runtime::kToFastProperties, 1);
+
+ // constructor
+ __ CallRuntime(Runtime::kToFastProperties, 1);
+}
+
+
void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
Token::Value op,
OverwriteMode mode) {
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698