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

Side by Side Diff: src/bootstrapper.cc

Issue 1293493003: Do not export natives to runtime via js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/bootstrapper.h ('k') | src/collection.js » ('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/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // The native context has a ScriptContextTable that store declarative bindings 207 // The native context has a ScriptContextTable that store declarative bindings
208 // made in script scopes. Add a "this" binding to that table pointing to the 208 // made in script scopes. Add a "this" binding to that table pointing to the
209 // global proxy. 209 // global proxy.
210 void InstallGlobalThisBinding(); 210 void InstallGlobalThisBinding();
211 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts); 211 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts);
212 // New context initialization. Used for creating a context from scratch. 212 // New context initialization. Used for creating a context from scratch.
213 void InitializeGlobal(Handle<GlobalObject> global_object, 213 void InitializeGlobal(Handle<GlobalObject> global_object,
214 Handle<JSFunction> empty_function, 214 Handle<JSFunction> empty_function,
215 ContextType context_type); 215 ContextType context_type);
216 void InitializeExperimentalGlobal(); 216 void InitializeExperimentalGlobal();
217 // Installs the contents of the native .js files on the global objects.
218 // Used for creating a context from scratch.
219 void InstallNativeFunctions();
220 void InstallExperimentalNativeFunctions();
221 // Typed arrays are not serializable and have to initialized afterwards. 217 // Typed arrays are not serializable and have to initialized afterwards.
222 void InitializeBuiltinTypedArrays(); 218 void InitializeBuiltinTypedArrays();
223 219
224 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ 220 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \
225 void InstallNativeFunctions_##id(); \
226 void InitializeGlobal_##id(); 221 void InitializeGlobal_##id();
227 222
228 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) 223 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
229 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) 224 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
230 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) 225 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
231 #undef DECLARE_FEATURE_INITIALIZATION 226 #undef DECLARE_FEATURE_INITIALIZATION
232 227
233 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, 228 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target,
234 const char* name, 229 const char* name,
235 ElementsKind elements_kind); 230 ElementsKind elements_kind);
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 return Handle<JSObject>(JSObject::cast(function->prototype())); 1689 return Handle<JSObject>(JSObject::cast(function->prototype()));
1695 } 1690 }
1696 Handle<String> inner_string = factory->InternalizeUtf8String(inner); 1691 Handle<String> inner_string = factory->InternalizeUtf8String(inner);
1697 DCHECK(!inner_string.is_null()); 1692 DCHECK(!inner_string.is_null());
1698 Handle<Object> value = 1693 Handle<Object> value =
1699 Object::GetProperty(object, inner_string).ToHandleChecked(); 1694 Object::GetProperty(object, inner_string).ToHandleChecked();
1700 return Handle<JSObject>::cast(value); 1695 return Handle<JSObject>::cast(value);
1701 } 1696 }
1702 1697
1703 1698
1704 #define INSTALL_NATIVE(Type, name, var) \
1705 Handle<String> var##_name = \
1706 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR(name)); \
1707 Handle<Object> var##_native = \
1708 Object::GetProperty(handle(native_context()->builtins()), var##_name) \
1709 .ToHandleChecked(); \
1710 native_context()->set_##var(Type::cast(*var##_native));
1711
1712
1713 void Genesis::InstallNativeFunctions() {
1714 HandleScope scope(isolate());
1715 INSTALL_NATIVE(JSFunction, "$createDate", create_date_fun);
1716
1717 INSTALL_NATIVE(JSFunction, "$toNumber", to_number_fun);
1718 INSTALL_NATIVE(JSFunction, "$toString", to_string_fun);
1719 INSTALL_NATIVE(JSFunction, "$toDetailString", to_detail_string_fun);
1720 INSTALL_NATIVE(JSFunction, "$toInteger", to_integer_fun);
1721 INSTALL_NATIVE(JSFunction, "$toLength", to_length_fun);
1722
1723 INSTALL_NATIVE(JSFunction, "$globalEval", global_eval_fun);
1724 INSTALL_NATIVE(JSFunction, "$getStackTraceLine", get_stack_trace_line_fun);
1725 INSTALL_NATIVE(JSFunction, "$toCompletePropertyDescriptor",
1726 to_complete_property_descriptor);
1727
1728 INSTALL_NATIVE(Symbol, "$promiseStatus", promise_status);
1729 INSTALL_NATIVE(Symbol, "$promiseValue", promise_value);
1730 INSTALL_NATIVE(JSFunction, "$promiseCreate", promise_create);
1731 INSTALL_NATIVE(JSFunction, "$promiseResolve", promise_resolve);
1732 INSTALL_NATIVE(JSFunction, "$promiseReject", promise_reject);
1733 INSTALL_NATIVE(JSFunction, "$promiseChain", promise_chain);
1734 INSTALL_NATIVE(JSFunction, "$promiseCatch", promise_catch);
1735 INSTALL_NATIVE(JSFunction, "$promiseThen", promise_then);
1736
1737 INSTALL_NATIVE(JSFunction, "$observeNotifyChange", observers_notify_change);
1738 INSTALL_NATIVE(JSFunction, "$observeEnqueueSpliceRecord",
1739 observers_enqueue_splice);
1740 INSTALL_NATIVE(JSFunction, "$observeBeginPerformSplice",
1741 observers_begin_perform_splice);
1742 INSTALL_NATIVE(JSFunction, "$observeEndPerformSplice",
1743 observers_end_perform_splice);
1744 INSTALL_NATIVE(JSFunction, "$observeNativeObjectObserve",
1745 native_object_observe);
1746 INSTALL_NATIVE(JSFunction, "$observeNativeObjectGetNotifier",
1747 native_object_get_notifier);
1748 INSTALL_NATIVE(JSFunction, "$observeNativeObjectNotifierPerformChange",
1749 native_object_notifier_perform_change);
1750 INSTALL_NATIVE(JSFunction, "$arrayValues", array_values_iterator);
1751 INSTALL_NATIVE(JSFunction, "$mapGet", map_get);
1752 INSTALL_NATIVE(JSFunction, "$mapSet", map_set);
1753 INSTALL_NATIVE(JSFunction, "$mapHas", map_has);
1754 INSTALL_NATIVE(JSFunction, "$mapDelete", map_delete);
1755 INSTALL_NATIVE(JSFunction, "$setAdd", set_add);
1756 INSTALL_NATIVE(JSFunction, "$setHas", set_has);
1757 INSTALL_NATIVE(JSFunction, "$setDelete", set_delete);
1758 INSTALL_NATIVE(JSFunction, "$mapFromArray", map_from_array);
1759 INSTALL_NATIVE(JSFunction, "$setFromArray", set_from_array);
1760 }
1761
1762
1763 void Genesis::InstallExperimentalNativeFunctions() {
1764 if (FLAG_harmony_proxies) {
1765 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap);
1766 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap);
1767 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap);
1768 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate);
1769 }
1770
1771 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id();
1772 HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR)
1773 HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR)
1774 HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR)
1775 #undef INSTALL_NATIVE_FUNCTIONS_FOR
1776 }
1777
1778
1779 template <typename Data> 1699 template <typename Data>
1780 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins, 1700 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins,
1781 ExternalArrayType type, Data* data, 1701 ExternalArrayType type, Data* data,
1782 size_t num_elements, const char* name) { 1702 size_t num_elements, const char* name) {
1783 size_t byte_length = num_elements * sizeof(*data); 1703 size_t byte_length = num_elements * sizeof(*data);
1784 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 1704 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
1785 bool is_external = data != nullptr; 1705 bool is_external = data != nullptr;
1786 if (!is_external) { 1706 if (!is_external) {
1787 data = reinterpret_cast<Data*>( 1707 data = reinterpret_cast<Data*>(
1788 isolate->array_buffer_allocator()->Allocate(byte_length)); 1708 isolate->array_buffer_allocator()->Allocate(byte_length));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 { // Initialize a result array for rempio2 calculation 1745 { // Initialize a result array for rempio2 calculation
1826 const size_t num_elements = 2; 1746 const size_t num_elements = 2;
1827 double* data = 1747 double* data =
1828 SetBuiltinTypedArray<double>(isolate(), builtins, kExternalFloat64Array, 1748 SetBuiltinTypedArray<double>(isolate(), builtins, kExternalFloat64Array,
1829 NULL, num_elements, "rempio2result"); 1749 NULL, num_elements, "rempio2result");
1830 for (size_t i = 0; i < num_elements; i++) data[i] = 0; 1750 for (size_t i = 0; i < num_elements; i++) data[i] = 0;
1831 } 1751 }
1832 } 1752 }
1833 1753
1834 1754
1835 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \ 1755 #define INSTALL_NATIVE(Type, name, var) \
1836 void Genesis::InstallNativeFunctions_##id() {} 1756 Handle<Object> var##_native = \
1757 Object::GetProperty(isolate, container, name, STRICT).ToHandleChecked(); \
1758 DCHECK(var##_native->Is##Type()); \
1759 native_context->set_##var(Type::cast(*var##_native));
1760
1761
1762 void Bootstrapper::ImportNatives(Isolate* isolate, Handle<JSObject> container) {
1763 HandleScope scope(isolate);
1764 Handle<Context> native_context = isolate->native_context();
1765 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1766 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1767 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1768 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1769 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1770 INSTALL_NATIVE(JSFunction, "ToLength", to_length_fun);
1771
1772 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1773 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1774 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
1775 to_complete_property_descriptor);
1776
1777 INSTALL_NATIVE(Symbol, "promiseStatus", promise_status);
1778 INSTALL_NATIVE(Symbol, "promiseValue", promise_value);
1779 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1780 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1781 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1782 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1783 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1784 INSTALL_NATIVE(JSFunction, "PromiseThen", promise_then);
1785
1786 INSTALL_NATIVE(JSFunction, "ObserveNotifyChange", observers_notify_change);
1787 INSTALL_NATIVE(JSFunction, "ObserveEnqueueSpliceRecord",
1788 observers_enqueue_splice);
1789 INSTALL_NATIVE(JSFunction, "ObserveBeginPerformSplice",
1790 observers_begin_perform_splice);
1791 INSTALL_NATIVE(JSFunction, "ObserveEndPerformSplice",
1792 observers_end_perform_splice);
1793 INSTALL_NATIVE(JSFunction, "ObserveNativeObjectObserve",
1794 native_object_observe);
1795 INSTALL_NATIVE(JSFunction, "ObserveNativeObjectGetNotifier",
1796 native_object_get_notifier);
1797 INSTALL_NATIVE(JSFunction, "ObserveNativeObjectNotifierPerformChange",
1798 native_object_notifier_perform_change);
1799
1800 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator);
1801 INSTALL_NATIVE(JSFunction, "MapGet", map_get);
1802 INSTALL_NATIVE(JSFunction, "MapSet", map_set);
1803 INSTALL_NATIVE(JSFunction, "MapHas", map_has);
1804 INSTALL_NATIVE(JSFunction, "MapDelete", map_delete);
1805 INSTALL_NATIVE(JSFunction, "SetAdd", set_add);
1806 INSTALL_NATIVE(JSFunction, "SetHas", set_has);
1807 INSTALL_NATIVE(JSFunction, "SetDelete", set_delete);
1808 INSTALL_NATIVE(JSFunction, "MapFromArray", map_from_array);
1809 INSTALL_NATIVE(JSFunction, "SetFromArray", set_from_array);
1810 }
1811
1812
1813 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \
1814 static void InstallExperimentalNatives_##id(Isolate* isolate, \
1815 Handle<Context> native_context, \
1816 Handle<JSObject> container) {}
1837 1817
1838 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules) 1818 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules)
1839 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_array_includes) 1819 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_array_includes)
1840 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) 1820 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
1841 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) 1821 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
1842 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) 1822 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring)
1843 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) 1823 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
1844 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy_function) 1824 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy_function)
1845 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy_let) 1825 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy_let)
1846 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) 1826 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps)
1847 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) 1827 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters)
1848 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) 1828 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect)
1849 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) 1829 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls)
1850 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) 1830 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring)
1851 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) 1831 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object)
1852 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_observe) 1832 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_observe)
1853 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) 1833 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays)
1854 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) 1834 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer)
1855 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) 1835 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics)
1856 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) 1836 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target)
1857 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable) 1837 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable)
1858 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd) 1838 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd)
1859 1839
1860 1840
1861 void Genesis::InstallNativeFunctions_harmony_proxies() { 1841 static void InstallExperimentalNatives_harmony_proxies(
1842 Isolate* isolate, Handle<Context> native_context,
1843 Handle<JSObject> container) {
1862 if (FLAG_harmony_proxies) { 1844 if (FLAG_harmony_proxies) {
1863 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); 1845 INSTALL_NATIVE(JSFunction, "ProxyDerivedGetTrap", derived_get_trap);
1864 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); 1846 INSTALL_NATIVE(JSFunction, "ProxyDerivedHasTrap", derived_has_trap);
1865 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); 1847 INSTALL_NATIVE(JSFunction, "ProxyDerivedSetTrap", derived_set_trap);
1866 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); 1848 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
1867 } 1849 }
1868 } 1850 }
1869 1851
1870 1852
1853 void Bootstrapper::ImportExperimentalNatives(Isolate* isolate,
1854 Handle<JSObject> container) {
1855 HandleScope scope(isolate);
1856 Handle<Context> native_context = isolate->native_context();
1857 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) \
1858 InstallExperimentalNatives_##id(isolate, native_context, container);
1859
1860 HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR)
1861 HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR)
1862 HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR)
1863 #undef INSTALL_NATIVE_FUNCTIONS_FOR
1864 }
1865
1871 #undef INSTALL_NATIVE 1866 #undef INSTALL_NATIVE
1872 1867
1873 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ 1868 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
1874 void Genesis::InitializeGlobal_##id() {} 1869 void Genesis::InitializeGlobal_##id() {}
1875 1870
1876 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) 1871 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
1877 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes) 1872 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes)
1878 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) 1873 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions)
1879 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) 1874 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies)
1880 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) 1875 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; 2390 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false;
2396 2391
2397 if (!InstallJSBuiltins(builtins)) return false; 2392 if (!InstallJSBuiltins(builtins)) return false;
2398 2393
2399 for (++i; i < Natives::GetBuiltinsCount(); ++i) { 2394 for (++i; i < Natives::GetBuiltinsCount(); ++i) {
2400 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; 2395 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false;
2401 } 2396 }
2402 2397
2403 if (!CallUtilsFunction(isolate(), "PostNatives")) return false; 2398 if (!CallUtilsFunction(isolate(), "PostNatives")) return false;
2404 2399
2405 InstallNativeFunctions();
2406
2407 auto function_cache = 2400 auto function_cache =
2408 ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize, 2401 ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize,
2409 USE_CUSTOM_MINIMUM_CAPACITY); 2402 USE_CUSTOM_MINIMUM_CAPACITY);
2410 native_context()->set_function_cache(*function_cache); 2403 native_context()->set_function_cache(*function_cache);
2411 2404
2412 // Store the map for the string prototype after the natives has been compiled 2405 // Store the map for the string prototype after the natives has been compiled
2413 // and the String function has been set up. 2406 // and the String function has been set up.
2414 Handle<JSFunction> string_function(native_context()->string_function()); 2407 Handle<JSFunction> string_function(native_context()->string_function());
2415 DCHECK(JSObject::cast( 2408 DCHECK(JSObject::cast(
2416 string_function->initial_map()->prototype())->HasFastProperties()); 2409 string_function->initial_map()->prototype())->HasFastProperties());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 } \ 2593 } \
2601 } 2594 }
2602 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); 2595 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES);
2603 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); 2596 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES);
2604 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); 2597 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES);
2605 #undef INSTALL_EXPERIMENTAL_NATIVES 2598 #undef INSTALL_EXPERIMENTAL_NATIVES
2606 } 2599 }
2607 2600
2608 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; 2601 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false;
2609 2602
2610 InstallExperimentalNativeFunctions();
2611 InstallExperimentalBuiltinFunctionIds(); 2603 InstallExperimentalBuiltinFunctionIds();
2612 return true; 2604 return true;
2613 } 2605 }
2614 2606
2615 2607
2616 bool Genesis::InstallExtraNatives() { 2608 bool Genesis::InstallExtraNatives() {
2617 for (int i = ExtraNatives::GetDebuggerCount(); 2609 for (int i = ExtraNatives::GetDebuggerCount();
2618 i < ExtraNatives::GetBuiltinsCount(); i++) { 2610 i < ExtraNatives::GetBuiltinsCount(); i++) {
2619 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false; 2611 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false;
2620 } 2612 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 } 3268 }
3277 3269
3278 3270
3279 // Called when the top-level V8 mutex is destroyed. 3271 // Called when the top-level V8 mutex is destroyed.
3280 void Bootstrapper::FreeThreadResources() { 3272 void Bootstrapper::FreeThreadResources() {
3281 DCHECK(!IsActive()); 3273 DCHECK(!IsActive());
3282 } 3274 }
3283 3275
3284 } // namespace internal 3276 } // namespace internal
3285 } // namespace v8 3277 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698