Index: src/full-codegen/arm64/full-codegen-arm64.cc |
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc |
index 1e01b0d77e12c9b5fc72fdce614246cca3cc3ef5..d72dd71bd673b2a0bcb9af51cf379af7ef3f3a04 100644 |
--- a/src/full-codegen/arm64/full-codegen-arm64.cc |
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc |
@@ -4172,6 +4172,49 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) { |
} |
+void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
+ ZoneList<Expression*>* args = expr->arguments(); |
+ DCHECK_EQ(2, args->length()); |
+ VisitForStackValue(args->at(0)); |
+ VisitForStackValue(args->at(1)); |
+ |
+ Label runtime, done; |
+ |
+ Register result = x0; |
+ __ Allocate(JSIteratorResult::kSize, result, x10, x11, &runtime, TAG_OBJECT); |
+ Register map_reg = x1; |
+ Register result_value = x2; |
+ Register boolean_done = x3; |
+ Register empty_fixed_array = x4; |
+ Register untagged_result = x5; |
+ __ Ldr(map_reg, GlobalObjectMemOperand()); |
+ __ Ldr(map_reg, FieldMemOperand(map_reg, GlobalObject::kNativeContextOffset)); |
+ __ Ldr(map_reg, |
+ ContextMemOperand(map_reg, Context::ITERATOR_RESULT_MAP_INDEX)); |
+ __ Pop(boolean_done); |
+ __ Pop(result_value); |
+ __ LoadRoot(empty_fixed_array, Heap::kEmptyFixedArrayRootIndex); |
+ STATIC_ASSERT(JSObject::kPropertiesOffset + kPointerSize == |
+ JSObject::kElementsOffset); |
+ STATIC_ASSERT(JSIteratorResult::kValueOffset + kPointerSize == |
+ JSIteratorResult::kDoneOffset); |
+ __ ObjectUntag(untagged_result, result); |
+ __ Str(map_reg, MemOperand(untagged_result, HeapObject::kMapOffset)); |
+ __ Stp(empty_fixed_array, empty_fixed_array, |
+ MemOperand(untagged_result, JSObject::kPropertiesOffset)); |
+ __ Stp(result_value, boolean_done, |
+ MemOperand(untagged_result, JSIteratorResult::kValueOffset)); |
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
+ __ B(&done); |
+ |
+ __ Bind(&runtime); |
+ __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
+ |
+ __ Bind(&done); |
+ context()->Plug(x0); |
+} |
+ |
+ |
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
// Push undefined as the receiver. |
__ LoadRoot(x0, Heap::kUndefinedValueRootIndex); |
@@ -5085,26 +5128,19 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
- Label gc_required; |
- Label allocated; |
- |
- const int instance_size = 5 * kPointerSize; |
- DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), |
- instance_size); |
+ Label allocate, done_allocate; |
// Allocate and populate an object with this form: { value: VAL, done: DONE } |
Register result = x0; |
- __ Allocate(instance_size, result, x10, x11, &gc_required, TAG_OBJECT); |
- __ B(&allocated); |
+ __ Allocate(JSIteratorResult::kSize, result, x10, x11, &allocate, TAG_OBJECT); |
+ __ B(&done_allocate); |
- __ Bind(&gc_required); |
- __ Push(Smi::FromInt(instance_size)); |
+ __ Bind(&allocate); |
+ __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
__ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
- __ Ldr(context_register(), |
- MemOperand(fp, StandardFrameConstants::kContextOffset)); |
- __ Bind(&allocated); |
+ __ Bind(&done_allocate); |
Register map_reg = x1; |
Register result_value = x2; |
Register boolean_done = x3; |
@@ -5115,24 +5151,20 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
__ Ldr(map_reg, |
ContextMemOperand(map_reg, Context::ITERATOR_RESULT_MAP_INDEX)); |
__ Pop(result_value); |
- __ Mov(boolean_done, Operand(isolate()->factory()->ToBoolean(done))); |
- __ Mov(empty_fixed_array, Operand(isolate()->factory()->empty_fixed_array())); |
+ __ LoadRoot(boolean_done, |
+ done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
+ __ LoadRoot(empty_fixed_array, Heap::kEmptyFixedArrayRootIndex); |
STATIC_ASSERT(JSObject::kPropertiesOffset + kPointerSize == |
JSObject::kElementsOffset); |
- STATIC_ASSERT(JSGeneratorObject::kResultValuePropertyOffset + kPointerSize == |
- JSGeneratorObject::kResultDonePropertyOffset); |
+ STATIC_ASSERT(JSIteratorResult::kValueOffset + kPointerSize == |
+ JSIteratorResult::kDoneOffset); |
__ ObjectUntag(untagged_result, result); |
__ Str(map_reg, MemOperand(untagged_result, HeapObject::kMapOffset)); |
__ Stp(empty_fixed_array, empty_fixed_array, |
MemOperand(untagged_result, JSObject::kPropertiesOffset)); |
__ Stp(result_value, boolean_done, |
- MemOperand(untagged_result, |
- JSGeneratorObject::kResultValuePropertyOffset)); |
- |
- // Only the value field needs a write barrier, as the other values are in the |
- // root set. |
- __ RecordWriteField(result, JSGeneratorObject::kResultValuePropertyOffset, |
- x10, x11, kLRHasBeenSaved, kDontSaveFPRegs); |
+ MemOperand(untagged_result, JSIteratorResult::kValueOffset)); |
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
} |