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 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 native_context()->set_iterator_result_map(*iterator_result_map); | 1308 native_context()->set_iterator_result_map(*iterator_result_map); |
1309 } | 1309 } |
1310 | 1310 |
1311 // -- W e a k M a p | 1311 // -- W e a k M a p |
1312 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | 1312 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
1313 isolate->initial_object_prototype(), Builtins::kIllegal); | 1313 isolate->initial_object_prototype(), Builtins::kIllegal); |
1314 // -- W e a k S e t | 1314 // -- W e a k S e t |
1315 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, | 1315 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, |
1316 isolate->initial_object_prototype(), Builtins::kIllegal); | 1316 isolate->initial_object_prototype(), Builtins::kIllegal); |
1317 | 1317 |
| 1318 { |
| 1319 // -- S I M D |
| 1320 Handle<String> name = factory->InternalizeUtf8String("SIMD"); |
| 1321 Handle<JSFunction> cons = factory->NewFunction(name); |
| 1322 JSFunction::SetInstancePrototype( |
| 1323 cons, |
| 1324 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| 1325 cons->SetInstanceClassName(*name); |
| 1326 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); |
| 1327 DCHECK(simd_object->IsJSObject()); |
| 1328 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); |
| 1329 |
| 1330 Handle<JSFunction> float32x4_function = InstallFunction( |
| 1331 simd_object, "Float32x4", JS_VALUE_TYPE, JSValue::kSize, |
| 1332 isolate->initial_object_prototype(), Builtins::kIllegal); |
| 1333 // Set the instance class name since InstallFunction only does this when |
| 1334 // we install on the GlobalObject. |
| 1335 float32x4_function->SetInstanceClassName(*factory->Float32x4_string()); |
| 1336 native_context()->set_float32x4_function(*float32x4_function); |
| 1337 } |
| 1338 |
1318 { // --- sloppy arguments map | 1339 { // --- sloppy arguments map |
1319 // Make sure we can recognize argument objects at runtime. | 1340 // Make sure we can recognize argument objects at runtime. |
1320 // This is done by introducing an anonymous function with | 1341 // This is done by introducing an anonymous function with |
1321 // class_name equals 'Arguments'. | 1342 // class_name equals 'Arguments'. |
1322 Handle<String> arguments_string = factory->Arguments_string(); | 1343 Handle<String> arguments_string = factory->Arguments_string(); |
1323 Handle<Code> code(isolate->builtins()->builtin(Builtins::kIllegal)); | 1344 Handle<Code> code(isolate->builtins()->builtin(Builtins::kIllegal)); |
1324 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype( | 1345 Handle<JSFunction> function = factory->NewFunctionWithoutPrototype( |
1325 arguments_string, code); | 1346 arguments_string, code); |
1326 function->shared()->set_instance_class_name(*arguments_string); | 1347 function->shared()->set_instance_class_name(*arguments_string); |
1327 | 1348 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) | 1830 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names) |
1810 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) | 1831 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) |
1811 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) | 1832 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) |
1812 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) | 1833 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) |
1813 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) | 1834 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) |
1814 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) | 1835 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) |
1815 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) | 1836 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) |
1816 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) | 1837 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) |
1817 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) | 1838 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) |
1818 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) | 1839 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) |
| 1840 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd) |
1819 | 1841 |
1820 | 1842 |
1821 void Genesis::InstallNativeFunctions_harmony_proxies() { | 1843 void Genesis::InstallNativeFunctions_harmony_proxies() { |
1822 if (FLAG_harmony_proxies) { | 1844 if (FLAG_harmony_proxies) { |
1823 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); | 1845 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); |
1824 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); | 1846 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); |
1825 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); | 1847 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); |
1826 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); | 1848 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); |
1827 } | 1849 } |
1828 } | 1850 } |
(...skipping 12 matching lines...) Expand all Loading... |
1841 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) | 1863 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) |
1842 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode) | 1864 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode) |
1843 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names) | 1865 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names) |
1844 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) | 1866 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) |
1845 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spreadcalls) | 1867 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spreadcalls) |
1846 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring) | 1868 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring) |
1847 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object) | 1869 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object) |
1848 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_arrays) | 1870 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_arrays) |
1849 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_atomics) | 1871 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_atomics) |
1850 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_new_target) | 1872 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_new_target) |
| 1873 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_simd) |
1851 | 1874 |
1852 void Genesis::InitializeGlobal_harmony_regexps() { | 1875 void Genesis::InitializeGlobal_harmony_regexps() { |
1853 Handle<JSObject> builtins(native_context()->builtins()); | 1876 Handle<JSObject> builtins(native_context()->builtins()); |
1854 | 1877 |
1855 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() | 1878 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() |
1856 : heap()->false_value()); | 1879 : heap()->false_value()); |
1857 Runtime::SetObjectProperty(isolate(), builtins, | 1880 Runtime::SetObjectProperty(isolate(), builtins, |
1858 factory()->harmony_regexps_string(), flag, | 1881 factory()->harmony_regexps_string(), flag, |
1859 STRICT).Assert(); | 1882 STRICT).Assert(); |
1860 } | 1883 } |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 "native harmony-spread.js", nullptr}; | 2509 "native harmony-spread.js", nullptr}; |
2487 static const char* harmony_destructuring_natives[] = {nullptr}; | 2510 static const char* harmony_destructuring_natives[] = {nullptr}; |
2488 static const char* harmony_object_natives[] = {"native harmony-object.js", | 2511 static const char* harmony_object_natives[] = {"native harmony-object.js", |
2489 NULL}; | 2512 NULL}; |
2490 static const char* harmony_spread_arrays_natives[] = {nullptr}; | 2513 static const char* harmony_spread_arrays_natives[] = {nullptr}; |
2491 static const char* harmony_sharedarraybuffer_natives[] = { | 2514 static const char* harmony_sharedarraybuffer_natives[] = { |
2492 "native harmony-sharedarraybuffer.js", NULL}; | 2515 "native harmony-sharedarraybuffer.js", NULL}; |
2493 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", | 2516 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", |
2494 nullptr}; | 2517 nullptr}; |
2495 static const char* harmony_new_target_natives[] = {nullptr}; | 2518 static const char* harmony_new_target_natives[] = {nullptr}; |
| 2519 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2520 nullptr}; |
2496 | 2521 |
2497 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2522 for (int i = ExperimentalNatives::GetDebuggerCount(); |
2498 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2523 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
2499 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2524 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
2500 if (FLAG_##id) { \ | 2525 if (FLAG_##id) { \ |
2501 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2526 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
2502 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2527 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
2503 if (strncmp(script_name.start(), id##_natives[j], \ | 2528 if (strncmp(script_name.start(), id##_natives[j], \ |
2504 script_name.length()) == 0) { \ | 2529 script_name.length()) == 0) { \ |
2505 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2530 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3192 } | 3217 } |
3193 | 3218 |
3194 | 3219 |
3195 // Called when the top-level V8 mutex is destroyed. | 3220 // Called when the top-level V8 mutex is destroyed. |
3196 void Bootstrapper::FreeThreadResources() { | 3221 void Bootstrapper::FreeThreadResources() { |
3197 DCHECK(!IsActive()); | 3222 DCHECK(!IsActive()); |
3198 } | 3223 } |
3199 | 3224 |
3200 } // namespace internal | 3225 } // namespace internal |
3201 } // namespace v8 | 3226 } // namespace v8 |
OLD | NEW |