Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: src/full-codegen/ppc/full-codegen-ppc.cc

Issue 1325203004: PPC: [es6] Introduce a dedicated JSIteratorResult type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc
index 4af5bc4ab8f5afe2a0ca747794ac6356d38867f6..bc4562d312c8dd3f2249bb28d7e19daf1f553b08 100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -2265,43 +2265,28 @@ void FullCodeGenerator::EmitGeneratorResume(
void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
- Label gc_required;
- Label allocated;
+ Label allocate, done_allocate;
- const int instance_size = 5 * kPointerSize;
- DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(),
- instance_size);
+ __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate, TAG_OBJECT);
+ __ b(&done_allocate);
- __ Allocate(instance_size, r3, r5, r6, &gc_required, TAG_OBJECT);
- __ b(&allocated);
-
- __ bind(&gc_required);
- __ Push(Smi::FromInt(instance_size));
+ __ bind(&allocate);
+ __ Push(Smi::FromInt(JSIteratorResult::kSize));
__ CallRuntime(Runtime::kAllocateInNewSpace, 1);
- __ LoadP(context_register(),
- MemOperand(fp, StandardFrameConstants::kContextOffset));
- __ bind(&allocated);
+ __ bind(&done_allocate);
__ LoadP(r4, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
__ LoadP(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset));
__ LoadP(r4, ContextOperand(r4, Context::ITERATOR_RESULT_MAP_INDEX));
__ pop(r5);
- __ mov(r6, Operand(isolate()->factory()->ToBoolean(done)));
- __ mov(r7, Operand(isolate()->factory()->empty_fixed_array()));
+ __ LoadRoot(r6,
+ done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
+ __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex);
__ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0);
__ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0);
__ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0);
- __ StoreP(r5,
- FieldMemOperand(r3, JSGeneratorObject::kResultValuePropertyOffset),
- r0);
- __ StoreP(r6,
- FieldMemOperand(r3, JSGeneratorObject::kResultDonePropertyOffset),
- r0);
-
- // Only the value field needs a write barrier, as the other values are in the
- // root set.
- __ RecordWriteField(r3, JSGeneratorObject::kResultValuePropertyOffset, r5, r6,
- kLRHasBeenSaved, kDontSaveFPRegs);
+ __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0);
+ __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0);
}
@@ -4516,6 +4501,36 @@ 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;
+
+ __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &runtime, TAG_OBJECT);
+ __ LoadP(r4, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
+ __ LoadP(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset));
+ __ LoadP(r4, ContextOperand(r4, Context::ITERATOR_RESULT_MAP_INDEX));
+ __ Pop(r5, r6);
+ __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex);
+ __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0);
+ __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0);
+ __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0);
+ __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0);
+ __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0);
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
+ __ b(&done);
+
+ __ bind(&runtime);
+ __ CallRuntime(Runtime::kCreateIterResultObject, 2);
+
+ __ bind(&done);
+ context()->Plug(r3);
+}
+
+
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push undefined as the receiver.
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698