| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index 76f0a3c9a86e052add7782f4600217d317fc5a44..826d241e74ea636ca38ad5a7e21fb519a8b0c286 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -4089,9 +4089,8 @@ MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) {
|
| int instance_size;
|
| int in_object_properties;
|
| if (fun->shared()->is_generator()) {
|
| - // TODO(wingo): Replace with JS_GENERATOR_OBJECT_TYPE.
|
| - instance_type = JS_OBJECT_TYPE;
|
| - instance_size = JSObject::kHeaderSize;
|
| + instance_type = JS_GENERATOR_OBJECT_TYPE;
|
| + instance_size = JSGeneratorObject::kSize;
|
| in_object_properties = 0;
|
| } else {
|
| instance_type = JS_OBJECT_TYPE;
|
| @@ -4340,6 +4339,22 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
|
| }
|
|
|
|
|
| +MaybeObject* Heap::AllocateJSGeneratorObject(JSFunction *function) {
|
| + ASSERT(function->shared()->is_generator());
|
| + Map *map;
|
| + if (function->has_initial_map()) {
|
| + map = function->initial_map();
|
| + } else {
|
| + // Allocate the initial map if absent.
|
| + MaybeObject* maybe_map = AllocateInitialMap(function);
|
| + if (!maybe_map->To(&map)) return maybe_map;
|
| + function->set_initial_map(map);
|
| + }
|
| + ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
|
| + return AllocateJSObjectFromMap(map);
|
| +}
|
| +
|
| +
|
| MaybeObject* Heap::AllocateJSModule(Context* context, ScopeInfo* scope_info) {
|
| // Allocate a fresh map. Modules do not have a prototype.
|
| Map* map;
|
|
|