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