Chromium Code Reviews| Index: src/ia32/full-codegen-ia32.cc |
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
| index cddefa1b85d93d25e5c8e06f41532ffa3d746967..8e9c7084b95b74c41376197547bc2e7510078aa6 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -2415,6 +2415,90 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| } |
| +void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
| + // ctor is in eax. |
| + DCHECK(lit != NULL); |
| + __ push(eax); |
| + |
| + Register scratch = ebx; |
| + __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset)); |
|
Dmitry Lomov (no reviews)
2014/10/18 08:30:33
Loading prototype is an operation that requires ac
|
| + __ push(scratch); |
| + |
| + AccessorTable accessor_table(zone()); |
| + 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); |
| + |
| + switch (property->kind()) { |
| + case ObjectLiteral::Property::CONSTANT: |
| + case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| + case ObjectLiteral::Property::COMPUTED: |
| + if (property->is_static()) { |
| + __ push(Operand(esp, kPointerSize)); // constructor |
| + } else { |
| + __ push(Operand(esp, 0)); // prototype |
| + } |
| + VisitForStackValue(key); |
| + VisitForStackValue(value); |
| + __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode |
| + __ CallRuntime(Runtime::kSetProperty, 4); |
|
Dmitry Lomov (no reviews)
2014/10/18 08:30:33
You should use StoreIC here (see EmitKeyedProperty
Dmitry Lomov (no reviews)
2014/10/18 09:04:59
s/Keyed/Named/ of course.
Maybe given how much run
arv (Not doing code reviews)
2014/10/20 20:22:31
I'm not sure that is correct? We are not doing ass
|
| + break; |
| + |
| + case ObjectLiteral::Property::GETTER: { |
| + ObjectLiteral::Accessors *accessors = |
| + accessor_table.lookup(key)->second; |
| + accessors->getter = value; |
| + if (property->is_static()) { |
| + __ push(Operand(esp, kPointerSize)); // constructor |
| + } else { |
| + __ push(Operand(esp, 0)); // prototype |
| + } |
| + VisitForStackValue(key); |
| + EmitAccessor(accessors->getter); |
| + EmitAccessor(accessors->setter); |
| + __ push(Immediate(Smi::FromInt(NONE))); |
| + __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| + break; |
| + } |
| + |
| + case ObjectLiteral::Property::SETTER: { |
| + ObjectLiteral::Accessors *accessors = |
| + accessor_table.lookup(key)->second; |
| + accessors->setter = value; |
| + if (property->is_static()) { |
| + __ push(Operand(esp, kPointerSize)); // constructor |
| + } else { |
| + __ push(Operand(esp, 0)); // prototype |
| + } |
| + VisitForStackValue(key); |
| + EmitAccessor(accessors->getter); |
| + EmitAccessor(accessors->setter); |
| + __ push(Immediate(Smi::FromInt(NONE))); |
| + __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| + break; |
| + } |
| + |
| + case ObjectLiteral::Property::PROTOTYPE: |
| + // TODO(arv): Implement |
| + |
| + default: |
| + UNREACHABLE(); |
| + } |
| + } |
| + |
| + // prototype |
| + __ CallRuntime(Runtime::kToFastProperties, 1); |
| + |
| + // constructor |
| + __ CallRuntime(Runtime::kToFastProperties, 1); |
| + |
| + context()->Plug(eax); |
| +} |
| + |
| + |
| + |
| void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
| Token::Value op, |
| OverwriteMode mode) { |