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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 // Depending on the situation, expose and/or get rid of the utils object. | 193 // Depending on the situation, expose and/or get rid of the utils object. |
194 void ConfigureUtilsObject(GlobalContextType context_type); | 194 void ConfigureUtilsObject(GlobalContextType context_type); |
195 | 195 |
196 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 196 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
197 void InitializeGlobal_##id(); | 197 void InitializeGlobal_##id(); |
198 | 198 |
199 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 199 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
200 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 200 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
201 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 201 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
202 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") | 202 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") |
203 DECLARE_FEATURE_INITIALIZATION(icu_case_mapping, "") | |
Yang
2016/04/29 07:38:47
Is this necessary? We declare it here, call it bel
jungshik at Google
2016/04/29 18:03:23
Indeed. I dropped them all (decl, call, definition
Dan Ehrenberg
2016/05/03 17:58:17
promise_extra was special in this way. This should
| |
203 #undef DECLARE_FEATURE_INITIALIZATION | 204 #undef DECLARE_FEATURE_INITIALIZATION |
204 | 205 |
205 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 206 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
206 const char* name); | 207 const char* name); |
207 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 208 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
208 const char* name, | 209 const char* name, |
209 ElementsKind elements_kind); | 210 ElementsKind elements_kind); |
210 bool InstallNatives(GlobalContextType context_type); | 211 bool InstallNatives(GlobalContextType context_type); |
211 | 212 |
212 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 213 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1924 } | 1925 } |
1925 | 1926 |
1926 | 1927 |
1927 void Genesis::InitializeExperimentalGlobal() { | 1928 void Genesis::InitializeExperimentalGlobal() { |
1928 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1929 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1929 | 1930 |
1930 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1931 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
1931 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1932 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
1932 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1933 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
1933 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") | 1934 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") |
1935 FEATURE_INITIALIZE_GLOBAL(icu_case_mapping, "") | |
1934 #undef FEATURE_INITIALIZE_GLOBAL | 1936 #undef FEATURE_INITIALIZE_GLOBAL |
1935 } | 1937 } |
1936 | 1938 |
1937 | 1939 |
1938 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 1940 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
1939 Vector<const char> name = Natives::GetScriptName(index); | 1941 Vector<const char> name = Natives::GetScriptName(index); |
1940 Handle<String> source_code = | 1942 Handle<String> source_code = |
1941 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1943 isolate->bootstrapper()->SourceLookup<Natives>(index); |
1942 | 1944 |
1943 // We pass in extras_utils so that builtin code can set it up for later use | 1945 // We pass in extras_utils so that builtin code can set it up for later use |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2426 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) | 2428 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) |
2427 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) | 2429 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) |
2428 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2430 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
2429 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) | 2431 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
2430 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) | 2432 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls) |
2431 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2433 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
2432 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof) | 2434 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof) |
2433 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) | 2435 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_declarations) |
2434 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_exponentiation_operator) | 2436 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_exponentiation_operator) |
2435 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) | 2437 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_string_padding) |
2438 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) | |
2436 | 2439 |
2437 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2440 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
2438 const char* name, Handle<Symbol> value) { | 2441 const char* name, Handle<Symbol> value) { |
2439 Handle<JSGlobalObject> global( | 2442 Handle<JSGlobalObject> global( |
2440 JSGlobalObject::cast(native_context->global_object())); | 2443 JSGlobalObject::cast(native_context->global_object())); |
2441 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2444 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
2442 Handle<JSObject> symbol = Handle<JSObject>::cast( | 2445 Handle<JSObject> symbol = Handle<JSObject>::cast( |
2443 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); | 2446 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); |
2444 Handle<String> name_string = factory->InternalizeUtf8String(name); | 2447 Handle<String> name_string = factory->InternalizeUtf8String(name); |
2445 PropertyAttributes attributes = | 2448 PropertyAttributes attributes = |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2992 static const char* harmony_function_sent_natives[] = {nullptr}; | 2995 static const char* harmony_function_sent_natives[] = {nullptr}; |
2993 static const char* promise_extra_natives[] = {"native promise-extra.js", | 2996 static const char* promise_extra_natives[] = {"native promise-extra.js", |
2994 nullptr}; | 2997 nullptr}; |
2995 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 2998 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
2996 static const char* harmony_object_own_property_descriptors_natives[] = { | 2999 static const char* harmony_object_own_property_descriptors_natives[] = { |
2997 nullptr}; | 3000 nullptr}; |
2998 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | 3001 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
2999 static const char* harmony_exponentiation_operator_natives[] = {nullptr}; | 3002 static const char* harmony_exponentiation_operator_natives[] = {nullptr}; |
3000 static const char* harmony_string_padding_natives[] = { | 3003 static const char* harmony_string_padding_natives[] = { |
3001 "native harmony-string-padding.js", nullptr}; | 3004 "native harmony-string-padding.js", nullptr}; |
3005 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", | |
3006 nullptr}; | |
3002 | 3007 |
3003 for (int i = ExperimentalNatives::GetDebuggerCount(); | 3008 for (int i = ExperimentalNatives::GetDebuggerCount(); |
3004 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 3009 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
3005 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 3010 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
3006 if (FLAG_##id) { \ | 3011 if (FLAG_##id) { \ |
3007 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 3012 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
3008 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 3013 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
3009 if (strncmp(script_name.start(), id##_natives[j], \ | 3014 if (strncmp(script_name.start(), id##_natives[j], \ |
3010 script_name.length()) == 0) { \ | 3015 script_name.length()) == 0) { \ |
3011 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 3016 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
3012 return false; \ | 3017 return false; \ |
3013 } \ | 3018 } \ |
3014 } \ | 3019 } \ |
3015 } \ | 3020 } \ |
3016 } | 3021 } |
3017 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 3022 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
3018 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 3023 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
3019 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 3024 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
3020 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); | 3025 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); |
3026 INSTALL_EXPERIMENTAL_NATIVES(icu_case_mapping, ""); | |
3021 #undef INSTALL_EXPERIMENTAL_NATIVES | 3027 #undef INSTALL_EXPERIMENTAL_NATIVES |
3022 } | 3028 } |
3023 | 3029 |
3024 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 3030 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
3025 | 3031 |
3026 InstallExperimentalBuiltinFunctionIds(); | 3032 InstallExperimentalBuiltinFunctionIds(); |
3027 return true; | 3033 return true; |
3028 } | 3034 } |
3029 | 3035 |
3030 | 3036 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3665 } | 3671 } |
3666 | 3672 |
3667 | 3673 |
3668 // Called when the top-level V8 mutex is destroyed. | 3674 // Called when the top-level V8 mutex is destroyed. |
3669 void Bootstrapper::FreeThreadResources() { | 3675 void Bootstrapper::FreeThreadResources() { |
3670 DCHECK(!IsActive()); | 3676 DCHECK(!IsActive()); |
3671 } | 3677 } |
3672 | 3678 |
3673 } // namespace internal | 3679 } // namespace internal |
3674 } // namespace v8 | 3680 } // namespace v8 |
OLD | NEW |