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

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

Issue 1302173007: [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 | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/mips64/full-codegen-mips64.cc
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc
index 26921d640da0d51cdf0eb204bf583a9e2cee770b..55e3aece676e06f5e644c37f8956c8f947ce261d 100644
--- a/src/full-codegen/mips64/full-codegen-mips64.cc
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc
@@ -2264,41 +2264,28 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
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, v0, a2, a3, &allocate, TAG_OBJECT);
+ __ jmp(&done_allocate);
- __ Allocate(instance_size, v0, a2, a3, &gc_required, TAG_OBJECT);
- __ jmp(&allocated);
-
- __ bind(&gc_required);
- __ Push(Smi::FromInt(instance_size));
+ __ bind(&allocate);
+ __ Push(Smi::FromInt(JSIteratorResult::kSize));
__ CallRuntime(Runtime::kAllocateInNewSpace, 1);
- __ ld(context_register(),
- MemOperand(fp, StandardFrameConstants::kContextOffset));
- __ bind(&allocated);
+ __ bind(&done_allocate);
__ ld(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
__ ld(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ ld(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
__ pop(a2);
__ li(a3, Operand(isolate()->factory()->ToBoolean(done)));
- __ li(a4, Operand(isolate()->factory()->empty_fixed_array()));
+ __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
__ sd(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
- __ sd(a4, FieldMemOperand(v0, JSObject::kPropertiesOffset));
- __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset));
- __ sd(a2,
- FieldMemOperand(v0, JSGeneratorObject::kResultValuePropertyOffset));
- __ sd(a3,
- FieldMemOperand(v0, JSGeneratorObject::kResultDonePropertyOffset));
-
- // Only the value field needs a write barrier, as the other values are in the
- // root set.
- __ RecordWriteField(v0, JSGeneratorObject::kResultValuePropertyOffset,
- a2, a3, kRAHasBeenSaved, kDontSaveFPRegs);
+ __ sd(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
+ __ sd(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
+ __ sd(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
+ __ sd(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
}
@@ -4503,6 +4490,37 @@ 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, v0, a2, a3, &runtime, TAG_OBJECT);
+ __ ld(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
+ __ ld(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
+ __ ld(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
+ __ pop(a3);
+ __ pop(a2);
+ __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
+ __ sd(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
+ __ sd(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
+ __ sd(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
+ __ sd(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
+ __ sd(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
+ __ jmp(&done);
+
+ __ bind(&runtime);
+ __ CallRuntime(Runtime::kCreateIterResultObject, 2);
+
+ __ bind(&done);
+ context()->Plug(v0);
+}
+
+
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push undefined as the receiver.
__ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698