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( |