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

Side by Side Diff: src/bootstrapper.cc

Issue 913073003: [es6] implement Reflect.apply() & Reflect.construct() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm Created 5 years, 9 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
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) 1660 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) 1661 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals) 1662 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals)
1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) 1663 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring)
1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_templates) 1664 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_templates)
1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) 1665 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) 1666 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode)
1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) 1667 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps)
1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) 1668 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names)
1669 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) 1669 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters)
1670 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect)
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 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 Handle<JSObject> builtins(native_context()->builtins()); 1715 Handle<JSObject> builtins(native_context()->builtins());
1715 1716
1716 Handle<HeapObject> flag(FLAG_harmony_unicode_regexps ? heap()->true_value() 1717 Handle<HeapObject> flag(FLAG_harmony_unicode_regexps ? heap()->true_value()
1717 : heap()->false_value()); 1718 : heap()->false_value());
1718 Runtime::SetObjectProperty(isolate(), builtins, 1719 Runtime::SetObjectProperty(isolate(), builtins,
1719 factory()->harmony_unicode_regexps_string(), flag, 1720 factory()->harmony_unicode_regexps_string(), flag,
1720 STRICT).Assert(); 1721 STRICT).Assert();
1721 } 1722 }
1722 1723
1723 1724
1725 void Genesis::InitializeGlobal_harmony_reflect() {
1726 if (!FLAG_harmony_reflect) return;
1727 Handle<JSObject> builtins(native_context()->builtins());
1728 // Install references to functions of the Reflect object
1729 {
1730 Handle<JSFunction> apply =
1731 InstallFunction(builtins, "ReflectApply", JS_OBJECT_TYPE,
1732 JSObject::kHeaderSize, MaybeHandle<JSObject>(),
1733 Builtins::kReflectApply);
1734 Handle<JSFunction> construct =
1735 InstallFunction(builtins, "ReflectConstruct", JS_OBJECT_TYPE,
1736 JSObject::kHeaderSize, MaybeHandle<JSObject>(),
1737 Builtins::kReflectConstruct);
1738 if (FLAG_vector_ics) {
1739 // Apply embeds an IC, so we need a type vector of size 1 in the shared
1740 // function info.
1741 FeedbackVectorSpec spec(0, Code::CALL_IC);
1742 Handle<TypeFeedbackVector> feedback_vector =
1743 factory()->NewTypeFeedbackVector(&spec);
1744 apply->shared()->set_feedback_vector(*feedback_vector);
1745
1746 feedback_vector = factory()->NewTypeFeedbackVector(&spec);
1747 construct->shared()->set_feedback_vector(*feedback_vector);
1748 }
1749
1750 apply->shared()->set_internal_formal_parameter_count(3);
1751 apply->shared()->set_length(3);
1752
1753 construct->shared()->set_internal_formal_parameter_count(3);
1754 construct->shared()->set_length(2);
1755 }
1756
1757 Handle<JSGlobalObject> global(JSGlobalObject::cast(
1758 native_context()->global_object()));
1759 Handle<String> reflect_string =
1760 factory()->NewStringFromStaticChars("Reflect");
1761 Handle<Object> reflect =
1762 factory()->NewJSObject(isolate()->object_function(), TENURED);
1763 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM);
1764 }
1765
1766
1724 Handle<JSFunction> Genesis::InstallInternalArray( 1767 Handle<JSFunction> Genesis::InstallInternalArray(
1725 Handle<JSBuiltinsObject> builtins, 1768 Handle<JSBuiltinsObject> builtins,
1726 const char* name, 1769 const char* name,
1727 ElementsKind elements_kind) { 1770 ElementsKind elements_kind) {
1728 // --- I n t e r n a l A r r a y --- 1771 // --- I n t e r n a l A r r a y ---
1729 // An array constructor on the builtins object that works like 1772 // An array constructor on the builtins object that works like
1730 // the public Array constructor, except that its prototype 1773 // the public Array constructor, except that its prototype
1731 // doesn't inherit from Object.prototype. 1774 // doesn't inherit from Object.prototype.
1732 // To be used only for internal work by builtins. Instances 1775 // To be used only for internal work by builtins. Instances
1733 // must not be leaked to user code. 1776 // must not be leaked to user code.
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 static const char* harmony_numeric_literals_natives[] = {NULL}; 2319 static const char* harmony_numeric_literals_natives[] = {NULL};
2277 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js", 2320 static const char* harmony_tostring_natives[] = {"native harmony-tostring.js",
2278 NULL}; 2321 NULL};
2279 static const char* harmony_templates_natives[] = { 2322 static const char* harmony_templates_natives[] = {
2280 "native harmony-templates.js", NULL}; 2323 "native harmony-templates.js", NULL};
2281 static const char* harmony_sloppy_natives[] = {NULL}; 2324 static const char* harmony_sloppy_natives[] = {NULL};
2282 static const char* harmony_unicode_natives[] = {NULL}; 2325 static const char* harmony_unicode_natives[] = {NULL};
2283 static const char* harmony_unicode_regexps_natives[] = {NULL}; 2326 static const char* harmony_unicode_regexps_natives[] = {NULL};
2284 static const char* harmony_computed_property_names_natives[] = {NULL}; 2327 static const char* harmony_computed_property_names_natives[] = {NULL};
2285 static const char* harmony_rest_parameters_natives[] = {NULL}; 2328 static const char* harmony_rest_parameters_natives[] = {NULL};
2329 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js",
2330 NULL};
2286 2331
2287 for (int i = ExperimentalNatives::GetDebuggerCount(); 2332 for (int i = ExperimentalNatives::GetDebuggerCount();
2288 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 2333 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
2289 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 2334 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
2290 if (FLAG_##id) { \ 2335 if (FLAG_##id) { \
2291 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 2336 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
2292 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 2337 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
2293 if (strncmp(script_name.start(), id##_natives[j], \ 2338 if (strncmp(script_name.start(), id##_natives[j], \
2294 script_name.length()) == 0) { \ 2339 script_name.length()) == 0) { \
2295 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ 2340 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2919 return from + sizeof(NestingCounterType); 2964 return from + sizeof(NestingCounterType);
2920 } 2965 }
2921 2966
2922 2967
2923 // Called when the top-level V8 mutex is destroyed. 2968 // Called when the top-level V8 mutex is destroyed.
2924 void Bootstrapper::FreeThreadResources() { 2969 void Bootstrapper::FreeThreadResources() {
2925 DCHECK(!IsActive()); 2970 DCHECK(!IsActive());
2926 } 2971 }
2927 2972
2928 } } // namespace v8::internal 2973 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698