OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 global, "Set", JS_SET_TYPE, JSSet::kSize, | 2144 global, "Set", JS_SET_TYPE, JSSet::kSize, |
2145 isolate->initial_object_prototype(), Builtins::kIllegal); | 2145 isolate->initial_object_prototype(), Builtins::kIllegal); |
2146 InstallWithIntrinsicDefaultProto(isolate, js_set_fun, | 2146 InstallWithIntrinsicDefaultProto(isolate, js_set_fun, |
2147 Context::JS_SET_FUN_INDEX); | 2147 Context::JS_SET_FUN_INDEX); |
2148 } | 2148 } |
2149 | 2149 |
2150 { // -- J S M o d u l e N a m e s p a c e | 2150 { // -- J S M o d u l e N a m e s p a c e |
2151 Handle<Map> map = | 2151 Handle<Map> map = |
2152 factory->NewMap(JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize); | 2152 factory->NewMap(JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize); |
2153 Map::SetPrototype(map, isolate->factory()->null_value()); | 2153 Map::SetPrototype(map, isolate->factory()->null_value()); |
| 2154 Map::EnsureDescriptorSlack(map, 2); |
2154 native_context()->set_js_module_namespace_map(*map); | 2155 native_context()->set_js_module_namespace_map(*map); |
2155 | 2156 |
2156 // Install @@toStringTag. | 2157 { // Install @@toStringTag. |
2157 PropertyAttributes attribs = | 2158 PropertyAttributes attribs = |
2158 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 2159 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
2159 DataConstantDescriptor d(factory->to_string_tag_symbol(), | 2160 DataConstantDescriptor d(factory->to_string_tag_symbol(), |
2160 factory->NewStringFromAsciiChecked("Module"), | 2161 factory->NewStringFromAsciiChecked("Module"), |
2161 attribs); | 2162 attribs); |
2162 Map::EnsureDescriptorSlack(map, 1); | 2163 map->AppendDescriptor(&d); |
2163 map->AppendDescriptor(&d); | 2164 } |
2164 | 2165 |
2165 // TODO(neis): Implement and install @@iterator. | 2166 { // Install @@iterator. |
| 2167 Handle<JSFunction> iterator = SimpleCreateFunction( |
| 2168 isolate, factory->NewStringFromAsciiChecked("[Symbol.iterator]"), |
| 2169 Builtins::kModuleNamespaceIterator, 0, true); |
| 2170 iterator->shared()->set_native(true); |
| 2171 // TODO(neis): Is this really supposed to be writable? |
| 2172 DataConstantDescriptor d(factory->iterator_symbol(), iterator, DONT_ENUM); |
| 2173 map->AppendDescriptor(&d); |
| 2174 } |
2166 } | 2175 } |
2167 | 2176 |
2168 { // -- I t e r a t o r R e s u l t | 2177 { // -- I t e r a t o r R e s u l t |
2169 Handle<Map> map = | 2178 Handle<Map> map = |
2170 factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize); | 2179 factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize); |
2171 Map::SetPrototype(map, isolate->initial_object_prototype()); | 2180 Map::SetPrototype(map, isolate->initial_object_prototype()); |
2172 Map::EnsureDescriptorSlack(map, 2); | 2181 Map::EnsureDescriptorSlack(map, 2); |
2173 | 2182 |
2174 { // value | 2183 { // value |
2175 DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex, | 2184 DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex, |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 generator_function_prototype, factory->constructor_string(), | 2774 generator_function_prototype, factory->constructor_string(), |
2766 generator_function_function, | 2775 generator_function_function, |
2767 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2776 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2768 | 2777 |
2769 native_context->sloppy_generator_function_map()->SetConstructor( | 2778 native_context->sloppy_generator_function_map()->SetConstructor( |
2770 *generator_function_function); | 2779 *generator_function_function); |
2771 native_context->strict_generator_function_map()->SetConstructor( | 2780 native_context->strict_generator_function_map()->SetConstructor( |
2772 *generator_function_function); | 2781 *generator_function_function); |
2773 } | 2782 } |
2774 | 2783 |
| 2784 { // -- F i x e d A r r a y I t e r a t o r |
| 2785 int size = JSFixedArrayIterator::kHeaderSize + |
| 2786 JSFixedArrayIterator::kInObjectPropertyCount * kPointerSize; |
| 2787 Handle<Map> map = factory->NewMap(JS_FIXED_ARRAY_ITERATOR_TYPE, size); |
| 2788 Map::SetPrototype(map, iterator_prototype); |
| 2789 Map::EnsureDescriptorSlack(map, 1); |
| 2790 map->SetInObjectProperties(1); |
| 2791 map->SetConstructor(native_context->object_function()); |
| 2792 |
| 2793 { // next |
| 2794 DataDescriptor d(factory->next_string(), JSFixedArrayIterator::kNextIndex, |
| 2795 DONT_ENUM, Representation::Tagged()); |
| 2796 map->AppendDescriptor(&d); |
| 2797 } |
| 2798 |
| 2799 native_context->set_fixed_array_iterator_map(*map); |
| 2800 } |
| 2801 |
2775 { // -- S e t I t e r a t o r | 2802 { // -- S e t I t e r a t o r |
2776 Handle<JSObject> set_iterator_prototype = | 2803 Handle<JSObject> set_iterator_prototype = |
2777 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); | 2804 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); |
2778 JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype); | 2805 JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype); |
2779 Handle<JSFunction> set_iterator_function = InstallFunction( | 2806 Handle<JSFunction> set_iterator_function = InstallFunction( |
2780 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, | 2807 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, |
2781 set_iterator_prototype, Builtins::kIllegal); | 2808 set_iterator_prototype, Builtins::kIllegal); |
2782 native_context->set_set_iterator_map(set_iterator_function->initial_map()); | 2809 native_context->set_set_iterator_map(set_iterator_function->initial_map()); |
2783 } | 2810 } |
2784 | 2811 |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4395 } | 4422 } |
4396 | 4423 |
4397 | 4424 |
4398 // Called when the top-level V8 mutex is destroyed. | 4425 // Called when the top-level V8 mutex is destroyed. |
4399 void Bootstrapper::FreeThreadResources() { | 4426 void Bootstrapper::FreeThreadResources() { |
4400 DCHECK(!IsActive()); | 4427 DCHECK(!IsActive()); |
4401 } | 4428 } |
4402 | 4429 |
4403 } // namespace internal | 4430 } // namespace internal |
4404 } // namespace v8 | 4431 } // namespace v8 |
OLD | NEW |