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

Unified Diff: src/heap.cc

Issue 13542002: Calling a generator function returns a generator object (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Link generator iterator definitions and uses through local variable Created 7 years, 9 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/heap.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 5bb1ee49d3f27873ee40741d1f32979607e1f4f2..801fcde79cfce1445757fdc426b83f4f9f8297f9 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4333,6 +4333,22 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
}
+MaybeObject* Heap::AllocateJSGeneratorIterator(JSFunction *function) {
+ ASSERT(function->shared()->is_generator());
+ Map *map = function->initial_map();
+ ASSERT(map->IsMap());
+ ASSERT(map->instance_type() == JS_GENERATOR_ITERATOR_TYPE);
+ JSGeneratorIterator *generator;
+ MaybeObject* maybe_generator = AllocateJSObjectFromMap(map, NOT_TENURED);
+ if (!maybe_generator->To(&generator)) return maybe_generator;
+ generator->set_function(function);
+ generator->set_context(Smi::FromInt(0));
+ generator->set_continuation(0);
+ generator->set_operand_stack(Smi::FromInt(0));
+ return generator;
+}
+
+
MaybeObject* Heap::AllocateJSModule(Context* context, ScopeInfo* scope_info) {
// Allocate a fresh map. Modules do not have a prototype.
Map* map;
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698