| 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 | |
| 214 DECLARE_FEATURE_INITIALIZATION(intl_extra, "") | |
| 215 #endif | |
| 216 #undef DECLARE_FEATURE_INITIALIZATION | 213 #undef DECLARE_FEATURE_INITIALIZATION |
| 217 | 214 |
| 218 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 215 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
| 219 const char* name, Builtins::Name call, | 216 const char* name, Builtins::Name call, |
| 220 BuiltinFunctionId id); | 217 BuiltinFunctionId id); |
| 221 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 218 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
| 222 const char* name, | 219 const char* name, |
| 223 ElementsKind elements_kind); | 220 ElementsKind elements_kind); |
| 224 bool InstallNatives(GlobalContextType context_type); | 221 bool InstallNatives(GlobalContextType context_type); |
| 225 | 222 |
| (...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 *fun = result; | 2214 *fun = result; |
| 2218 } | 2215 } |
| 2219 | 2216 |
| 2220 | 2217 |
| 2221 void Genesis::InitializeExperimentalGlobal() { | 2218 void Genesis::InitializeExperimentalGlobal() { |
| 2222 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 2219 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 2223 | 2220 |
| 2224 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 2221 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 2225 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 2222 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 2226 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 2223 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 2227 #ifdef V8_I18N_SUPPORT | |
| 2228 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") | |
| 2229 #endif | |
| 2230 #undef FEATURE_INITIALIZE_GLOBAL | 2224 #undef FEATURE_INITIALIZE_GLOBAL |
| 2231 } | 2225 } |
| 2232 | 2226 |
| 2233 | 2227 |
| 2234 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 2228 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
| 2235 Vector<const char> name = Natives::GetScriptName(index); | 2229 Vector<const char> name = Natives::GetScriptName(index); |
| 2236 Handle<String> source_code = | 2230 Handle<String> source_code = |
| 2237 isolate->bootstrapper()->SourceLookup<Natives>(index); | 2231 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 2238 | 2232 |
| 2239 // We pass in extras_utils so that builtin code can set it up for later use | 2233 // We pass in extras_utils so that builtin code can set it up for later use |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2790 | 2784 |
| 2791 #ifdef V8_I18N_SUPPORT | 2785 #ifdef V8_I18N_SUPPORT |
| 2792 #define INITIALIZE_FLAG(FLAG) \ | 2786 #define INITIALIZE_FLAG(FLAG) \ |
| 2793 { \ | 2787 { \ |
| 2794 Handle<String> name = \ | 2788 Handle<String> name = \ |
| 2795 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ | 2789 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
| 2796 JSObject::AddProperty(container, name, \ | 2790 JSObject::AddProperty(container, name, \ |
| 2797 isolate->factory()->ToBoolean(FLAG), NONE); \ | 2791 isolate->factory()->ToBoolean(FLAG), NONE); \ |
| 2798 } | 2792 } |
| 2799 | 2793 |
| 2800 INITIALIZE_FLAG(FLAG_intl_extra) | |
| 2801 | |
| 2802 #undef INITIALIZE_FLAG | 2794 #undef INITIALIZE_FLAG |
| 2803 #endif | 2795 #endif |
| 2804 } | 2796 } |
| 2805 | 2797 |
| 2806 | 2798 |
| 2807 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 2799 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
| 2808 void Genesis::InitializeGlobal_##id() {} | 2800 void Genesis::InitializeGlobal_##id() {} |
| 2809 | 2801 |
| 2810 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2802 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
| 2811 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) | 2803 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) |
| 2812 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2804 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
| 2813 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) | 2805 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) |
| 2814 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) | 2806 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
| 2815 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2807 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
| 2816 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) | 2808 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) |
| 2817 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2809 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
| 2818 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) | 2810 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) |
| 2819 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) | 2811 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) |
| 2820 #ifdef V8_I18N_SUPPORT | 2812 #ifdef V8_I18N_SUPPORT |
| 2821 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) | 2813 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) |
| 2822 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) | 2814 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) |
| 2823 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) | |
| 2824 #endif | 2815 #endif |
| 2825 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) | 2816 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) |
| 2826 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) | 2817 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) |
| 2827 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) | 2818 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) |
| 2828 | 2819 |
| 2829 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2820 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
| 2830 const char* name, Handle<Symbol> value) { | 2821 const char* name, Handle<Symbol> value) { |
| 2831 Handle<JSGlobalObject> global( | 2822 Handle<JSGlobalObject> global( |
| 2832 JSGlobalObject::cast(native_context->global_object())); | 2823 JSGlobalObject::cast(native_context->global_object())); |
| 2833 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2824 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3411 static const char* harmony_function_sent_natives[] = {nullptr}; | 3402 static const char* harmony_function_sent_natives[] = {nullptr}; |
| 3412 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 3403 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
| 3413 static const char* harmony_object_own_property_descriptors_natives[] = { | 3404 static const char* harmony_object_own_property_descriptors_natives[] = { |
| 3414 nullptr}; | 3405 nullptr}; |
| 3415 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 3406 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
| 3416 static const char* harmony_string_padding_natives[] = { | 3407 static const char* harmony_string_padding_natives[] = { |
| 3417 "native harmony-string-padding.js", nullptr}; | 3408 "native harmony-string-padding.js", nullptr}; |
| 3418 #ifdef V8_I18N_SUPPORT | 3409 #ifdef V8_I18N_SUPPORT |
| 3419 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", | 3410 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", |
| 3420 nullptr}; | 3411 nullptr}; |
| 3421 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; | |
| 3422 static const char* datetime_format_to_parts_natives[] = { | 3412 static const char* datetime_format_to_parts_natives[] = { |
| 3423 "native datetime-format-to-parts.js", nullptr}; | 3413 "native datetime-format-to-parts.js", nullptr}; |
| 3424 #endif | 3414 #endif |
| 3425 static const char* harmony_async_await_natives[] = { | 3415 static const char* harmony_async_await_natives[] = { |
| 3426 "native harmony-async-await.js", nullptr}; | 3416 "native harmony-async-await.js", nullptr}; |
| 3427 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | 3417 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
| 3428 static const char* harmony_trailing_commas_natives[] = {nullptr}; | 3418 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
| 3429 | 3419 |
| 3430 for (int i = ExperimentalNatives::GetDebuggerCount(); | 3420 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 3431 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 3421 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 3432 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 3422 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 3433 if (FLAG_##id) { \ | 3423 if (FLAG_##id) { \ |
| 3434 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 3424 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 3435 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 3425 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 3436 if (strncmp(script_name.start(), id##_natives[j], \ | 3426 if (strncmp(script_name.start(), id##_natives[j], \ |
| 3437 script_name.length()) == 0) { \ | 3427 script_name.length()) == 0) { \ |
| 3438 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 3428 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| 3439 return false; \ | 3429 return false; \ |
| 3440 } \ | 3430 } \ |
| 3441 } \ | 3431 } \ |
| 3442 } \ | 3432 } \ |
| 3443 } | 3433 } |
| 3444 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 3434 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
| 3445 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 3435 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
| 3446 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 3436 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 3447 #ifdef V8_I18N_SUPPORT | |
| 3448 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); | |
| 3449 #endif | |
| 3450 #undef INSTALL_EXPERIMENTAL_NATIVES | 3437 #undef INSTALL_EXPERIMENTAL_NATIVES |
| 3451 } | 3438 } |
| 3452 | 3439 |
| 3453 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 3440 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
| 3454 | 3441 |
| 3455 InstallExperimentalBuiltinFunctionIds(); | 3442 InstallExperimentalBuiltinFunctionIds(); |
| 3456 return true; | 3443 return true; |
| 3457 } | 3444 } |
| 3458 | 3445 |
| 3459 | 3446 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4157 } | 4144 } |
| 4158 | 4145 |
| 4159 | 4146 |
| 4160 // Called when the top-level V8 mutex is destroyed. | 4147 // Called when the top-level V8 mutex is destroyed. |
| 4161 void Bootstrapper::FreeThreadResources() { | 4148 void Bootstrapper::FreeThreadResources() { |
| 4162 DCHECK(!IsActive()); | 4149 DCHECK(!IsActive()); |
| 4163 } | 4150 } |
| 4164 | 4151 |
| 4165 } // namespace internal | 4152 } // namespace internal |
| 4166 } // namespace v8 | 4153 } // namespace v8 |
| OLD | NEW |