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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Depending on the situation, expose and/or get rid of the utils object. | 203 // Depending on the situation, expose and/or get rid of the utils object. |
204 void ConfigureUtilsObject(GlobalContextType context_type); | 204 void ConfigureUtilsObject(GlobalContextType context_type); |
205 | 205 |
206 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 206 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
207 void InitializeGlobal_##id(); | 207 void InitializeGlobal_##id(); |
208 | 208 |
209 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 209 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
210 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 210 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
211 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 211 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
212 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") | 212 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") |
| 213 #ifdef V8_I18N_SUPPORT |
213 DECLARE_FEATURE_INITIALIZATION(intl_extra, "") | 214 DECLARE_FEATURE_INITIALIZATION(intl_extra, "") |
| 215 #endif |
214 #undef DECLARE_FEATURE_INITIALIZATION | 216 #undef DECLARE_FEATURE_INITIALIZATION |
215 | 217 |
216 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 218 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
217 const char* name, Builtins::Name call, | 219 const char* name, Builtins::Name call, |
218 BuiltinFunctionId id); | 220 BuiltinFunctionId id); |
219 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 221 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
220 const char* name, | 222 const char* name, |
221 ElementsKind elements_kind); | 223 ElementsKind elements_kind); |
222 bool InstallNatives(GlobalContextType context_type); | 224 bool InstallNatives(GlobalContextType context_type); |
223 | 225 |
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 } | 2173 } |
2172 | 2174 |
2173 | 2175 |
2174 void Genesis::InitializeExperimentalGlobal() { | 2176 void Genesis::InitializeExperimentalGlobal() { |
2175 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 2177 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
2176 | 2178 |
2177 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 2179 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
2178 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 2180 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
2179 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 2181 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
2180 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") | 2182 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") |
| 2183 #ifdef V8_I18N_SUPPORT |
2181 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") | 2184 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") |
| 2185 #endif |
2182 #undef FEATURE_INITIALIZE_GLOBAL | 2186 #undef FEATURE_INITIALIZE_GLOBAL |
2183 } | 2187 } |
2184 | 2188 |
2185 | 2189 |
2186 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 2190 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
2187 Vector<const char> name = Natives::GetScriptName(index); | 2191 Vector<const char> name = Natives::GetScriptName(index); |
2188 Handle<String> source_code = | 2192 Handle<String> source_code = |
2189 isolate->bootstrapper()->SourceLookup<Natives>(index); | 2193 isolate->bootstrapper()->SourceLookup<Natives>(index); |
2190 | 2194 |
2191 // We pass in extras_utils so that builtin code can set it up for later use | 2195 // We pass in extras_utils so that builtin code can set it up for later use |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); | 2737 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); |
2734 } | 2738 } |
2735 } | 2739 } |
2736 } | 2740 } |
2737 | 2741 |
2738 | 2742 |
2739 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, | 2743 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, |
2740 Handle<JSObject> container) { | 2744 Handle<JSObject> container) { |
2741 HandleScope scope(isolate); | 2745 HandleScope scope(isolate); |
2742 | 2746 |
| 2747 #ifdef V8_I18N_SUPPORT |
2743 #define INITIALIZE_FLAG(FLAG) \ | 2748 #define INITIALIZE_FLAG(FLAG) \ |
2744 { \ | 2749 { \ |
2745 Handle<String> name = \ | 2750 Handle<String> name = \ |
2746 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ | 2751 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
2747 JSObject::AddProperty(container, name, \ | 2752 JSObject::AddProperty(container, name, \ |
2748 isolate->factory()->ToBoolean(FLAG), NONE); \ | 2753 isolate->factory()->ToBoolean(FLAG), NONE); \ |
2749 } | 2754 } |
2750 | 2755 |
2751 INITIALIZE_FLAG(FLAG_intl_extra) | 2756 INITIALIZE_FLAG(FLAG_intl_extra) |
2752 | 2757 |
2753 #undef INITIALIZE_FLAG | 2758 #undef INITIALIZE_FLAG |
| 2759 #endif |
2754 } | 2760 } |
2755 | 2761 |
2756 | 2762 |
2757 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 2763 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
2758 void Genesis::InitializeGlobal_##id() {} | 2764 void Genesis::InitializeGlobal_##id() {} |
2759 | 2765 |
2760 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2766 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
2761 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) | 2767 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) |
2762 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2768 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
2763 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) | 2769 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) |
2764 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) | 2770 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
2765 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2771 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
2766 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) | 2772 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
2767 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) | |
2768 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) | 2773 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) |
2769 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2774 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
2770 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) | 2775 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) |
2771 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) | 2776 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) |
2772 #ifdef V8_I18N_SUPPORT | 2777 #ifdef V8_I18N_SUPPORT |
| 2778 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) |
2773 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) | 2779 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) |
| 2780 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) |
2774 #endif | 2781 #endif |
2775 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) | 2782 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) |
2776 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) | 2783 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) |
2777 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) | 2784 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) |
2778 | 2785 |
2779 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2786 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
2780 const char* name, Handle<Symbol> value) { | 2787 const char* name, Handle<Symbol> value) { |
2781 Handle<JSGlobalObject> global( | 2788 Handle<JSGlobalObject> global( |
2782 JSGlobalObject::cast(native_context->global_object())); | 2789 JSGlobalObject::cast(native_context->global_object())); |
2783 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2790 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 nullptr}; | 3353 nullptr}; |
3347 static const char* harmony_do_expressions_natives[] = {nullptr}; | 3354 static const char* harmony_do_expressions_natives[] = {nullptr}; |
3348 static const char* harmony_for_in_natives[] = {nullptr}; | 3355 static const char* harmony_for_in_natives[] = {nullptr}; |
3349 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 3356 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
3350 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; | 3357 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; |
3351 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; | 3358 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; |
3352 static const char* harmony_regexp_property_natives[] = {nullptr}; | 3359 static const char* harmony_regexp_property_natives[] = {nullptr}; |
3353 static const char* harmony_function_sent_natives[] = {nullptr}; | 3360 static const char* harmony_function_sent_natives[] = {nullptr}; |
3354 static const char* promise_extra_natives[] = {"native promise-extra.js", | 3361 static const char* promise_extra_natives[] = {"native promise-extra.js", |
3355 nullptr}; | 3362 nullptr}; |
3356 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; | |
3357 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 3363 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
3358 static const char* harmony_object_own_property_descriptors_natives[] = { | 3364 static const char* harmony_object_own_property_descriptors_natives[] = { |
3359 nullptr}; | 3365 nullptr}; |
3360 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 3366 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
3361 static const char* harmony_string_padding_natives[] = { | 3367 static const char* harmony_string_padding_natives[] = { |
3362 "native harmony-string-padding.js", nullptr}; | 3368 "native harmony-string-padding.js", nullptr}; |
3363 #ifdef V8_I18N_SUPPORT | 3369 #ifdef V8_I18N_SUPPORT |
3364 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", | 3370 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", |
3365 nullptr}; | 3371 nullptr}; |
| 3372 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; |
| 3373 static const char* datetime_format_to_parts_natives[] = { |
| 3374 "native datetime-format-to-parts.js", nullptr}; |
3366 #endif | 3375 #endif |
3367 static const char* harmony_async_await_natives[] = { | 3376 static const char* harmony_async_await_natives[] = { |
3368 "native harmony-async-await.js", nullptr}; | 3377 "native harmony-async-await.js", nullptr}; |
3369 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | 3378 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
3370 static const char* harmony_trailing_commas_natives[] = {nullptr}; | 3379 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
3371 | 3380 |
3372 for (int i = ExperimentalNatives::GetDebuggerCount(); | 3381 for (int i = ExperimentalNatives::GetDebuggerCount(); |
3373 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 3382 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
3374 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 3383 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
3375 if (FLAG_##id) { \ | 3384 if (FLAG_##id) { \ |
3376 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 3385 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
3377 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 3386 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
3378 if (strncmp(script_name.start(), id##_natives[j], \ | 3387 if (strncmp(script_name.start(), id##_natives[j], \ |
3379 script_name.length()) == 0) { \ | 3388 script_name.length()) == 0) { \ |
3380 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 3389 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
3381 return false; \ | 3390 return false; \ |
3382 } \ | 3391 } \ |
3383 } \ | 3392 } \ |
3384 } \ | 3393 } \ |
3385 } | 3394 } |
3386 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 3395 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
3387 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 3396 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
3388 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 3397 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 3398 #ifdef V8_I18N_SUPPORT |
3389 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); | 3399 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); |
| 3400 #endif |
3390 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); | 3401 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); |
3391 #undef INSTALL_EXPERIMENTAL_NATIVES | 3402 #undef INSTALL_EXPERIMENTAL_NATIVES |
3392 } | 3403 } |
3393 | 3404 |
3394 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 3405 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
3395 | 3406 |
3396 InstallExperimentalBuiltinFunctionIds(); | 3407 InstallExperimentalBuiltinFunctionIds(); |
3397 return true; | 3408 return true; |
3398 } | 3409 } |
3399 | 3410 |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 } | 4111 } |
4101 | 4112 |
4102 | 4113 |
4103 // Called when the top-level V8 mutex is destroyed. | 4114 // Called when the top-level V8 mutex is destroyed. |
4104 void Bootstrapper::FreeThreadResources() { | 4115 void Bootstrapper::FreeThreadResources() { |
4105 DCHECK(!IsActive()); | 4116 DCHECK(!IsActive()); |
4106 } | 4117 } |
4107 | 4118 |
4108 } // namespace internal | 4119 } // namespace internal |
4109 } // namespace v8 | 4120 } // namespace v8 |
OLD | NEW |