Chromium Code Reviews| Index: src/bootstrapper.cc |
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
| index fd7a7d0216ef1df4089ce1288a4b2a1f03a14afa..cb5fceb277a46c8b77961d39c6f29f0c0f26dccd 100644 |
| --- a/src/bootstrapper.cc |
| +++ b/src/bootstrapper.cc |
| @@ -2151,18 +2151,27 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| Handle<Map> map = |
| factory->NewMap(JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize); |
| Map::SetPrototype(map, isolate->factory()->null_value()); |
| + Map::EnsureDescriptorSlack(map, 2); |
| native_context()->set_js_module_namespace_map(*map); |
| - // Install @@toStringTag. |
| - PropertyAttributes attribs = |
| - static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
| - DataConstantDescriptor d(factory->to_string_tag_symbol(), |
| - factory->NewStringFromAsciiChecked("Module"), |
| - attribs); |
| - Map::EnsureDescriptorSlack(map, 1); |
| - map->AppendDescriptor(&d); |
| + { // Install @@toStringTag. |
| + PropertyAttributes attribs = |
| + static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
| + DataConstantDescriptor d(factory->to_string_tag_symbol(), |
| + factory->NewStringFromAsciiChecked("Module"), |
| + attribs); |
| + map->AppendDescriptor(&d); |
| + } |
| - // TODO(neis): Implement and install @@iterator. |
| + { // Install @@iterator. |
| + Handle<JSFunction> iterator = SimpleCreateFunction( |
| + isolate, factory->NewStringFromAsciiChecked("[Symbol.iterator]"), |
| + Builtins::kModuleNamespaceIterator, 0, true); |
| + iterator->shared()->set_native(true); |
| + // TODO(neis): Is this really supposed to be writable? |
|
Benedikt Meurer
2016/10/12 03:24:05
You can remove this TODO. All the @@iterator prope
adamk
2016/10/12 16:21:47
The Module case is somewhat special, as the spec g
|
| + DataConstantDescriptor d(factory->iterator_symbol(), iterator, DONT_ENUM); |
| + map->AppendDescriptor(&d); |
| + } |
| } |
| { // -- I t e r a t o r R e s u l t |
| @@ -2772,6 +2781,22 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, |
| *generator_function_function); |
| } |
| + { // -- F i x e d A r r a y I t e r a t o r |
| + Handle<Map> map = factory->NewMap(JS_FIXED_ARRAY_ITERATOR_TYPE, |
| + JSFixedArrayIterator::kSize); |
| + Map::SetPrototype(map, iterator_prototype); |
| + Map::EnsureDescriptorSlack(map, 1); |
| + map->SetInObjectProperties(3); |
| + map->SetConstructor(native_context->object_function()); |
|
neis
2016/10/11 18:36:17
I don't know if I need this line.
|
| + native_context->set_fixed_array_iterator_map(*map); |
| + |
| + { // next |
| + DataDescriptor d(factory->next_string(), JSFixedArrayIterator::kNextIndex, |
| + DONT_ENUM, Representation::Tagged()); |
| + map->AppendDescriptor(&d); |
| + } |
| + } |
| + |
| { // -- S e t I t e r a t o r |
| Handle<JSObject> set_iterator_prototype = |
| isolate->factory()->NewJSObject(isolate->object_function(), TENURED); |