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 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2738 JSFunction::EnsureHasInitialMap(function); | 2738 JSFunction::EnsureHasInitialMap(function); |
2739 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 2739 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
2740 function->shared()->set_construct_stub( | 2740 function->shared()->set_construct_stub( |
2741 *isolate()->builtins()->JSBuiltinsConstructStub()); | 2741 *isolate()->builtins()->JSBuiltinsConstructStub()); |
2742 InstallWithIntrinsicDefaultProto(isolate(), function, | 2742 InstallWithIntrinsicDefaultProto(isolate(), function, |
2743 Context::PROMISE_FUNCTION_INDEX); | 2743 Context::PROMISE_FUNCTION_INDEX); |
2744 } | 2744 } |
2745 | 2745 |
2746 InstallBuiltinFunctionIds(); | 2746 InstallBuiltinFunctionIds(); |
2747 | 2747 |
| 2748 // Also install builtin function ids to some generator object methods. These |
| 2749 // three methods use the three resume operations (Runtime_GeneratorNext, |
| 2750 // Runtime_GeneratorReturn, Runtime_GeneratorThrow) respectively. Those |
| 2751 // operations are not supported by Crankshaft, TurboFan, nor Ignition. |
| 2752 { |
| 2753 Handle<JSObject> generator_object_prototype(JSObject::cast( |
| 2754 native_context()->generator_object_prototype_map()->prototype())); |
| 2755 |
| 2756 { // GeneratorObject.prototype.next |
| 2757 Handle<String> key = factory()->next_string(); |
| 2758 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2759 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2760 .ToHandleChecked()); |
| 2761 function->shared()->set_builtin_function_id(kGeneratorObjectNext); |
| 2762 } |
| 2763 { // GeneratorObject.prototype.return |
| 2764 Handle<String> key = factory()->NewStringFromAsciiChecked("return"); |
| 2765 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2766 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2767 .ToHandleChecked()); |
| 2768 function->shared()->set_builtin_function_id(kGeneratorObjectReturn); |
| 2769 } |
| 2770 { // GeneratorObject.prototype.throw |
| 2771 Handle<String> key = factory()->throw_string(); |
| 2772 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2773 JSReceiver::GetProperty(generator_object_prototype, key) |
| 2774 .ToHandleChecked()); |
| 2775 function->shared()->set_builtin_function_id(kGeneratorObjectThrow); |
| 2776 } |
| 2777 } |
| 2778 |
2748 // Create a map for accessor property descriptors (a variant of JSObject | 2779 // Create a map for accessor property descriptors (a variant of JSObject |
2749 // that predefines four properties get, set, configurable and enumerable). | 2780 // that predefines four properties get, set, configurable and enumerable). |
2750 { | 2781 { |
2751 // AccessorPropertyDescriptor initial map. | 2782 // AccessorPropertyDescriptor initial map. |
2752 Handle<Map> map = | 2783 Handle<Map> map = |
2753 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); | 2784 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); |
2754 // Create the descriptor array for the property descriptor object. | 2785 // Create the descriptor array for the property descriptor object. |
2755 Map::EnsureDescriptorSlack(map, 4); | 2786 Map::EnsureDescriptorSlack(map, 4); |
2756 | 2787 |
2757 { // get | 2788 { // get |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 } | 3661 } |
3631 | 3662 |
3632 | 3663 |
3633 // Called when the top-level V8 mutex is destroyed. | 3664 // Called when the top-level V8 mutex is destroyed. |
3634 void Bootstrapper::FreeThreadResources() { | 3665 void Bootstrapper::FreeThreadResources() { |
3635 DCHECK(!IsActive()); | 3666 DCHECK(!IsActive()); |
3636 } | 3667 } |
3637 | 3668 |
3638 } // namespace internal | 3669 } // namespace internal |
3639 } // namespace v8 | 3670 } // namespace v8 |
OLD | NEW |