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