Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index 788598400f1684393ae5135f1ec6662389fde927..a318b61bd91d46cc9cf8986794d4686faa2ceecd 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -300,7 +300,8 @@ void FullCodeGenerator::Generate() { |
VisitDeclarations(scope()->declarations()); |
} |
- { Comment cmnt(masm_, "[ Stack check"); |
+ { |
+ Comment cmnt(masm_, "[ Stack check"); |
PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
Label ok; |
DCHECK(jssp.Is(__ StackPointer())); |
@@ -312,7 +313,8 @@ void FullCodeGenerator::Generate() { |
__ Bind(&ok); |
} |
- { Comment cmnt(masm_, "[ Body"); |
+ { |
+ Comment cmnt(masm_, "[ Body"); |
DCHECK(loop_depth() == 0); |
VisitStatements(function()->body()); |
DCHECK(loop_depth() == 0); |
@@ -2040,7 +2042,7 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
SetSourcePosition(prop->position()); |
- // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
+ // Call keyed load IC. It has arguments key and receiver in x0 and x1. |
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
if (FLAG_vector_ics) { |
__ Mov(VectorLoadICDescriptor::SlotRegister(), |
@@ -2175,6 +2177,74 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
} |
+void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
+ // Constructor is in x0. |
+ DCHECK(lit != NULL); |
+ __ push(x0); |
+ |
+ // No access check is needed here since the constructor is created by the |
+ // class literal. |
+ Register scratch = x1; |
+ __ Ldr(scratch, |
+ FieldMemOperand(x0, 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()) { |
+ __ Peek(scratch, kPointerSize); // constructor |
+ } else { |
+ __ Peek(scratch, 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); |
+ __ Mov(scratch, Smi::FromInt(NONE)); |
+ __ Push(scratch); |
+ __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
+ break; |
+ |
+ case ObjectLiteral::Property::GETTER: |
+ VisitForStackValue(value); |
+ __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
+ __ push(scratch); |
+ __ Mov(scratch, Smi::FromInt(NONE)); |
+ __ Push(scratch); |
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
+ break; |
+ |
+ case ObjectLiteral::Property::SETTER: |
+ __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
+ __ push(scratch); |
+ VisitForStackValue(value); |
+ __ Mov(scratch, Smi::FromInt(NONE)); |
+ __ Push(scratch); |
+ __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
+ break; |
+ |
+ default: |
+ UNREACHABLE(); |
+ } |
+ } |
+ |
+ // prototype |
+ __ CallRuntime(Runtime::kToFastProperties, 1); |
+ |
+ // constructor |
+ __ CallRuntime(Runtime::kToFastProperties, 1); |
+} |
+ |
+ |
void FullCodeGenerator::EmitAssignment(Expression* expr) { |
DCHECK(expr->IsValidReferenceExpression()); |
@@ -4859,7 +4929,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
// The value stays in x0, and is ultimately read by the resumed generator, as |
// if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it |
- // is read to throw the value when the resumed generator is already closed. r1 |
+ // is read to throw the value when the resumed generator is already closed. x1 |
// will hold the generator object until the activation has been resumed. |
VisitForStackValue(generator); |
VisitForAccumulatorValue(value); |