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 void InitializeExperimentalGlobal(); | 203 void InitializeExperimentalGlobal(); |
204 // Depending on the situation, expose and/or get rid of the utils object. | 204 // Depending on the situation, expose and/or get rid of the utils object. |
205 void ConfigureUtilsObject(GlobalContextType context_type); | 205 void ConfigureUtilsObject(GlobalContextType context_type); |
206 | 206 |
207 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 207 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
208 void InitializeGlobal_##id(); | 208 void InitializeGlobal_##id(); |
209 | 209 |
210 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 210 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
211 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 211 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
212 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 212 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
| 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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 *fun = result; | 2204 *fun = result; |
2203 } | 2205 } |
2204 | 2206 |
2205 | 2207 |
2206 void Genesis::InitializeExperimentalGlobal() { | 2208 void Genesis::InitializeExperimentalGlobal() { |
2207 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 2209 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
2208 | 2210 |
2209 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 2211 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
2210 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 2212 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
2211 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 2213 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 2214 #ifdef V8_I18N_SUPPORT |
2212 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") | 2215 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") |
| 2216 #endif |
2213 #undef FEATURE_INITIALIZE_GLOBAL | 2217 #undef FEATURE_INITIALIZE_GLOBAL |
2214 } | 2218 } |
2215 | 2219 |
2216 | 2220 |
2217 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 2221 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
2218 Vector<const char> name = Natives::GetScriptName(index); | 2222 Vector<const char> name = Natives::GetScriptName(index); |
2219 Handle<String> source_code = | 2223 Handle<String> source_code = |
2220 isolate->bootstrapper()->SourceLookup<Natives>(index); | 2224 isolate->bootstrapper()->SourceLookup<Natives>(index); |
2221 | 2225 |
2222 // We pass in extras_utils so that builtin code can set it up for later use | 2226 // 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... |
2764 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); | 2768 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); |
2765 } | 2769 } |
2766 } | 2770 } |
2767 } | 2771 } |
2768 | 2772 |
2769 | 2773 |
2770 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, | 2774 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, |
2771 Handle<JSObject> container) { | 2775 Handle<JSObject> container) { |
2772 HandleScope scope(isolate); | 2776 HandleScope scope(isolate); |
2773 | 2777 |
| 2778 #ifdef V8_I18N_SUPPORT |
2774 #define INITIALIZE_FLAG(FLAG) \ | 2779 #define INITIALIZE_FLAG(FLAG) \ |
2775 { \ | 2780 { \ |
2776 Handle<String> name = \ | 2781 Handle<String> name = \ |
2777 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ | 2782 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
2778 JSObject::AddProperty(container, name, \ | 2783 JSObject::AddProperty(container, name, \ |
2779 isolate->factory()->ToBoolean(FLAG), NONE); \ | 2784 isolate->factory()->ToBoolean(FLAG), NONE); \ |
2780 } | 2785 } |
2781 | 2786 |
2782 INITIALIZE_FLAG(FLAG_intl_extra) | 2787 INITIALIZE_FLAG(FLAG_intl_extra) |
2783 | 2788 |
2784 #undef INITIALIZE_FLAG | 2789 #undef INITIALIZE_FLAG |
| 2790 #endif |
2785 } | 2791 } |
2786 | 2792 |
2787 | 2793 |
2788 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 2794 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
2789 void Genesis::InitializeGlobal_##id() {} | 2795 void Genesis::InitializeGlobal_##id() {} |
2790 | 2796 |
2791 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2797 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
2792 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) | 2798 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) |
2793 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2799 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
2794 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) | 2800 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) |
2795 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) | 2801 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
2796 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2802 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
2797 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) | |
2798 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) | 2803 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) |
2799 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2804 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
2800 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) | 2805 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) |
2801 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) | 2806 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) |
2802 #ifdef V8_I18N_SUPPORT | 2807 #ifdef V8_I18N_SUPPORT |
| 2808 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) |
2803 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) | 2809 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) |
| 2810 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) |
2804 #endif | 2811 #endif |
2805 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) | 2812 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) |
2806 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) | 2813 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) |
2807 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) | 2814 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) |
2808 | 2815 |
2809 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2816 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
2810 const char* name, Handle<Symbol> value) { | 2817 const char* name, Handle<Symbol> value) { |
2811 Handle<JSGlobalObject> global( | 2818 Handle<JSGlobalObject> global( |
2812 JSGlobalObject::cast(native_context->global_object())); | 2819 JSGlobalObject::cast(native_context->global_object())); |
2813 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2820 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 "native harmony-atomics.js", NULL}; | 3381 "native harmony-atomics.js", NULL}; |
3375 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 3382 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
3376 nullptr}; | 3383 nullptr}; |
3377 static const char* harmony_do_expressions_natives[] = {nullptr}; | 3384 static const char* harmony_do_expressions_natives[] = {nullptr}; |
3378 static const char* harmony_for_in_natives[] = {nullptr}; | 3385 static const char* harmony_for_in_natives[] = {nullptr}; |
3379 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 3386 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
3380 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; | 3387 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; |
3381 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; | 3388 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; |
3382 static const char* harmony_regexp_property_natives[] = {nullptr}; | 3389 static const char* harmony_regexp_property_natives[] = {nullptr}; |
3383 static const char* harmony_function_sent_natives[] = {nullptr}; | 3390 static const char* harmony_function_sent_natives[] = {nullptr}; |
3384 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; | |
3385 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 3391 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
3386 static const char* harmony_object_own_property_descriptors_natives[] = { | 3392 static const char* harmony_object_own_property_descriptors_natives[] = { |
3387 nullptr}; | 3393 nullptr}; |
3388 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 3394 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
3389 static const char* harmony_string_padding_natives[] = { | 3395 static const char* harmony_string_padding_natives[] = { |
3390 "native harmony-string-padding.js", nullptr}; | 3396 "native harmony-string-padding.js", nullptr}; |
3391 #ifdef V8_I18N_SUPPORT | 3397 #ifdef V8_I18N_SUPPORT |
3392 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", | 3398 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", |
3393 nullptr}; | 3399 nullptr}; |
| 3400 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; |
| 3401 static const char* datetime_format_to_parts_natives[] = { |
| 3402 "native datetime-format-to-parts.js", nullptr}; |
3394 #endif | 3403 #endif |
3395 static const char* harmony_async_await_natives[] = { | 3404 static const char* harmony_async_await_natives[] = { |
3396 "native harmony-async-await.js", nullptr}; | 3405 "native harmony-async-await.js", nullptr}; |
3397 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | 3406 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
3398 static const char* harmony_trailing_commas_natives[] = {nullptr}; | 3407 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
3399 | 3408 |
3400 for (int i = ExperimentalNatives::GetDebuggerCount(); | 3409 for (int i = ExperimentalNatives::GetDebuggerCount(); |
3401 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 3410 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
3402 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 3411 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
3403 if (FLAG_##id) { \ | 3412 if (FLAG_##id) { \ |
3404 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 3413 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
3405 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 3414 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
3406 if (strncmp(script_name.start(), id##_natives[j], \ | 3415 if (strncmp(script_name.start(), id##_natives[j], \ |
3407 script_name.length()) == 0) { \ | 3416 script_name.length()) == 0) { \ |
3408 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 3417 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
3409 return false; \ | 3418 return false; \ |
3410 } \ | 3419 } \ |
3411 } \ | 3420 } \ |
3412 } \ | 3421 } \ |
3413 } | 3422 } |
3414 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 3423 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
3415 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 3424 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
3416 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 3425 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 3426 #ifdef V8_I18N_SUPPORT |
3417 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); | 3427 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); |
| 3428 #endif |
3418 #undef INSTALL_EXPERIMENTAL_NATIVES | 3429 #undef INSTALL_EXPERIMENTAL_NATIVES |
3419 } | 3430 } |
3420 | 3431 |
3421 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 3432 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
3422 | 3433 |
3423 InstallExperimentalBuiltinFunctionIds(); | 3434 InstallExperimentalBuiltinFunctionIds(); |
3424 return true; | 3435 return true; |
3425 } | 3436 } |
3426 | 3437 |
3427 | 3438 |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4125 } | 4136 } |
4126 | 4137 |
4127 | 4138 |
4128 // Called when the top-level V8 mutex is destroyed. | 4139 // Called when the top-level V8 mutex is destroyed. |
4129 void Bootstrapper::FreeThreadResources() { | 4140 void Bootstrapper::FreeThreadResources() { |
4130 DCHECK(!IsActive()); | 4141 DCHECK(!IsActive()); |
4131 } | 4142 } |
4132 | 4143 |
4133 } // namespace internal | 4144 } // namespace internal |
4134 } // namespace v8 | 4145 } // namespace v8 |
OLD | NEW |