| 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 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 global, "Set", JS_SET_TYPE, JSSet::kSize, | 2465 global, "Set", JS_SET_TYPE, JSSet::kSize, |
| 2466 isolate->initial_object_prototype(), Builtins::kIllegal); | 2466 isolate->initial_object_prototype(), Builtins::kIllegal); |
| 2467 InstallWithIntrinsicDefaultProto(isolate, js_set_fun, | 2467 InstallWithIntrinsicDefaultProto(isolate, js_set_fun, |
| 2468 Context::JS_SET_FUN_INDEX); | 2468 Context::JS_SET_FUN_INDEX); |
| 2469 } | 2469 } |
| 2470 | 2470 |
| 2471 { // -- J S M o d u l e N a m e s p a c e | 2471 { // -- J S M o d u l e N a m e s p a c e |
| 2472 Handle<Map> map = | 2472 Handle<Map> map = |
| 2473 factory->NewMap(JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize); | 2473 factory->NewMap(JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize); |
| 2474 Map::SetPrototype(map, isolate->factory()->null_value()); | 2474 Map::SetPrototype(map, isolate->factory()->null_value()); |
| 2475 Map::EnsureDescriptorSlack(map, 2); | 2475 Map::EnsureDescriptorSlack(map, 1); |
| 2476 native_context()->set_js_module_namespace_map(*map); | 2476 native_context()->set_js_module_namespace_map(*map); |
| 2477 | 2477 |
| 2478 { // Install @@toStringTag. | 2478 { // Install @@toStringTag. |
| 2479 PropertyAttributes attribs = | 2479 PropertyAttributes attribs = |
| 2480 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 2480 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
| 2481 DataConstantDescriptor d(factory->to_string_tag_symbol(), | 2481 DataConstantDescriptor d(factory->to_string_tag_symbol(), |
| 2482 factory->NewStringFromAsciiChecked("Module"), | 2482 factory->NewStringFromAsciiChecked("Module"), |
| 2483 attribs); | 2483 attribs); |
| 2484 map->AppendDescriptor(&d); | 2484 map->AppendDescriptor(&d); |
| 2485 } | 2485 } |
| 2486 | |
| 2487 { // Install @@iterator. | |
| 2488 Handle<JSFunction> iterator = SimpleCreateFunction( | |
| 2489 isolate, factory->NewStringFromAsciiChecked("[Symbol.iterator]"), | |
| 2490 Builtins::kModuleNamespaceIterator, 0, true); | |
| 2491 iterator->shared()->set_native(true); | |
| 2492 // TODO(neis): Is this really supposed to be writable? | |
| 2493 DataConstantDescriptor d(factory->iterator_symbol(), iterator, DONT_ENUM); | |
| 2494 map->AppendDescriptor(&d); | |
| 2495 } | |
| 2496 } | 2486 } |
| 2497 | 2487 |
| 2498 { // -- I t e r a t o r R e s u l t | 2488 { // -- I t e r a t o r R e s u l t |
| 2499 Handle<Map> map = | 2489 Handle<Map> map = |
| 2500 factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize); | 2490 factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize); |
| 2501 Map::SetPrototype(map, isolate->initial_object_prototype()); | 2491 Map::SetPrototype(map, isolate->initial_object_prototype()); |
| 2502 Map::EnsureDescriptorSlack(map, 2); | 2492 Map::EnsureDescriptorSlack(map, 2); |
| 2503 | 2493 |
| 2504 { // value | 2494 { // value |
| 2505 DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex, | 2495 DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex, |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3081 generator_function_prototype, factory->constructor_string(), | 3071 generator_function_prototype, factory->constructor_string(), |
| 3082 generator_function_function, | 3072 generator_function_function, |
| 3083 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 3073 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 3084 | 3074 |
| 3085 native_context->sloppy_generator_function_map()->SetConstructor( | 3075 native_context->sloppy_generator_function_map()->SetConstructor( |
| 3086 *generator_function_function); | 3076 *generator_function_function); |
| 3087 native_context->strict_generator_function_map()->SetConstructor( | 3077 native_context->strict_generator_function_map()->SetConstructor( |
| 3088 *generator_function_function); | 3078 *generator_function_function); |
| 3089 } | 3079 } |
| 3090 | 3080 |
| 3091 { // -- F i x e d A r r a y I t e r a t o r | |
| 3092 int size = JSFixedArrayIterator::kHeaderSize + | |
| 3093 JSFixedArrayIterator::kInObjectPropertyCount * kPointerSize; | |
| 3094 Handle<Map> map = factory->NewMap(JS_FIXED_ARRAY_ITERATOR_TYPE, size); | |
| 3095 Map::SetPrototype(map, iterator_prototype); | |
| 3096 Map::EnsureDescriptorSlack(map, | |
| 3097 JSFixedArrayIterator::kInObjectPropertyCount); | |
| 3098 map->SetInObjectProperties(JSFixedArrayIterator::kInObjectPropertyCount); | |
| 3099 map->SetConstructor(native_context->object_function()); | |
| 3100 | |
| 3101 { // next | |
| 3102 DataDescriptor d(factory->next_string(), JSFixedArrayIterator::kNextIndex, | |
| 3103 DONT_ENUM, Representation::Tagged()); | |
| 3104 map->AppendDescriptor(&d); | |
| 3105 } | |
| 3106 | |
| 3107 native_context->set_fixed_array_iterator_map(*map); | |
| 3108 } | |
| 3109 | |
| 3110 { // -- S e t I t e r a t o r | 3081 { // -- S e t I t e r a t o r |
| 3111 Handle<JSObject> set_iterator_prototype = | 3082 Handle<JSObject> set_iterator_prototype = |
| 3112 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); | 3083 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); |
| 3113 JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype); | 3084 JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype); |
| 3114 Handle<JSFunction> set_iterator_function = InstallFunction( | 3085 Handle<JSFunction> set_iterator_function = InstallFunction( |
| 3115 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, | 3086 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, |
| 3116 set_iterator_prototype, Builtins::kIllegal); | 3087 set_iterator_prototype, Builtins::kIllegal); |
| 3117 native_context->set_set_iterator_map(set_iterator_function->initial_map()); | 3088 native_context->set_set_iterator_map(set_iterator_function->initial_map()); |
| 3118 } | 3089 } |
| 3119 | 3090 |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4684 } | 4655 } |
| 4685 | 4656 |
| 4686 | 4657 |
| 4687 // Called when the top-level V8 mutex is destroyed. | 4658 // Called when the top-level V8 mutex is destroyed. |
| 4688 void Bootstrapper::FreeThreadResources() { | 4659 void Bootstrapper::FreeThreadResources() { |
| 4689 DCHECK(!IsActive()); | 4660 DCHECK(!IsActive()); |
| 4690 } | 4661 } |
| 4691 | 4662 |
| 4692 } // namespace internal | 4663 } // namespace internal |
| 4693 } // namespace v8 | 4664 } // namespace v8 |
| OLD | NEW |