| 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 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) | 1813 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) |
| 1814 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) | 1814 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) |
| 1815 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) | 1815 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) |
| 1816 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) | 1816 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) |
| 1817 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) | 1817 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) |
| 1818 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) | 1818 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) |
| 1819 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) | 1819 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) |
| 1820 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) | 1820 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) |
| 1821 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) | 1821 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) |
| 1822 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable) | 1822 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable) |
| 1823 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd) |
| 1823 | 1824 |
| 1824 | 1825 |
| 1825 void Genesis::InstallNativeFunctions_harmony_proxies() { | 1826 void Genesis::InstallNativeFunctions_harmony_proxies() { |
| 1826 if (FLAG_harmony_proxies) { | 1827 if (FLAG_harmony_proxies) { |
| 1827 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); | 1828 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); |
| 1828 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); | 1829 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); |
| 1829 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); | 1830 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); |
| 1830 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); | 1831 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); |
| 1831 } | 1832 } |
| 1832 } | 1833 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 JSGlobalObject::cast(native_context()->global_object())); | 1922 JSGlobalObject::cast(native_context()->global_object())); |
| 1922 | 1923 |
| 1923 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( | 1924 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( |
| 1924 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1925 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
| 1925 JSArrayBuffer::kSizeWithInternalFields, | 1926 JSArrayBuffer::kSizeWithInternalFields, |
| 1926 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1927 isolate()->initial_object_prototype(), Builtins::kIllegal); |
| 1927 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 1928 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
| 1928 } | 1929 } |
| 1929 | 1930 |
| 1930 | 1931 |
| 1932 void Genesis::InitializeGlobal_harmony_simd() { |
| 1933 Handle<JSGlobalObject> global( |
| 1934 JSGlobalObject::cast(native_context()->global_object())); |
| 1935 Isolate* isolate = global->GetIsolate(); |
| 1936 Factory* factory = isolate->factory(); |
| 1937 |
| 1938 Handle<String> name = factory->InternalizeUtf8String("SIMD"); |
| 1939 Handle<JSFunction> cons = factory->NewFunction(name); |
| 1940 JSFunction::SetInstancePrototype( |
| 1941 cons, |
| 1942 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| 1943 cons->SetInstanceClassName(*name); |
| 1944 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); |
| 1945 DCHECK(simd_object->IsJSObject()); |
| 1946 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); |
| 1947 |
| 1948 Handle<JSFunction> float32x4_function = |
| 1949 InstallFunction(simd_object, "Float32x4", JS_VALUE_TYPE, JSValue::kSize, |
| 1950 isolate->initial_object_prototype(), Builtins::kIllegal); |
| 1951 // Set the instance class name since InstallFunction only does this when |
| 1952 // we install on the GlobalObject. |
| 1953 float32x4_function->SetInstanceClassName(*factory->Float32x4_string()); |
| 1954 native_context()->set_float32x4_function(*float32x4_function); |
| 1955 } |
| 1956 |
| 1957 |
| 1931 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, | 1958 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, |
| 1932 const char* name, | 1959 const char* name, |
| 1933 ElementsKind elements_kind) { | 1960 ElementsKind elements_kind) { |
| 1934 // --- I n t e r n a l A r r a y --- | 1961 // --- I n t e r n a l A r r a y --- |
| 1935 // An array constructor on the builtins object that works like | 1962 // An array constructor on the builtins object that works like |
| 1936 // the public Array constructor, except that its prototype | 1963 // the public Array constructor, except that its prototype |
| 1937 // doesn't inherit from Object.prototype. | 1964 // doesn't inherit from Object.prototype. |
| 1938 // To be used only for internal work by builtins. Instances | 1965 // To be used only for internal work by builtins. Instances |
| 1939 // must not be leaked to user code. | 1966 // must not be leaked to user code. |
| 1940 Handle<JSObject> prototype = | 1967 Handle<JSObject> prototype = |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 static const char* harmony_object_natives[] = {"native harmony-object.js", | 2524 static const char* harmony_object_natives[] = {"native harmony-object.js", |
| 2498 NULL}; | 2525 NULL}; |
| 2499 static const char* harmony_spread_arrays_natives[] = {nullptr}; | 2526 static const char* harmony_spread_arrays_natives[] = {nullptr}; |
| 2500 static const char* harmony_sharedarraybuffer_natives[] = { | 2527 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2501 "native harmony-sharedarraybuffer.js", NULL}; | 2528 "native harmony-sharedarraybuffer.js", NULL}; |
| 2502 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", | 2529 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", |
| 2503 nullptr}; | 2530 nullptr}; |
| 2504 static const char* harmony_new_target_natives[] = {nullptr}; | 2531 static const char* harmony_new_target_natives[] = {nullptr}; |
| 2505 static const char* harmony_concat_spreadable_natives[] = { | 2532 static const char* harmony_concat_spreadable_natives[] = { |
| 2506 "native harmony-concat-spreadable.js", nullptr}; | 2533 "native harmony-concat-spreadable.js", nullptr}; |
| 2534 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2535 nullptr}; |
| 2507 | 2536 |
| 2508 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2537 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2509 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2538 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2510 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2539 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2511 if (FLAG_##id) { \ | 2540 if (FLAG_##id) { \ |
| 2512 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2541 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2513 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2542 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2514 if (strncmp(script_name.start(), id##_natives[j], \ | 2543 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2515 script_name.length()) == 0) { \ | 2544 script_name.length()) == 0) { \ |
| 2516 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2545 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 } | 3231 } |
| 3203 | 3232 |
| 3204 | 3233 |
| 3205 // Called when the top-level V8 mutex is destroyed. | 3234 // Called when the top-level V8 mutex is destroyed. |
| 3206 void Bootstrapper::FreeThreadResources() { | 3235 void Bootstrapper::FreeThreadResources() { |
| 3207 DCHECK(!IsActive()); | 3236 DCHECK(!IsActive()); |
| 3208 } | 3237 } |
| 3209 | 3238 |
| 3210 } // namespace internal | 3239 } // namespace internal |
| 3211 } // namespace v8 | 3240 } // namespace v8 |
| OLD | NEW |