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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2721 JSFunction::EnsureHasInitialMap(function); | 2721 JSFunction::EnsureHasInitialMap(function); |
2722 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 2722 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
2723 function->shared()->set_construct_stub( | 2723 function->shared()->set_construct_stub( |
2724 *isolate()->builtins()->JSBuiltinsConstructStub()); | 2724 *isolate()->builtins()->JSBuiltinsConstructStub()); |
2725 InstallWithIntrinsicDefaultProto(isolate(), function, | 2725 InstallWithIntrinsicDefaultProto(isolate(), function, |
2726 Context::PROMISE_FUNCTION_INDEX); | 2726 Context::PROMISE_FUNCTION_INDEX); |
2727 } | 2727 } |
2728 | 2728 |
2729 InstallBuiltinFunctionIds(); | 2729 InstallBuiltinFunctionIds(); |
2730 | 2730 |
| 2731 // Create a map for accessor property descriptors (a variant of JSObject |
| 2732 // that predefines four properties get, set, configurable and enumerable). |
| 2733 { |
| 2734 // AccessorPropertyDescriptor initial map. |
| 2735 Handle<Map> map = |
| 2736 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); |
| 2737 // Create the descriptor array for the property descriptor object. |
| 2738 Map::EnsureDescriptorSlack(map, 4); |
| 2739 |
| 2740 { // get |
| 2741 DataDescriptor d(factory()->get_string(), |
| 2742 JSAccessorPropertyDescriptor::kGetIndex, NONE, |
| 2743 Representation::Tagged()); |
| 2744 map->AppendDescriptor(&d); |
| 2745 } |
| 2746 { // set |
| 2747 DataDescriptor d(factory()->set_string(), |
| 2748 JSAccessorPropertyDescriptor::kSetIndex, NONE, |
| 2749 Representation::Tagged()); |
| 2750 map->AppendDescriptor(&d); |
| 2751 } |
| 2752 { // enumerable |
| 2753 DataDescriptor d(factory()->enumerable_string(), |
| 2754 JSAccessorPropertyDescriptor::kEnumerableIndex, NONE, |
| 2755 Representation::Tagged()); |
| 2756 map->AppendDescriptor(&d); |
| 2757 } |
| 2758 { // configurable |
| 2759 DataDescriptor d(factory()->configurable_string(), |
| 2760 JSAccessorPropertyDescriptor::kConfigurableIndex, NONE, |
| 2761 Representation::Tagged()); |
| 2762 map->AppendDescriptor(&d); |
| 2763 } |
| 2764 |
| 2765 Map::SetPrototype(map, isolate()->initial_object_prototype()); |
| 2766 map->SetInObjectProperties(4); |
| 2767 map->set_unused_property_fields(0); |
| 2768 |
| 2769 native_context()->set_accessor_property_descriptor_map(*map); |
| 2770 } |
| 2771 |
| 2772 // Create a map for data property descriptors (a variant of JSObject |
| 2773 // that predefines four properties value, writable, configurable and |
| 2774 // enumerable). |
| 2775 { |
| 2776 // DataPropertyDescriptor initial map. |
| 2777 Handle<Map> map = |
| 2778 factory()->NewMap(JS_OBJECT_TYPE, JSDataPropertyDescriptor::kSize); |
| 2779 // Create the descriptor array for the property descriptor object. |
| 2780 Map::EnsureDescriptorSlack(map, 4); |
| 2781 |
| 2782 { // value |
| 2783 DataDescriptor d(factory()->value_string(), |
| 2784 JSDataPropertyDescriptor::kValueIndex, NONE, |
| 2785 Representation::Tagged()); |
| 2786 map->AppendDescriptor(&d); |
| 2787 } |
| 2788 { // writable |
| 2789 DataDescriptor d(factory()->writable_string(), |
| 2790 JSDataPropertyDescriptor::kWritableIndex, NONE, |
| 2791 Representation::Tagged()); |
| 2792 map->AppendDescriptor(&d); |
| 2793 } |
| 2794 { // enumerable |
| 2795 DataDescriptor d(factory()->enumerable_string(), |
| 2796 JSDataPropertyDescriptor::kEnumerableIndex, NONE, |
| 2797 Representation::Tagged()); |
| 2798 map->AppendDescriptor(&d); |
| 2799 } |
| 2800 { // configurable |
| 2801 DataDescriptor d(factory()->configurable_string(), |
| 2802 JSDataPropertyDescriptor::kConfigurableIndex, NONE, |
| 2803 Representation::Tagged()); |
| 2804 map->AppendDescriptor(&d); |
| 2805 } |
| 2806 |
| 2807 Map::SetPrototype(map, isolate()->initial_object_prototype()); |
| 2808 map->SetInObjectProperties(4); |
| 2809 map->set_unused_property_fields(0); |
| 2810 |
| 2811 native_context()->set_data_property_descriptor_map(*map); |
| 2812 } |
| 2813 |
2731 // Create a constructor for RegExp results (a variant of Array that | 2814 // Create a constructor for RegExp results (a variant of Array that |
2732 // predefines the two properties index and match). | 2815 // predefines the two properties index and match). |
2733 { | 2816 { |
2734 // RegExpResult initial map. | 2817 // RegExpResult initial map. |
2735 | 2818 |
2736 // Find global.Array.prototype to inherit from. | 2819 // Find global.Array.prototype to inherit from. |
2737 Handle<JSFunction> array_constructor(native_context()->array_function()); | 2820 Handle<JSFunction> array_constructor(native_context()->array_function()); |
2738 Handle<JSObject> array_prototype( | 2821 Handle<JSObject> array_prototype( |
2739 JSObject::cast(array_constructor->instance_prototype())); | 2822 JSObject::cast(array_constructor->instance_prototype())); |
2740 | 2823 |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3523 } | 3606 } |
3524 | 3607 |
3525 | 3608 |
3526 // Called when the top-level V8 mutex is destroyed. | 3609 // Called when the top-level V8 mutex is destroyed. |
3527 void Bootstrapper::FreeThreadResources() { | 3610 void Bootstrapper::FreeThreadResources() { |
3528 DCHECK(!IsActive()); | 3611 DCHECK(!IsActive()); |
3529 } | 3612 } |
3530 | 3613 |
3531 } // namespace internal | 3614 } // namespace internal |
3532 } // namespace v8 | 3615 } // namespace v8 |
OLD | NEW |