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