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

Unified Diff: src/factory.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/factory.h ('k') | src/full-codegen.cc » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index a2e91e64a5acfd3dc90469963aa195411bdc2ee8..bdffa29c2e4ab982f29cc68b5e1a1b7aec4aa651 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -614,8 +614,8 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
if (function_info->is_generator()) {
// Generator functions have specialized prototypes and instance types, so
// they need their prototypes to be created eagerly.
- // TODO(wingo): Use JS_GENERATOR_TYPE.
- Handle<Map> instance_map = NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
+ Handle<Map> instance_map =
+ NewMap(JS_GENERATOR_ITERATOR_TYPE, JSGeneratorIterator::kSize);
Handle<JSObject> iterator_prototype = NewFunctionPrototype(result);
instance_map->set_prototype(*iterator_prototype);
result->set_initial_map(*instance_map);
@@ -978,6 +978,15 @@ Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
}
+Handle<JSGeneratorIterator> Factory::NewJSGeneratorIterator(
+ Handle<JSFunction> function) {
+ CALL_HEAP_FUNCTION(
+ isolate(),
+ isolate()->heap()->AllocateJSGeneratorIterator(*function),
+ JSGeneratorIterator);
+}
+
+
Handle<JSModule> Factory::NewJSModule(Handle<Context> context,
Handle<ScopeInfo> scope_info) {
CALL_HEAP_FUNCTION(
« no previous file with comments | « src/factory.h ('k') | src/full-codegen.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698