| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void InitializeExperimentalGlobal(); | 195 void InitializeExperimentalGlobal(); |
| 196 // Depending on the situation, expose and/or get rid of the utils object. | 196 // Depending on the situation, expose and/or get rid of the utils object. |
| 197 void ConfigureUtilsObject(ContextType context_type); | 197 void ConfigureUtilsObject(ContextType context_type); |
| 198 | 198 |
| 199 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 199 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
| 200 void InitializeGlobal_##id(); | 200 void InitializeGlobal_##id(); |
| 201 | 201 |
| 202 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 202 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
| 203 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 203 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
| 204 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 204 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
| 205 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") |
| 205 #undef DECLARE_FEATURE_INITIALIZATION | 206 #undef DECLARE_FEATURE_INITIALIZATION |
| 206 | 207 |
| 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(ContextType context_type); | 211 bool InstallNatives(ContextType context_type); |
| 211 | 212 |
| 212 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 213 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
| 213 Handle<JSFunction>* fun); | 214 Handle<JSFunction>* fun); |
| 214 bool InstallExperimentalNatives(); | 215 bool InstallExperimentalNatives(); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 *fun = result; | 1582 *fun = result; |
| 1582 } | 1583 } |
| 1583 | 1584 |
| 1584 | 1585 |
| 1585 void Genesis::InitializeExperimentalGlobal() { | 1586 void Genesis::InitializeExperimentalGlobal() { |
| 1586 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1587 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 1587 | 1588 |
| 1588 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1589 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 1589 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1590 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 1590 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1591 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 1592 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") |
| 1591 #undef FEATURE_INITIALIZE_GLOBAL | 1593 #undef FEATURE_INITIALIZE_GLOBAL |
| 1592 } | 1594 } |
| 1593 | 1595 |
| 1594 | 1596 |
| 1595 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 1597 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
| 1596 Vector<const char> name = Natives::GetScriptName(index); | 1598 Vector<const char> name = Natives::GetScriptName(index); |
| 1597 Handle<String> source_code = | 1599 Handle<String> source_code = |
| 1598 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1600 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 1599 | 1601 |
| 1600 // We pass in extras_utils so that builtin code can set it up for later use | 1602 // We pass in extras_utils so that builtin code can set it up for later use |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) | 2094 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) |
| 2093 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) | 2095 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) |
| 2094 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) | 2096 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) |
| 2095 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) | 2097 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) |
| 2096 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) | 2098 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) |
| 2097 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) | 2099 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) |
| 2098 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) | 2100 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) |
| 2099 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) | 2101 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) |
| 2100 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2102 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
| 2101 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2103 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
| 2104 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
| 2102 | 2105 |
| 2103 | 2106 |
| 2104 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2107 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
| 2105 const char* name, Handle<Symbol> value) { | 2108 const char* name, Handle<Symbol> value) { |
| 2106 Handle<JSGlobalObject> global( | 2109 Handle<JSGlobalObject> global( |
| 2107 JSGlobalObject::cast(native_context->global_object())); | 2110 JSGlobalObject::cast(native_context->global_object())); |
| 2108 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2111 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
| 2109 Handle<JSObject> symbol = Handle<JSObject>::cast( | 2112 Handle<JSObject> symbol = Handle<JSObject>::cast( |
| 2110 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); | 2113 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); |
| 2111 Handle<String> name_string = factory->InternalizeUtf8String(name); | 2114 Handle<String> name_string = factory->InternalizeUtf8String(name); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 static const char* harmony_sharedarraybuffer_natives[] = { | 2631 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2629 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 2632 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; |
| 2630 static const char* harmony_concat_spreadable_natives[] = {nullptr}; | 2633 static const char* harmony_concat_spreadable_natives[] = {nullptr}; |
| 2631 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 2634 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2632 nullptr}; | 2635 nullptr}; |
| 2633 static const char* harmony_tolength_natives[] = {nullptr}; | 2636 static const char* harmony_tolength_natives[] = {nullptr}; |
| 2634 static const char* harmony_completion_natives[] = {nullptr}; | 2637 static const char* harmony_completion_natives[] = {nullptr}; |
| 2635 static const char* harmony_do_expressions_natives[] = {nullptr}; | 2638 static const char* harmony_do_expressions_natives[] = {nullptr}; |
| 2636 static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 2639 static const char* harmony_regexp_subclass_natives[] = {nullptr}; |
| 2637 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 2640 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
| 2641 static const char* promise_extra_natives[] = {"native promise-extra.js", |
| 2642 nullptr}; |
| 2638 | 2643 |
| 2639 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2644 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2640 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2645 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2641 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2646 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2642 if (FLAG_##id) { \ | 2647 if (FLAG_##id) { \ |
| 2643 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2648 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2644 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2649 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2645 if (strncmp(script_name.start(), id##_natives[j], \ | 2650 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2646 script_name.length()) == 0) { \ | 2651 script_name.length()) == 0) { \ |
| 2647 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 2652 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| 2648 return false; \ | 2653 return false; \ |
| 2649 } \ | 2654 } \ |
| 2650 } \ | 2655 } \ |
| 2651 } \ | 2656 } \ |
| 2652 } | 2657 } |
| 2653 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 2658 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
| 2654 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 2659 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
| 2655 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 2660 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 2661 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); |
| 2656 #undef INSTALL_EXPERIMENTAL_NATIVES | 2662 #undef INSTALL_EXPERIMENTAL_NATIVES |
| 2657 } | 2663 } |
| 2658 | 2664 |
| 2659 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 2665 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
| 2660 | 2666 |
| 2661 InstallExperimentalBuiltinFunctionIds(); | 2667 InstallExperimentalBuiltinFunctionIds(); |
| 2662 return true; | 2668 return true; |
| 2663 } | 2669 } |
| 2664 | 2670 |
| 2665 | 2671 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3304 } | 3310 } |
| 3305 | 3311 |
| 3306 | 3312 |
| 3307 // Called when the top-level V8 mutex is destroyed. | 3313 // Called when the top-level V8 mutex is destroyed. |
| 3308 void Bootstrapper::FreeThreadResources() { | 3314 void Bootstrapper::FreeThreadResources() { |
| 3309 DCHECK(!IsActive()); | 3315 DCHECK(!IsActive()); |
| 3310 } | 3316 } |
| 3311 | 3317 |
| 3312 } // namespace internal | 3318 } // namespace internal |
| 3313 } // namespace v8 | 3319 } // namespace v8 |
| OLD | NEW |