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 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 JSFunction::EnsureHasInitialMap(function); | 2762 JSFunction::EnsureHasInitialMap(function); |
2763 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 2763 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
2764 function->shared()->set_construct_stub( | 2764 function->shared()->set_construct_stub( |
2765 *isolate()->builtins()->JSBuiltinsConstructStub()); | 2765 *isolate()->builtins()->JSBuiltinsConstructStub()); |
2766 InstallWithIntrinsicDefaultProto(isolate(), function, | 2766 InstallWithIntrinsicDefaultProto(isolate(), function, |
2767 Context::PROMISE_FUNCTION_INDEX); | 2767 Context::PROMISE_FUNCTION_INDEX); |
2768 } | 2768 } |
2769 | 2769 |
2770 InstallBuiltinFunctionIds(); | 2770 InstallBuiltinFunctionIds(); |
2771 | 2771 |
| 2772 // Also install builtin function ids to some generator object methods. These |
| 2773 // three methods use the three resume operations (Runtime_GeneratorNext, |
| 2774 // Runtime_GeneratorReturn, Runtime_GeneratorThrow) respectively. Those |
| 2775 // operations are not supported by Crankshaft, TurboFan, nor Ignition. |
| 2776 { |
| 2777 Handle<JSObject> generator_object_prototype(JSObject::cast( |
| 2778 native_context()->generator_object_prototype_map()->prototype())); |
| 2779 |
| 2780 { // GeneratorObject.prototype.next |
| 2781 Handle<String> key = factory()->next_string(); |
| 2782 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2783 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2784 .ToHandleChecked()); |
| 2785 function->shared()->set_builtin_function_id(kGeneratorObjectNext); |
| 2786 } |
| 2787 { // GeneratorObject.prototype.return |
| 2788 Handle<String> key = factory()->NewStringFromAsciiChecked("return"); |
| 2789 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2790 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2791 .ToHandleChecked()); |
| 2792 function->shared()->set_builtin_function_id(kGeneratorObjectReturn); |
| 2793 } |
| 2794 { // GeneratorObject.prototype.throw |
| 2795 Handle<String> key = factory()->throw_string(); |
| 2796 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2797 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2798 .ToHandleChecked()); |
| 2799 function->shared()->set_builtin_function_id(kGeneratorObjectThrow); |
| 2800 } |
| 2801 } |
| 2802 |
2772 // Create a map for accessor property descriptors (a variant of JSObject | 2803 // Create a map for accessor property descriptors (a variant of JSObject |
2773 // that predefines four properties get, set, configurable and enumerable). | 2804 // that predefines four properties get, set, configurable and enumerable). |
2774 { | 2805 { |
2775 // AccessorPropertyDescriptor initial map. | 2806 // AccessorPropertyDescriptor initial map. |
2776 Handle<Map> map = | 2807 Handle<Map> map = |
2777 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); | 2808 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); |
2778 // Create the descriptor array for the property descriptor object. | 2809 // Create the descriptor array for the property descriptor object. |
2779 Map::EnsureDescriptorSlack(map, 4); | 2810 Map::EnsureDescriptorSlack(map, 4); |
2780 | 2811 |
2781 { // get | 2812 { // get |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 } | 3685 } |
3655 | 3686 |
3656 | 3687 |
3657 // Called when the top-level V8 mutex is destroyed. | 3688 // Called when the top-level V8 mutex is destroyed. |
3658 void Bootstrapper::FreeThreadResources() { | 3689 void Bootstrapper::FreeThreadResources() { |
3659 DCHECK(!IsActive()); | 3690 DCHECK(!IsActive()); |
3660 } | 3691 } |
3661 | 3692 |
3662 } // namespace internal | 3693 } // namespace internal |
3663 } // namespace v8 | 3694 } // namespace v8 |
OLD | NEW |