Chromium Code Reviews| 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<String> name = isolate()->factory()->InternalizeUtf8String(""); | |
|
adamk
2016/11/08 18:09:54
You can use factory()->empty_string()
gsathya
2016/11/08 20:03:18
Done.
| |
| 3603 Handle<Code> code = handle( | |
| 3604 isolate()->builtins()->builtin(Builtins::kPromiseResolveClosure), | |
| 3605 isolate()); | |
| 3606 Handle<SharedFunctionInfo> info = | |
| 3607 isolate()->factory()->NewSharedFunctionInfo(name, code, false); | |
| 3608 info->set_internal_formal_parameter_count(1); | |
| 3609 info->set_length(1); | |
| 3610 native_context()->set_promise_resolve_shared_fun(*info); | |
|
adamk
2016/11/08 18:09:54
Why are we storing these per context? Could we ins
| |
| 3611 | |
| 3612 name = isolate()->factory()->InternalizeUtf8String(""); | |
| 3613 code = handle( | |
| 3614 isolate()->builtins()->builtin(Builtins::kPromiseRejectClosure), | |
| 3615 isolate()); | |
| 3616 info = isolate()->factory()->NewSharedFunctionInfo(name, 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 = SimpleCreateFunction( | |
| 3623 isolate(), | |
| 3624 factory()->InternalizeUtf8String("create_resolving_functions"), | |
| 3625 Builtins::kCreateResolvingFunctions, 2, false); | |
| 3626 native_context()->set_create_resolving_functions( | |
| 3627 *create_resolving_functions); | |
| 3600 } | 3628 } |
| 3601 | 3629 |
| 3602 InstallBuiltinFunctionIds(); | 3630 InstallBuiltinFunctionIds(); |
| 3603 | 3631 |
| 3604 // Create a map for accessor property descriptors (a variant of JSObject | 3632 // Create a map for accessor property descriptors (a variant of JSObject |
| 3605 // that predefines four properties get, set, configurable and enumerable). | 3633 // that predefines four properties get, set, configurable and enumerable). |
| 3606 { | 3634 { |
| 3607 // AccessorPropertyDescriptor initial map. | 3635 // AccessorPropertyDescriptor initial map. |
| 3608 Handle<Map> map = | 3636 Handle<Map> map = |
| 3609 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); | 3637 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4540 } | 4568 } |
| 4541 | 4569 |
| 4542 | 4570 |
| 4543 // Called when the top-level V8 mutex is destroyed. | 4571 // Called when the top-level V8 mutex is destroyed. |
| 4544 void Bootstrapper::FreeThreadResources() { | 4572 void Bootstrapper::FreeThreadResources() { |
| 4545 DCHECK(!IsActive()); | 4573 DCHECK(!IsActive()); |
| 4546 } | 4574 } |
| 4547 | 4575 |
| 4548 } // namespace internal | 4576 } // namespace internal |
| 4549 } // namespace v8 | 4577 } // namespace v8 |
| OLD | NEW |