Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 47d705fa8872ddf7cde8935e6e8f7e3d69f8af49..b8539315fcf3625d9a392dfbd6fc50e2a3f33491 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -2505,6 +2505,74 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
} |
+void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
+ // ctor is in r0. |
+ DCHECK(lit != NULL); |
+ __ push(r0); |
+ |
+ Register scratch = r1; |
+ __ ldr(scratch, |
+ FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); |
+ __ push(scratch); |
Dmitry Lomov (no reviews)
2014/10/27 21:37:13
Add a comment about why it is ok to skip access ch
arv (Not doing code reviews)
2014/10/28 09:42:00
Done.
Dmitry Lomov (no reviews)
2014/10/28 10:34:07
Acknowledged.
|
+ |
+ 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()) { |
+ __ ldr(ip, MemOperand(sp, kPointerSize)); // constructor |
Dmitry Lomov (no reviews)
2014/10/27 21:37:13
Nit: use scratch register instead of 'ip' here
arv (Not doing code reviews)
2014/10/28 09:42:00
Done.
Dmitry Lomov (no reviews)
2014/10/28 10:34:08
Acknowledged.
|
+ } else { |
+ __ ldr(ip, MemOperand(sp, 0)); // prototype |
+ } |
+ __ push(ip); |
+ VisitForStackValue(key); |
+ |
+ switch (property->kind()) { |
+ case ObjectLiteral::Property::CONSTANT: |
+ case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
+ case ObjectLiteral::Property::COMPUTED: |
+ case ObjectLiteral::Property::PROTOTYPE: |
+ VisitForStackValue(value); |
+ __ mov(r0, Operand(Smi::FromInt(NONE))); |
+ __ push(r0); |
+ __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
+ break; |
+ |
+ case ObjectLiteral::Property::GETTER: |
+ VisitForStackValue(value); |
+ __ LoadRoot(r0, Heap::kNullValueRootIndex); |
+ __ push(r0); |
+ __ mov(r0, Operand(Smi::FromInt(NONE))); |
+ __ push(r0); |
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
+ break; |
+ |
+ case ObjectLiteral::Property::SETTER: |
+ __ LoadRoot(r0, Heap::kNullValueRootIndex); |
+ __ push(r0); |
+ VisitForStackValue(value); |
+ __ mov(r0, Operand(Smi::FromInt(NONE))); |
+ __ push(r0); |
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
+ break; |
+ |
+ default: |
+ UNREACHABLE(); |
+ } |
+ } |
+ |
+ // prototype |
+ __ CallRuntime(Runtime::kToFastProperties, 1); |
+ |
+ // constructor |
+ __ CallRuntime(Runtime::kToFastProperties, 1); |
+ |
+ context()->Plug(r0); |
Dmitry Lomov (no reviews)
2014/10/27 21:37:13
The caller plugs context, no need to do it here.
arv (Not doing code reviews)
2014/10/28 09:42:00
Done.
Dmitry Lomov (no reviews)
2014/10/28 10:34:08
Acknowledged.
|
+} |
+ |
+ |
void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
Token::Value op, |
OverwriteMode mode) { |