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 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 NONE); | 3612 NONE); |
3613 } | 3613 } |
3614 | 3614 |
3615 void Genesis::InitializeGlobal_harmony_async_iteration() { | 3615 void Genesis::InitializeGlobal_harmony_async_iteration() { |
3616 if (!FLAG_harmony_async_iteration) return; | 3616 if (!FLAG_harmony_async_iteration) return; |
3617 Handle<JSFunction> symbol_fun(native_context()->symbol_function()); | 3617 Handle<JSFunction> symbol_fun(native_context()->symbol_function()); |
3618 InstallConstant(isolate(), symbol_fun, "asyncIterator", | 3618 InstallConstant(isolate(), symbol_fun, "asyncIterator", |
3619 factory()->async_iterator_symbol()); | 3619 factory()->async_iterator_symbol()); |
3620 } | 3620 } |
3621 | 3621 |
| 3622 void Genesis::InitializeGlobal_harmony_promise_finally() { |
| 3623 if (!FLAG_harmony_promise_finally) return; |
| 3624 |
| 3625 Handle<JSFunction> constructor(native_context()->promise_function()); |
| 3626 Handle<JSObject> prototype(JSObject::cast(constructor->instance_prototype())); |
| 3627 SimpleInstallFunction(prototype, "finally", Builtins::kPromiseFinally, 1, |
| 3628 true, DONT_ENUM); |
| 3629 |
| 3630 // The promise prototype map has changed because we added a property |
| 3631 // to prototype, so we update the saved map. |
| 3632 Handle<Map> prototype_map(prototype->map()); |
| 3633 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate()); |
| 3634 native_context()->set_promise_prototype_map(*prototype_map); |
| 3635 |
| 3636 { |
| 3637 Handle<Code> code = |
| 3638 handle(isolate()->builtins()->builtin(Builtins::kPromiseThenFinally), |
| 3639 isolate()); |
| 3640 Handle<SharedFunctionInfo> info = factory()->NewSharedFunctionInfo( |
| 3641 factory()->empty_string(), code, false); |
| 3642 info->set_internal_formal_parameter_count(1); |
| 3643 info->set_length(1); |
| 3644 info->set_native(true); |
| 3645 native_context()->set_promise_then_finally_shared_fun(*info); |
| 3646 } |
| 3647 |
| 3648 { |
| 3649 Handle<Code> code = |
| 3650 handle(isolate()->builtins()->builtin(Builtins::kPromiseCatchFinally), |
| 3651 isolate()); |
| 3652 Handle<SharedFunctionInfo> info = factory()->NewSharedFunctionInfo( |
| 3653 factory()->empty_string(), code, false); |
| 3654 info->set_internal_formal_parameter_count(1); |
| 3655 info->set_length(1); |
| 3656 info->set_native(true); |
| 3657 native_context()->set_promise_catch_finally_shared_fun(*info); |
| 3658 } |
| 3659 |
| 3660 { |
| 3661 Handle<Code> code = handle( |
| 3662 isolate()->builtins()->builtin(Builtins::kPromiseValueThunkFinally), |
| 3663 isolate()); |
| 3664 Handle<SharedFunctionInfo> info = factory()->NewSharedFunctionInfo( |
| 3665 factory()->empty_string(), code, false); |
| 3666 info->set_internal_formal_parameter_count(0); |
| 3667 info->set_length(0); |
| 3668 native_context()->set_promise_value_thunk_finally_shared_fun(*info); |
| 3669 } |
| 3670 |
| 3671 { |
| 3672 Handle<Code> code = |
| 3673 handle(isolate()->builtins()->builtin(Builtins::kPromiseThrowerFinally), |
| 3674 isolate()); |
| 3675 Handle<SharedFunctionInfo> info = factory()->NewSharedFunctionInfo( |
| 3676 factory()->empty_string(), code, false); |
| 3677 info->set_internal_formal_parameter_count(0); |
| 3678 info->set_length(0); |
| 3679 native_context()->set_promise_thrower_finally_shared_fun(*info); |
| 3680 } |
| 3681 } |
| 3682 |
3622 #ifdef V8_I18N_SUPPORT | 3683 #ifdef V8_I18N_SUPPORT |
3623 void Genesis::InitializeGlobal_datetime_format_to_parts() { | 3684 void Genesis::InitializeGlobal_datetime_format_to_parts() { |
3624 if (!FLAG_datetime_format_to_parts) return; | 3685 if (!FLAG_datetime_format_to_parts) return; |
3625 Handle<JSReceiver> exports_container( | 3686 Handle<JSReceiver> exports_container( |
3626 JSReceiver::cast(native_context()->exports_container())); | 3687 JSReceiver::cast(native_context()->exports_container())); |
3627 Handle<JSObject> date_time_format_prototype(JSObject::cast( | 3688 Handle<JSObject> date_time_format_prototype(JSObject::cast( |
3628 native_context()->intl_date_time_format_function()->prototype())); | 3689 native_context()->intl_date_time_format_function()->prototype())); |
3629 Handle<JSFunction> format_date_to_parts = Handle<JSFunction>::cast( | 3690 Handle<JSFunction> format_date_to_parts = Handle<JSFunction>::cast( |
3630 JSReceiver::GetProperty( | 3691 JSReceiver::GetProperty( |
3631 exports_container, | 3692 exports_container, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4146 static const char* icu_case_mapping_natives[] = {nullptr}; | 4207 static const char* icu_case_mapping_natives[] = {nullptr}; |
4147 static const char* datetime_format_to_parts_natives[] = {nullptr}; | 4208 static const char* datetime_format_to_parts_natives[] = {nullptr}; |
4148 #endif | 4209 #endif |
4149 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | 4210 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
4150 static const char* harmony_trailing_commas_natives[] = {nullptr}; | 4211 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
4151 static const char* harmony_function_tostring_natives[] = {nullptr}; | 4212 static const char* harmony_function_tostring_natives[] = {nullptr}; |
4152 static const char* harmony_class_fields_natives[] = {nullptr}; | 4213 static const char* harmony_class_fields_natives[] = {nullptr}; |
4153 static const char* harmony_object_rest_spread_natives[] = {nullptr}; | 4214 static const char* harmony_object_rest_spread_natives[] = {nullptr}; |
4154 static const char* harmony_async_iteration_natives[] = {nullptr}; | 4215 static const char* harmony_async_iteration_natives[] = {nullptr}; |
4155 static const char* harmony_dynamic_import_natives[] = {nullptr}; | 4216 static const char* harmony_dynamic_import_natives[] = {nullptr}; |
| 4217 static const char* harmony_promise_finally_natives[] = {nullptr}; |
4156 | 4218 |
4157 for (int i = ExperimentalNatives::GetDebuggerCount(); | 4219 for (int i = ExperimentalNatives::GetDebuggerCount(); |
4158 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 4220 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
4159 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 4221 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
4160 if (FLAG_##id) { \ | 4222 if (FLAG_##id) { \ |
4161 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 4223 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
4162 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 4224 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
4163 if (strncmp(script_name.start(), id##_natives[j], \ | 4225 if (strncmp(script_name.start(), id##_natives[j], \ |
4164 script_name.length()) == 0) { \ | 4226 script_name.length()) == 0) { \ |
4165 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 4227 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4901 } | 4963 } |
4902 | 4964 |
4903 | 4965 |
4904 // Called when the top-level V8 mutex is destroyed. | 4966 // Called when the top-level V8 mutex is destroyed. |
4905 void Bootstrapper::FreeThreadResources() { | 4967 void Bootstrapper::FreeThreadResources() { |
4906 DCHECK(!IsActive()); | 4968 DCHECK(!IsActive()); |
4907 } | 4969 } |
4908 | 4970 |
4909 } // namespace internal | 4971 } // namespace internal |
4910 } // namespace v8 | 4972 } // namespace v8 |
OLD | NEW |