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