| 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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 *fun = result; | 1579 *fun = result; |
| 1579 } | 1580 } |
| 1580 | 1581 |
| 1581 | 1582 |
| 1582 void Genesis::InitializeExperimentalGlobal() { | 1583 void Genesis::InitializeExperimentalGlobal() { |
| 1583 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1584 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 1584 | 1585 |
| 1585 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1586 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 1586 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1587 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 1587 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1588 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 1589 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") |
| 1588 #undef FEATURE_INITIALIZE_GLOBAL | 1590 #undef FEATURE_INITIALIZE_GLOBAL |
| 1589 } | 1591 } |
| 1590 | 1592 |
| 1591 | 1593 |
| 1592 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 1594 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
| 1593 Vector<const char> name = Natives::GetScriptName(index); | 1595 Vector<const char> name = Natives::GetScriptName(index); |
| 1594 Handle<String> source_code = | 1596 Handle<String> source_code = |
| 1595 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1597 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 1596 | 1598 |
| 1597 // We pass in extras_utils so that builtin code can set it up for later use | 1599 // We pass in extras_utils so that builtin code can set it up for later use |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) | 2084 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) |
| 2083 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) | 2085 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) |
| 2084 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) | 2086 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) |
| 2085 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) | 2087 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) |
| 2086 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) | 2088 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) |
| 2087 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) | 2089 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) |
| 2088 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) | 2090 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) |
| 2089 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) | 2091 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) |
| 2090 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2092 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
| 2091 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2093 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
| 2094 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
| 2092 | 2095 |
| 2093 | 2096 |
| 2094 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2097 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
| 2095 const char* name, Handle<Symbol> value) { | 2098 const char* name, Handle<Symbol> value) { |
| 2096 Handle<JSGlobalObject> global( | 2099 Handle<JSGlobalObject> global( |
| 2097 JSGlobalObject::cast(native_context->global_object())); | 2100 JSGlobalObject::cast(native_context->global_object())); |
| 2098 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2101 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
| 2099 Handle<JSObject> symbol = Handle<JSObject>::cast( | 2102 Handle<JSObject> symbol = Handle<JSObject>::cast( |
| 2100 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); | 2103 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); |
| 2101 Handle<String> name_string = factory->InternalizeUtf8String(name); | 2104 Handle<String> name_string = factory->InternalizeUtf8String(name); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2616 static const char* harmony_sharedarraybuffer_natives[] = { | 2619 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2617 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 2620 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; |
| 2618 static const char* harmony_concat_spreadable_natives[] = {nullptr}; | 2621 static const char* harmony_concat_spreadable_natives[] = {nullptr}; |
| 2619 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 2622 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2620 nullptr}; | 2623 nullptr}; |
| 2621 static const char* harmony_tolength_natives[] = {nullptr}; | 2624 static const char* harmony_tolength_natives[] = {nullptr}; |
| 2622 static const char* harmony_completion_natives[] = {nullptr}; | 2625 static const char* harmony_completion_natives[] = {nullptr}; |
| 2623 static const char* harmony_do_expressions_natives[] = {nullptr}; | 2626 static const char* harmony_do_expressions_natives[] = {nullptr}; |
| 2624 static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 2627 static const char* harmony_regexp_subclass_natives[] = {nullptr}; |
| 2625 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 2628 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
| 2629 static const char* promise_extra_natives[] = {"native promise-extra.js", |
| 2630 nullptr}; |
| 2626 | 2631 |
| 2627 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2632 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2628 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2633 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2629 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2634 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2630 if (FLAG_##id) { \ | 2635 if (FLAG_##id) { \ |
| 2631 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2636 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2632 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2637 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2633 if (strncmp(script_name.start(), id##_natives[j], \ | 2638 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2634 script_name.length()) == 0) { \ | 2639 script_name.length()) == 0) { \ |
| 2635 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 2640 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| 2636 return false; \ | 2641 return false; \ |
| 2637 } \ | 2642 } \ |
| 2638 } \ | 2643 } \ |
| 2639 } \ | 2644 } \ |
| 2640 } | 2645 } |
| 2641 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 2646 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
| 2642 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 2647 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
| 2643 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 2648 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 2649 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); |
| 2644 #undef INSTALL_EXPERIMENTAL_NATIVES | 2650 #undef INSTALL_EXPERIMENTAL_NATIVES |
| 2645 } | 2651 } |
| 2646 | 2652 |
| 2647 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 2653 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
| 2648 | 2654 |
| 2649 InstallExperimentalBuiltinFunctionIds(); | 2655 InstallExperimentalBuiltinFunctionIds(); |
| 2650 return true; | 2656 return true; |
| 2651 } | 2657 } |
| 2652 | 2658 |
| 2653 | 2659 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3292 } | 3298 } |
| 3293 | 3299 |
| 3294 | 3300 |
| 3295 // Called when the top-level V8 mutex is destroyed. | 3301 // Called when the top-level V8 mutex is destroyed. |
| 3296 void Bootstrapper::FreeThreadResources() { | 3302 void Bootstrapper::FreeThreadResources() { |
| 3297 DCHECK(!IsActive()); | 3303 DCHECK(!IsActive()); |
| 3298 } | 3304 } |
| 3299 | 3305 |
| 3300 } // namespace internal | 3306 } // namespace internal |
| 3301 } // namespace v8 | 3307 } // namespace v8 |
| OLD | NEW |