Chromium Code Reviews| Index: src/x64/full-codegen-x64.cc |
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
| index 4229f445b39b0fd283bb0a51264ca739a3d56cc8..9d2e33da0915b60c63e2010660762d4292be9eca 100644 |
| --- a/src/x64/full-codegen-x64.cc |
| +++ b/src/x64/full-codegen-x64.cc |
| @@ -2420,6 +2420,67 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| } |
| +void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
| + // ctor is in rax. |
| + DCHECK(lit != NULL); |
| + __ Push(rax); |
| + |
| + Register scratch = rcx; |
|
Dmitry Lomov (no reviews)
2014/10/27 21:37:14
Nit: Why rcx here, but ebx in ia32?
arv (Not doing code reviews)
2014/10/27 22:20:53
Because I don't know enough about the different re
arv (Not doing code reviews)
2014/10/28 09:42:00
Done.
Dmitry Lomov (no reviews)
2014/10/28 10:34:08
Acknowledged.
|
| + __ movp(scratch, FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset)); |
|
Dmitry Lomov (no reviews)
2014/10/27 21:37:14
Access check comment.
arv (Not doing code reviews)
2014/10/28 09:42:00
Done.
Dmitry Lomov (no reviews)
2014/10/28 10:34:08
Acknowledged.
|
| + __ 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()) { |
| + __ Push(Operand(rsp, kPointerSize)); // constructor |
| + } else { |
| + __ Push(Operand(rsp, 0)); // prototype |
| + } |
| + VisitForStackValue(key); |
| + |
| + switch (property->kind()) { |
| + case ObjectLiteral::Property::CONSTANT: |
| + case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| + case ObjectLiteral::Property::COMPUTED: |
| + case ObjectLiteral::Property::PROTOTYPE: |
| + VisitForStackValue(value); |
| + __ Push(Smi::FromInt(NONE)); |
| + __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
| + break; |
| + |
| + case ObjectLiteral::Property::GETTER: |
| + VisitForStackValue(value); |
| + __ Push(isolate()->factory()->null_value()); |
| + __ Push(Smi::FromInt(NONE)); |
| + __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| + break; |
| + |
| + case ObjectLiteral::Property::SETTER: |
| + __ Push(isolate()->factory()->null_value()); |
| + VisitForStackValue(value); |
| + __ Push(Smi::FromInt(NONE)); |
| + __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| + break; |
| + |
| + default: |
| + UNREACHABLE(); |
| + } |
| + } |
| + |
| + // prototype |
| + __ CallRuntime(Runtime::kToFastProperties, 1); |
| + |
| + // constructor |
| + __ CallRuntime(Runtime::kToFastProperties, 1); |
| + |
| + context()->Plug(rax); |
|
Dmitry Lomov (no reviews)
2014/10/27 21:37:14
Caller plugs context
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) { |