| 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/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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) | 1746 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) |
| 1747 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) | 1747 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) |
| 1748 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) | 1748 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps) |
| 1749 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) | 1749 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) |
| 1750 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) | 1750 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) |
| 1751 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) | 1751 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) |
| 1752 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) | 1752 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) |
| 1753 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) | 1753 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) |
| 1754 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) | 1754 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) |
| 1755 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) | 1755 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) |
| 1756 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) |
| 1756 | 1757 |
| 1757 | 1758 |
| 1758 void Genesis::InstallNativeFunctions_harmony_proxies() { | 1759 void Genesis::InstallNativeFunctions_harmony_proxies() { |
| 1759 if (FLAG_harmony_proxies) { | 1760 if (FLAG_harmony_proxies) { |
| 1760 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); | 1761 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); |
| 1761 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); | 1762 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); |
| 1762 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); | 1763 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); |
| 1763 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); | 1764 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); |
| 1764 } | 1765 } |
| 1765 } | 1766 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 Handle<JSObject> builtins(native_context()->builtins()); | 1840 Handle<JSObject> builtins(native_context()->builtins()); |
| 1840 | 1841 |
| 1841 Handle<HeapObject> flag(FLAG_harmony_tostring ? heap()->true_value() | 1842 Handle<HeapObject> flag(FLAG_harmony_tostring ? heap()->true_value() |
| 1842 : heap()->false_value()); | 1843 : heap()->false_value()); |
| 1843 Runtime::SetObjectProperty(isolate(), builtins, | 1844 Runtime::SetObjectProperty(isolate(), builtins, |
| 1844 factory()->harmony_tostring_string(), flag, | 1845 factory()->harmony_tostring_string(), flag, |
| 1845 STRICT).Assert(); | 1846 STRICT).Assert(); |
| 1846 } | 1847 } |
| 1847 | 1848 |
| 1848 | 1849 |
| 1850 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
| 1851 if (!FLAG_harmony_sharedarraybuffer) return; |
| 1852 |
| 1853 Handle<JSGlobalObject> global( |
| 1854 JSGlobalObject::cast(native_context()->global_object())); |
| 1855 |
| 1856 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( |
| 1857 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
| 1858 JSArrayBuffer::kSizeWithInternalFields, |
| 1859 isolate()->initial_object_prototype(), Builtins::kIllegal); |
| 1860 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
| 1861 } |
| 1862 |
| 1863 |
| 1849 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, | 1864 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, |
| 1850 const char* name, | 1865 const char* name, |
| 1851 ElementsKind elements_kind) { | 1866 ElementsKind elements_kind) { |
| 1852 // --- I n t e r n a l A r r a y --- | 1867 // --- I n t e r n a l A r r a y --- |
| 1853 // An array constructor on the builtins object that works like | 1868 // An array constructor on the builtins object that works like |
| 1854 // the public Array constructor, except that its prototype | 1869 // the public Array constructor, except that its prototype |
| 1855 // doesn't inherit from Object.prototype. | 1870 // doesn't inherit from Object.prototype. |
| 1856 // To be used only for internal work by builtins. Instances | 1871 // To be used only for internal work by builtins. Instances |
| 1857 // must not be leaked to user code. | 1872 // must not be leaked to user code. |
| 1858 Handle<JSObject> prototype = | 1873 Handle<JSObject> prototype = |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 static const char* harmony_computed_property_names_natives[] = {nullptr}; | 2418 static const char* harmony_computed_property_names_natives[] = {nullptr}; |
| 2404 static const char* harmony_rest_parameters_natives[] = {nullptr}; | 2419 static const char* harmony_rest_parameters_natives[] = {nullptr}; |
| 2405 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", | 2420 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", |
| 2406 nullptr}; | 2421 nullptr}; |
| 2407 static const char* harmony_spreadcalls_natives[] = { | 2422 static const char* harmony_spreadcalls_natives[] = { |
| 2408 "native harmony-spread.js", nullptr}; | 2423 "native harmony-spread.js", nullptr}; |
| 2409 static const char* harmony_destructuring_natives[] = {nullptr}; | 2424 static const char* harmony_destructuring_natives[] = {nullptr}; |
| 2410 static const char* harmony_object_natives[] = {"native harmony-object.js", | 2425 static const char* harmony_object_natives[] = {"native harmony-object.js", |
| 2411 NULL}; | 2426 NULL}; |
| 2412 static const char* harmony_spread_arrays_natives[] = {nullptr}; | 2427 static const char* harmony_spread_arrays_natives[] = {nullptr}; |
| 2428 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2429 "native harmony-sharedarraybuffer.js", NULL}; |
| 2413 | 2430 |
| 2414 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2431 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2415 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2432 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2416 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2433 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2417 if (FLAG_##id) { \ | 2434 if (FLAG_##id) { \ |
| 2418 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2435 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2419 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2436 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2420 if (strncmp(script_name.start(), id##_natives[j], \ | 2437 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2421 script_name.length()) == 0) { \ | 2438 script_name.length()) == 0) { \ |
| 2422 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2439 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3051 return from + sizeof(NestingCounterType); | 3068 return from + sizeof(NestingCounterType); |
| 3052 } | 3069 } |
| 3053 | 3070 |
| 3054 | 3071 |
| 3055 // Called when the top-level V8 mutex is destroyed. | 3072 // Called when the top-level V8 mutex is destroyed. |
| 3056 void Bootstrapper::FreeThreadResources() { | 3073 void Bootstrapper::FreeThreadResources() { |
| 3057 DCHECK(!IsActive()); | 3074 DCHECK(!IsActive()); |
| 3058 } | 3075 } |
| 3059 | 3076 |
| 3060 } } // namespace v8::internal | 3077 } } // namespace v8::internal |
| OLD | NEW |