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 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3590 { | 3590 { |
3591 Handle<String> key = factory()->Promise_string(); | 3591 Handle<String> key = factory()->Promise_string(); |
3592 Handle<JSFunction> function = Handle<JSFunction>::cast( | 3592 Handle<JSFunction> function = Handle<JSFunction>::cast( |
3593 JSReceiver::GetProperty(global_object, key).ToHandleChecked()); | 3593 JSReceiver::GetProperty(global_object, key).ToHandleChecked()); |
3594 JSFunction::EnsureHasInitialMap(function); | 3594 JSFunction::EnsureHasInitialMap(function); |
3595 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 3595 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
3596 function->shared()->SetConstructStub( | 3596 function->shared()->SetConstructStub( |
3597 *isolate()->builtins()->JSBuiltinsConstructStub()); | 3597 *isolate()->builtins()->JSBuiltinsConstructStub()); |
3598 InstallWithIntrinsicDefaultProto(isolate(), function, | 3598 InstallWithIntrinsicDefaultProto(isolate(), function, |
3599 Context::PROMISE_FUNCTION_INDEX); | 3599 Context::PROMISE_FUNCTION_INDEX); |
| 3600 |
| 3601 { |
| 3602 Handle<Code> code = handle( |
| 3603 isolate()->builtins()->builtin(Builtins::kPromiseResolveClosure), |
| 3604 isolate()); |
| 3605 Handle<SharedFunctionInfo> info = |
| 3606 isolate()->factory()->NewSharedFunctionInfo(factory()->empty_string(), |
| 3607 code, false); |
| 3608 info->set_internal_formal_parameter_count(1); |
| 3609 info->set_length(1); |
| 3610 native_context()->set_promise_resolve_shared_fun(*info); |
| 3611 |
| 3612 code = handle( |
| 3613 isolate()->builtins()->builtin(Builtins::kPromiseRejectClosure), |
| 3614 isolate()); |
| 3615 info = isolate()->factory()->NewSharedFunctionInfo( |
| 3616 factory()->empty_string(), code, false); |
| 3617 info->set_internal_formal_parameter_count(2); |
| 3618 info->set_length(1); |
| 3619 native_context()->set_promise_reject_shared_fun(*info); |
| 3620 } |
| 3621 |
| 3622 Handle<JSFunction> create_resolving_functions = |
| 3623 SimpleCreateFunction(isolate(), factory()->empty_string(), |
| 3624 Builtins::kCreateResolvingFunctions, 2, false); |
| 3625 native_context()->set_create_resolving_functions( |
| 3626 *create_resolving_functions); |
3600 } | 3627 } |
3601 | 3628 |
3602 InstallBuiltinFunctionIds(); | 3629 InstallBuiltinFunctionIds(); |
3603 | 3630 |
3604 // Create a map for accessor property descriptors (a variant of JSObject | 3631 // Create a map for accessor property descriptors (a variant of JSObject |
3605 // that predefines four properties get, set, configurable and enumerable). | 3632 // that predefines four properties get, set, configurable and enumerable). |
3606 { | 3633 { |
3607 // AccessorPropertyDescriptor initial map. | 3634 // AccessorPropertyDescriptor initial map. |
3608 Handle<Map> map = | 3635 Handle<Map> map = |
3609 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); | 3636 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4540 } | 4567 } |
4541 | 4568 |
4542 | 4569 |
4543 // Called when the top-level V8 mutex is destroyed. | 4570 // Called when the top-level V8 mutex is destroyed. |
4544 void Bootstrapper::FreeThreadResources() { | 4571 void Bootstrapper::FreeThreadResources() { |
4545 DCHECK(!IsActive()); | 4572 DCHECK(!IsActive()); |
4546 } | 4573 } |
4547 | 4574 |
4548 } // namespace internal | 4575 } // namespace internal |
4549 } // namespace v8 | 4576 } // namespace v8 |
OLD | NEW |