| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 void InitializeExperimentalGlobal(); | 199 void InitializeExperimentalGlobal(); |
| 200 // Depending on the situation, expose and/or get rid of the utils object. | 200 // Depending on the situation, expose and/or get rid of the utils object. |
| 201 void ConfigureUtilsObject(ContextType context_type); | 201 void ConfigureUtilsObject(ContextType context_type); |
| 202 | 202 |
| 203 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 203 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
| 204 void InitializeGlobal_##id(); | 204 void InitializeGlobal_##id(); |
| 205 | 205 |
| 206 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 206 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
| 207 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 207 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
| 208 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 208 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
| 209 DECLARE_FEATURE_INITIALIZATION(promise_extra, "") | |
| 210 #undef DECLARE_FEATURE_INITIALIZATION | 209 #undef DECLARE_FEATURE_INITIALIZATION |
| 211 | 210 |
| 212 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 211 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
| 213 const char* name, | 212 const char* name, |
| 214 ElementsKind elements_kind); | 213 ElementsKind elements_kind); |
| 215 bool InstallNatives(ContextType context_type); | 214 bool InstallNatives(ContextType context_type); |
| 216 | 215 |
| 217 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 216 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
| 218 Handle<JSFunction>* fun); | 217 Handle<JSFunction>* fun); |
| 219 bool InstallExperimentalNatives(); | 218 bool InstallExperimentalNatives(); |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 *fun = result; | 1517 *fun = result; |
| 1519 } | 1518 } |
| 1520 | 1519 |
| 1521 | 1520 |
| 1522 void Genesis::InitializeExperimentalGlobal() { | 1521 void Genesis::InitializeExperimentalGlobal() { |
| 1523 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1522 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 1524 | 1523 |
| 1525 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1524 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 1526 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1525 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 1527 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 1526 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 1528 FEATURE_INITIALIZE_GLOBAL(promise_extra, "") | |
| 1529 #undef FEATURE_INITIALIZE_GLOBAL | 1527 #undef FEATURE_INITIALIZE_GLOBAL |
| 1530 } | 1528 } |
| 1531 | 1529 |
| 1532 | 1530 |
| 1533 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 1531 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
| 1534 Vector<const char> name = Natives::GetScriptName(index); | 1532 Vector<const char> name = Natives::GetScriptName(index); |
| 1535 Handle<String> source_code = | 1533 Handle<String> source_code = |
| 1536 isolate->bootstrapper()->SourceLookup<Natives>(index); | 1534 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 1537 | 1535 |
| 1538 // We pass in extras_utils so that builtin code can set it up for later use | 1536 // We pass in extras_utils so that builtin code can set it up for later use |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) | 2056 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) |
| 2059 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) | 2057 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) |
| 2060 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) | 2058 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) |
| 2061 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) | 2059 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) |
| 2062 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) | 2060 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) |
| 2063 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) | 2061 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) |
| 2064 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) | 2062 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) |
| 2065 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) | 2063 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) |
| 2066 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2064 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
| 2067 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2065 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
| 2068 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) | |
| 2069 | 2066 |
| 2070 | 2067 |
| 2071 static void SimpleInstallFunction(Handle<JSObject>& base, const char* name, | 2068 static void SimpleInstallFunction(Handle<JSObject>& base, const char* name, |
| 2072 Builtins::Name call, int len, bool adapt) { | 2069 Builtins::Name call, int len, bool adapt) { |
| 2073 Handle<JSFunction> fun = | 2070 Handle<JSFunction> fun = |
| 2074 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2071 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2075 MaybeHandle<JSObject>(), call); | 2072 MaybeHandle<JSObject>(), call); |
| 2076 if (adapt) { | 2073 if (adapt) { |
| 2077 fun->shared()->set_internal_formal_parameter_count(len); | 2074 fun->shared()->set_internal_formal_parameter_count(len); |
| 2078 } else { | 2075 } else { |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 static const char* harmony_sharedarraybuffer_natives[] = { | 2589 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2593 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 2590 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; |
| 2594 static const char* harmony_concat_spreadable_natives[] = {nullptr}; | 2591 static const char* harmony_concat_spreadable_natives[] = {nullptr}; |
| 2595 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 2592 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2596 nullptr}; | 2593 nullptr}; |
| 2597 static const char* harmony_tolength_natives[] = {nullptr}; | 2594 static const char* harmony_tolength_natives[] = {nullptr}; |
| 2598 static const char* harmony_completion_natives[] = {nullptr}; | 2595 static const char* harmony_completion_natives[] = {nullptr}; |
| 2599 static const char* harmony_do_expressions_natives[] = {nullptr}; | 2596 static const char* harmony_do_expressions_natives[] = {nullptr}; |
| 2600 static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 2597 static const char* harmony_regexp_subclass_natives[] = {nullptr}; |
| 2601 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 2598 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
| 2602 static const char* promise_extra_natives[] = {"native promise-extra.js", | |
| 2603 nullptr}; | |
| 2604 | 2599 |
| 2605 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2600 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2606 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2601 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2607 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2602 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2608 if (FLAG_##id) { \ | 2603 if (FLAG_##id) { \ |
| 2609 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2604 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2610 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2605 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2611 if (strncmp(script_name.start(), id##_natives[j], \ | 2606 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2612 script_name.length()) == 0) { \ | 2607 script_name.length()) == 0) { \ |
| 2613 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 2608 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| 2614 return false; \ | 2609 return false; \ |
| 2615 } \ | 2610 } \ |
| 2616 } \ | 2611 } \ |
| 2617 } \ | 2612 } \ |
| 2618 } | 2613 } |
| 2619 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 2614 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
| 2620 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 2615 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
| 2621 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | 2616 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 2622 INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); | |
| 2623 #undef INSTALL_EXPERIMENTAL_NATIVES | 2617 #undef INSTALL_EXPERIMENTAL_NATIVES |
| 2624 } | 2618 } |
| 2625 | 2619 |
| 2626 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | 2620 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
| 2627 | 2621 |
| 2628 InstallExperimentalBuiltinFunctionIds(); | 2622 InstallExperimentalBuiltinFunctionIds(); |
| 2629 return true; | 2623 return true; |
| 2630 } | 2624 } |
| 2631 | 2625 |
| 2632 | 2626 |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3283 } | 3277 } |
| 3284 | 3278 |
| 3285 | 3279 |
| 3286 // Called when the top-level V8 mutex is destroyed. | 3280 // Called when the top-level V8 mutex is destroyed. |
| 3287 void Bootstrapper::FreeThreadResources() { | 3281 void Bootstrapper::FreeThreadResources() { |
| 3288 DCHECK(!IsActive()); | 3282 DCHECK(!IsActive()); |
| 3289 } | 3283 } |
| 3290 | 3284 |
| 3291 } // namespace internal | 3285 } // namespace internal |
| 3292 } // namespace v8 | 3286 } // namespace v8 |
| OLD | NEW |