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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_literals) | 1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_literals) |
1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) | 1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) |
1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) | 1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) |
1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) | 1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) |
1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) | 1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) |
1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) | 1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) |
1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) | 1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) |
1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) | 1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) |
1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) | 1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) |
1669 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) | 1669 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) |
| 1670 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) |
1670 | 1671 |
1671 | 1672 |
1672 void Genesis::InstallNativeFunctions_harmony_proxies() { | 1673 void Genesis::InstallNativeFunctions_harmony_proxies() { |
1673 if (FLAG_harmony_proxies) { | 1674 if (FLAG_harmony_proxies) { |
1674 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1675 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1675 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1676 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1676 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1677 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1677 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1678 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1678 } | 1679 } |
1679 } | 1680 } |
1680 | 1681 |
1681 #undef INSTALL_NATIVE | 1682 #undef INSTALL_NATIVE |
1682 | 1683 |
1683 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 1684 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
1684 void Genesis::InitializeGlobal_##id() {} | 1685 void Genesis::InitializeGlobal_##id() {} |
1685 | 1686 |
1686 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) | 1687 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) |
1687 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays) | 1688 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays) |
1688 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes) | 1689 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes) |
1689 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) | 1690 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) |
1690 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) | 1691 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) |
1691 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) | 1692 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) |
1692 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) | 1693 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) |
1693 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) | 1694 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) |
1694 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) | 1695 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) |
1695 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode) | 1696 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode) |
1696 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names) | 1697 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names) |
1697 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) | 1698 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) |
| 1699 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spreadcalls) |
1698 | 1700 |
1699 void Genesis::InitializeGlobal_harmony_regexps() { | 1701 void Genesis::InitializeGlobal_harmony_regexps() { |
1700 Handle<JSObject> builtins(native_context()->builtins()); | 1702 Handle<JSObject> builtins(native_context()->builtins()); |
1701 | 1703 |
1702 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() | 1704 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() |
1703 : heap()->false_value()); | 1705 : heap()->false_value()); |
1704 Runtime::SetObjectProperty(isolate(), builtins, | 1706 Runtime::SetObjectProperty(isolate(), builtins, |
1705 factory()->harmony_regexps_string(), flag, | 1707 factory()->harmony_regexps_string(), flag, |
1706 STRICT).Assert(); | 1708 STRICT).Assert(); |
1707 } | 1709 } |
1708 | 1710 |
1709 | 1711 |
1710 void Genesis::InitializeGlobal_harmony_unicode_regexps() { | 1712 void Genesis::InitializeGlobal_harmony_unicode_regexps() { |
1711 Handle<JSObject> builtins(native_context()->builtins()); | 1713 Handle<JSObject> builtins(native_context()->builtins()); |
1712 | 1714 |
1713 Handle<HeapObject> flag(FLAG_harmony_unicode_regexps ? heap()->true_value() | 1715 Handle<HeapObject> flag(FLAG_harmony_unicode_regexps ? heap()->true_value() |
1714 : heap()->false_value()); | 1716 : heap()->false_value()); |
1715 Runtime::SetObjectProperty(isolate(), builtins, | 1717 Runtime::SetObjectProperty(isolate(), builtins, |
1716 factory()->harmony_unicode_regexps_string(), flag, | 1718 factory()->harmony_unicode_regexps_string(), flag, |
1717 STRICT).Assert(); | 1719 STRICT).Assert(); |
1718 } | 1720 } |
1719 | 1721 |
1720 | 1722 |
1721 void Genesis::InitializeGlobal_harmony_reflect() { | 1723 void Genesis::InitializeGlobal_harmony_reflect() { |
1722 if (!FLAG_harmony_reflect) return; | |
1723 Handle<JSObject> builtins(native_context()->builtins()); | 1724 Handle<JSObject> builtins(native_context()->builtins()); |
1724 // Install references to functions of the Reflect object | 1725 // Install references to functions of the Reflect object |
1725 { | 1726 if (FLAG_harmony_reflect || FLAG_harmony_spreadcalls) { |
1726 Handle<JSFunction> apply = | 1727 Handle<JSFunction> apply = |
1727 InstallFunction(builtins, "ReflectApply", JS_OBJECT_TYPE, | 1728 InstallFunction(builtins, "ReflectApply", JS_OBJECT_TYPE, |
1728 JSObject::kHeaderSize, MaybeHandle<JSObject>(), | 1729 JSObject::kHeaderSize, MaybeHandle<JSObject>(), |
1729 Builtins::kReflectApply); | 1730 Builtins::kReflectApply); |
1730 Handle<JSFunction> construct = | 1731 Handle<JSFunction> construct = |
1731 InstallFunction(builtins, "ReflectConstruct", JS_OBJECT_TYPE, | 1732 InstallFunction(builtins, "ReflectConstruct", JS_OBJECT_TYPE, |
1732 JSObject::kHeaderSize, MaybeHandle<JSObject>(), | 1733 JSObject::kHeaderSize, MaybeHandle<JSObject>(), |
1733 Builtins::kReflectConstruct); | 1734 Builtins::kReflectConstruct); |
1734 if (FLAG_vector_ics) { | 1735 if (FLAG_vector_ics) { |
1735 // Apply embeds an IC, so we need a type vector of size 1 in the shared | 1736 // Apply embeds an IC, so we need a type vector of size 1 in the shared |
1736 // function info. | 1737 // function info. |
1737 FeedbackVectorSpec spec(0, Code::CALL_IC); | 1738 FeedbackVectorSpec spec(0, Code::CALL_IC); |
1738 Handle<TypeFeedbackVector> feedback_vector = | 1739 Handle<TypeFeedbackVector> feedback_vector = |
1739 factory()->NewTypeFeedbackVector(&spec); | 1740 factory()->NewTypeFeedbackVector(&spec); |
1740 apply->shared()->set_feedback_vector(*feedback_vector); | 1741 apply->shared()->set_feedback_vector(*feedback_vector); |
1741 | 1742 |
1742 feedback_vector = factory()->NewTypeFeedbackVector(&spec); | 1743 feedback_vector = factory()->NewTypeFeedbackVector(&spec); |
1743 construct->shared()->set_feedback_vector(*feedback_vector); | 1744 construct->shared()->set_feedback_vector(*feedback_vector); |
1744 } | 1745 } |
1745 | 1746 |
1746 apply->shared()->set_internal_formal_parameter_count(3); | 1747 apply->shared()->set_internal_formal_parameter_count(3); |
1747 apply->shared()->set_length(3); | 1748 apply->shared()->set_length(3); |
1748 | 1749 |
1749 construct->shared()->set_internal_formal_parameter_count(3); | 1750 construct->shared()->set_internal_formal_parameter_count(3); |
1750 construct->shared()->set_length(2); | 1751 construct->shared()->set_length(2); |
1751 } | 1752 } |
1752 | 1753 |
| 1754 if (!FLAG_harmony_reflect) return; |
1753 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1755 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1754 native_context()->global_object())); | 1756 native_context()->global_object())); |
1755 Handle<String> reflect_string = | 1757 Handle<String> reflect_string = |
1756 factory()->NewStringFromStaticChars("Reflect"); | 1758 factory()->NewStringFromStaticChars("Reflect"); |
1757 Handle<Object> reflect = | 1759 Handle<Object> reflect = |
1758 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1760 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1759 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 1761 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
1760 } | 1762 } |
1761 | 1763 |
1762 | 1764 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 static const char* harmony_arrow_functions_natives[] = {NULL}; | 2324 static const char* harmony_arrow_functions_natives[] = {NULL}; |
2323 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js", | 2325 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js", |
2324 NULL}; | 2326 NULL}; |
2325 static const char* harmony_sloppy_natives[] = {NULL}; | 2327 static const char* harmony_sloppy_natives[] = {NULL}; |
2326 static const char* harmony_unicode_natives[] = {NULL}; | 2328 static const char* harmony_unicode_natives[] = {NULL}; |
2327 static const char* harmony_unicode_regexps_natives[] = {NULL}; | 2329 static const char* harmony_unicode_regexps_natives[] = {NULL}; |
2328 static const char* harmony_computed_property_names_natives[] = {NULL}; | 2330 static const char* harmony_computed_property_names_natives[] = {NULL}; |
2329 static const char* harmony_rest_parameters_natives[] = {NULL}; | 2331 static const char* harmony_rest_parameters_natives[] = {NULL}; |
2330 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", | 2332 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", |
2331 NULL}; | 2333 NULL}; |
| 2334 static const char* harmony_spreadcalls_natives[] = { |
| 2335 "native harmony-spread.js", NULL}; |
2332 | 2336 |
2333 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2337 for (int i = ExperimentalNatives::GetDebuggerCount(); |
2334 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2338 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
2335 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2339 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
2336 if (FLAG_##id) { \ | 2340 if (FLAG_##id) { \ |
2337 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2341 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
2338 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2342 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
2339 if (strncmp(script_name.start(), id##_natives[j], \ | 2343 if (strncmp(script_name.start(), id##_natives[j], \ |
2340 script_name.length()) == 0) { \ | 2344 script_name.length()) == 0) { \ |
2341 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2345 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 return from + sizeof(NestingCounterType); | 2968 return from + sizeof(NestingCounterType); |
2965 } | 2969 } |
2966 | 2970 |
2967 | 2971 |
2968 // Called when the top-level V8 mutex is destroyed. | 2972 // Called when the top-level V8 mutex is destroyed. |
2969 void Bootstrapper::FreeThreadResources() { | 2973 void Bootstrapper::FreeThreadResources() { |
2970 DCHECK(!IsActive()); | 2974 DCHECK(!IsActive()); |
2971 } | 2975 } |
2972 | 2976 |
2973 } } // namespace v8::internal | 2977 } } // namespace v8::internal |
OLD | NEW |