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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Depending on the situation, expose and/or get rid of the utils object. | 198 // Depending on the situation, expose and/or get rid of the utils object. |
199 void ConfigureUtilsObject(GlobalContextType context_type); | 199 void ConfigureUtilsObject(GlobalContextType context_type); |
200 | 200 |
201 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 201 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
202 void InitializeGlobal_##id(); | 202 void InitializeGlobal_##id(); |
203 | 203 |
204 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 204 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
205 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 205 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
206 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 206 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
207 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") | 207 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") |
| 208 DECLARE_FEATURE_INITIALIZATION(intl_extra, "") |
208 #undef DECLARE_FEATURE_INITIALIZATION | 209 #undef DECLARE_FEATURE_INITIALIZATION |
209 | 210 |
210 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 211 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
211 const char* name); | 212 const char* name); |
212 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 213 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
213 const char* name, | 214 const char* name, |
214 ElementsKind elements_kind); | 215 ElementsKind elements_kind); |
215 bool InstallNatives(GlobalContextType context_type); | 216 bool InstallNatives(GlobalContextType context_type); |
216 | 217 |
217 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 218 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 } | 1970 } |
1970 | 1971 |
1971 | 1972 |
1972 void Genesis::InitializeExperimentalGlobal() { | 1973 void Genesis::InitializeExperimentalGlobal() { |
1973 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1974 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1974 | 1975 |
1975 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1976 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
1976 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1977 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
1977 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1978 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
1978 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") | 1979 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") |
| 1980 FEATURE_INITIALIZE_GLOBAL(intl_extra, "") |
1979 #undef FEATURE_INITIALIZE_GLOBAL | 1981 #undef FEATURE_INITIALIZE_GLOBAL |
1980 } | 1982 } |
1981 | 1983 |
1982 | 1984 |
1983 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 1985 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
1984 Vector<const char> name = Natives::GetScriptName(index); | 1986 Vector<const char> name = Natives::GetScriptName(index); |
1985 Handle<String> source_code = | 1987 Handle<String> source_code = |
1986 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1988 isolate->bootstrapper()->SourceLookup<Natives>(index); |
1987 | 1989 |
1988 // We pass in extras_utils so that builtin code can set it up for later use | 1990 // We pass in extras_utils so that builtin code can set it up for later use |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 | 2449 |
2448 #define INITIALIZE_FLAG(FLAG) \ | 2450 #define INITIALIZE_FLAG(FLAG) \ |
2449 { \ | 2451 { \ |
2450 Handle<String> name = \ | 2452 Handle<String> name = \ |
2451 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ | 2453 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
2452 JSObject::AddProperty(container, name, \ | 2454 JSObject::AddProperty(container, name, \ |
2453 isolate->factory()->ToBoolean(FLAG), NONE); \ | 2455 isolate->factory()->ToBoolean(FLAG), NONE); \ |
2454 } | 2456 } |
2455 | 2457 |
2456 INITIALIZE_FLAG(FLAG_harmony_species) | 2458 INITIALIZE_FLAG(FLAG_harmony_species) |
| 2459 INITIALIZE_FLAG(FLAG_intl_extra) |
2457 | 2460 |
2458 #undef INITIALIZE_FLAG | 2461 #undef INITIALIZE_FLAG |
2459 } | 2462 } |
2460 | 2463 |
2461 | 2464 |
2462 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 2465 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
2463 void Genesis::InitializeGlobal_##id() {} | 2466 void Genesis::InitializeGlobal_##id() {} |
2464 | 2467 |
2465 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) | 2468 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) |
2466 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2469 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
2467 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) | 2470 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_for_in) |
2468 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_iterator_close) | 2471 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_iterator_close) |
2469 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_exec) | 2472 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_exec) |
2470 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2473 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
2471 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) | 2474 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
2472 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) | 2475 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) |
2473 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2476 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
2474 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) | 2477 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
| 2478 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra) |
2475 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) | 2479 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) |
2476 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2480 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
2477 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof) | 2481 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof) |
2478 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) | 2482 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) |
2479 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_exponentiation_operator) | 2483 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_exponentiation_operator) |
2480 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) | 2484 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) |
2481 | 2485 |
2482 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2486 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
2483 const char* name, Handle<Symbol> value) { | 2487 const char* name, Handle<Symbol> value) { |
2484 Handle<JSGlobalObject> global( | 2488 Handle<JSGlobalObject> global( |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3032 "native harmony-regexp-exec.js", nullptr}; | 3036 "native harmony-regexp-exec.js", nullptr}; |
3033 static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 3037 static const char* harmony_regexp_subclass_natives[] = {nullptr}; |
3034 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 3038 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
3035 static const char* harmony_instanceof_natives[] = {nullptr}; | 3039 static const char* harmony_instanceof_natives[] = {nullptr}; |
3036 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; | 3040 static const char* harmony_restrictive_declarations_natives[] = {nullptr}; |
3037 static const char* harmony_regexp_property_natives[] = {nullptr}; | 3041 static const char* harmony_regexp_property_natives[] = {nullptr}; |
3038 static const char* harmony_function_name_natives[] = {nullptr}; | 3042 static const char* harmony_function_name_natives[] = {nullptr}; |
3039 static const char* harmony_function_sent_natives[] = {nullptr}; | 3043 static const char* harmony_function_sent_natives[] = {nullptr}; |
3040 static const char* promise_extra_natives[] = {"native promise-extra.js", | 3044 static const char* promise_extra_natives[] = {"native promise-extra.js", |
3041 nullptr}; | 3045 nullptr}; |
| 3046 static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr}; |
3042 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 3047 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
3043 static const char* harmony_object_own_property_descriptors_natives[] = { | 3048 static const char* harmony_object_own_property_descriptors_natives[] = { |
3044 nullptr}; | 3049 nullptr}; |
3045 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 3050 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
3046 static const char* harmony_exponentiation_operator_natives[] = {nullptr}; | 3051 static const char* harmony_exponentiation_operator_natives[] = {nullptr}; |
3047 static const char* harmony_string_padding_natives[] = { | 3052 static const char* harmony_string_padding_natives[] = { |
3048 "native harmony-string-padding.js", nullptr}; | 3053 "native harmony-string-padding.js", nullptr}; |
3049 | 3054 |
3050 for (int i = ExperimentalNatives::GetDebuggerCount(); | 3055 for (int i = ExperimentalNatives::GetDebuggerCount(); |
3051 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 3056 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
3052 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 3057 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
3053 if (FLAG_##id) { \ | 3058 if (FLAG_##id) { \ |
3054 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 3059 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
3055 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 3060 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
3056 if (strncmp(script_name.start(), id##_natives[j], \ | 3061 if (strncmp(script_name.start(), id##_natives[j], \ |
3057 script_name.length()) == 0) { \ | 3062 script_name.length()) == 0) { \ |
3058 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 3063 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
3059 return false; \ | 3064 return false; \ |
3060 } \ | 3065 } \ |
3061 } \ | 3066 } \ |
3062 } \ | 3067 } \ |
3063 } | 3068 } |
3064 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 3069 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
3065 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 3070 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
3066 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 3071 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 3072 INSTALL_EXPERIMENTAL_NATIVES(intl_extra, ""); |
3067 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); | 3073 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); |
3068 #undef INSTALL_EXPERIMENTAL_NATIVES | 3074 #undef INSTALL_EXPERIMENTAL_NATIVES |
3069 } | 3075 } |
3070 | 3076 |
3071 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 3077 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
3072 | 3078 |
3073 InstallExperimentalBuiltinFunctionIds(); | 3079 InstallExperimentalBuiltinFunctionIds(); |
3074 return true; | 3080 return true; |
3075 } | 3081 } |
3076 | 3082 |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3715 } | 3721 } |
3716 | 3722 |
3717 | 3723 |
3718 // Called when the top-level V8 mutex is destroyed. | 3724 // Called when the top-level V8 mutex is destroyed. |
3719 void Bootstrapper::FreeThreadResources() { | 3725 void Bootstrapper::FreeThreadResources() { |
3720 DCHECK(!IsActive()); | 3726 DCHECK(!IsActive()); |
3721 } | 3727 } |
3722 | 3728 |
3723 } // namespace internal | 3729 } // namespace internal |
3724 } // namespace v8 | 3730 } // namespace v8 |
OLD | NEW |