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

Side by Side Diff: src/bootstrapper.cc

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

Powered by Google App Engine
This is Rietveld 408576698