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

Unified Diff: src/full-codegen/ia32/full-codegen-ia32.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/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/ia32/full-codegen-ia32.cc
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc
index 2272e73f8421cc9153f44cc95cf304d0f22b3304..7b48af46c6f770e9ba93443150659032c8267e04 100644
--- a/src/full-codegen/ia32/full-codegen-ia32.cc
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc
@@ -2193,40 +2193,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, eax, ecx, edx, &allocate, TAG_OBJECT);
+ __ jmp(&done_allocate, Label::kNear);
- __ Allocate(instance_size, eax, ecx, edx, &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);
- __ mov(context_register(),
- Operand(ebp, StandardFrameConstants::kContextOffset));
- __ bind(&allocated);
- __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
+ __ bind(&done_allocate);
+ __ mov(ebx, GlobalObjectOperand());
__ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
__ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
- __ pop(ecx);
- __ mov(edx, isolate()->factory()->ToBoolean(done));
__ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);
__ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
isolate()->factory()->empty_fixed_array());
__ mov(FieldOperand(eax, JSObject::kElementsOffset),
isolate()->factory()->empty_fixed_array());
- __ mov(FieldOperand(eax, JSGeneratorObject::kResultValuePropertyOffset), ecx);
- __ mov(FieldOperand(eax, JSGeneratorObject::kResultDonePropertyOffset), edx);
-
- // Only the value field needs a write barrier, as the other values are in the
- // root set.
- __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset,
- ecx, edx, kDontSaveFPRegs);
+ __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset));
+ __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset),
+ isolate()->factory()->ToBoolean(done));
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
}
@@ -4412,6 +4400,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, eax, ecx, edx, &runtime, TAG_OBJECT);
+ __ mov(ebx, GlobalObjectOperand());
+ __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
+ __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
+ __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);
+ __ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
+ isolate()->factory()->empty_fixed_array());
+ __ mov(FieldOperand(eax, JSObject::kElementsOffset),
+ isolate()->factory()->empty_fixed_array());
+ __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset));
+ __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset));
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
+ __ jmp(&done, Label::kNear);
+
+ __ bind(&runtime);
+ __ CallRuntime(Runtime::kCreateIterResultObject, 2);
+
+ __ bind(&done);
+ context()->Plug(eax);
+}
+
+
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push undefined as receiver.
__ push(Immediate(isolate()->factory()->undefined_value()));
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698