Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: src/bootstrapper.cc

Issue 938443002: [es6] implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add some perf tests (this stuff is slow ._.) Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) 1659 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) 1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals) 1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals)
1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) 1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring)
1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) 1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) 1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode)
1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) 1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps)
1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) 1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names)
1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) 1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters)
1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) 1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect)
1669 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls)
1669 1670
1670 1671
1671 void Genesis::InstallNativeFunctions_harmony_proxies() { 1672 void Genesis::InstallNativeFunctions_harmony_proxies() {
1672 if (FLAG_harmony_proxies) { 1673 if (FLAG_harmony_proxies) {
1673 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); 1674 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
1674 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); 1675 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
1675 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); 1676 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
1676 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); 1677 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
1677 } 1678 }
1678 } 1679 }
1679 1680
1680 #undef INSTALL_NATIVE 1681 #undef INSTALL_NATIVE
1681 1682
1682 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ 1683 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
1683 void Genesis::InitializeGlobal_##id() {} 1684 void Genesis::InitializeGlobal_##id() {}
1684 1685
1685 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) 1686 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
1686 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays) 1687 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays)
1687 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes) 1688 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes)
1688 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) 1689 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes)
1689 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) 1690 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals)
1690 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) 1691 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions)
1691 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals) 1692 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals)
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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 static const char* harmony_numeric_literals_natives[] = {NULL}; 2315 static const char* harmony_numeric_literals_natives[] = {NULL};
2314 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js", 2316 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js",
2315 NULL}; 2317 NULL};
2316 static const char* harmony_sloppy_natives[] = {NULL}; 2318 static const char* harmony_sloppy_natives[] = {NULL};
2317 static const char* harmony_unicode_natives[] = {NULL}; 2319 static const char* harmony_unicode_natives[] = {NULL};
2318 static const char* harmony_unicode_regexps_natives[] = {NULL}; 2320 static const char* harmony_unicode_regexps_natives[] = {NULL};
2319 static const char* harmony_computed_property_names_natives[] = {NULL}; 2321 static const char* harmony_computed_property_names_natives[] = {NULL};
2320 static const char* harmony_rest_parameters_natives[] = {NULL}; 2322 static const char* harmony_rest_parameters_natives[] = {NULL};
2321 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", 2323 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js",
2322 NULL}; 2324 NULL};
2325 static const char* harmony_spreadcalls_natives[] = {
2326 "native harmony-spread.js", NULL};
2323 2327
2324 for (int i = ExperimentalNatives::GetDebuggerCount(); 2328 for (int i = ExperimentalNatives::GetDebuggerCount();
2325 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 2329 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
2326 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 2330 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
2327 if (FLAG_##id) { \ 2331 if (FLAG_##id) { \
2328 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 2332 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
2329 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 2333 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
2330 if (strncmp(script_name.start(), id##_natives[j], \ 2334 if (strncmp(script_name.start(), id##_natives[j], \
2331 script_name.length()) == 0) { \ 2335 script_name.length()) == 0) { \
2332 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ 2336 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 return from + sizeof(NestingCounterType); 2959 return from + sizeof(NestingCounterType);
2956 } 2960 }
2957 2961
2958 2962
2959 // Called when the top-level V8 mutex is destroyed. 2963 // Called when the top-level V8 mutex is destroyed.
2960 void Bootstrapper::FreeThreadResources() { 2964 void Bootstrapper::FreeThreadResources() {
2961 DCHECK(!IsActive()); 2965 DCHECK(!IsActive());
2962 } 2966 }
2963 2967
2964 } } // namespace v8::internal 2968 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698