| 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 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) | 1870 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters) |
| 1871 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) | 1871 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect) |
| 1872 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) | 1872 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls) |
| 1873 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) | 1873 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring) |
| 1874 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) | 1874 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object) |
| 1875 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) | 1875 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays) |
| 1876 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) | 1876 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer) |
| 1877 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) | 1877 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics) |
| 1878 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) | 1878 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target) |
| 1879 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable) | 1879 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable) |
| 1880 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd) | |
| 1881 | 1880 |
| 1882 | 1881 |
| 1883 void Genesis::InstallNativeFunctions_harmony_proxies() { | 1882 void Genesis::InstallNativeFunctions_harmony_proxies() { |
| 1884 if (FLAG_harmony_proxies) { | 1883 if (FLAG_harmony_proxies) { |
| 1885 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); | 1884 INSTALL_NATIVE(JSFunction, "$proxyDerivedHasTrap", derived_has_trap); |
| 1886 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); | 1885 INSTALL_NATIVE(JSFunction, "$proxyDerivedGetTrap", derived_get_trap); |
| 1887 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); | 1886 INSTALL_NATIVE(JSFunction, "$proxyDerivedSetTrap", derived_set_trap); |
| 1888 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); | 1887 INSTALL_NATIVE(JSFunction, "$proxyEnumerate", proxy_enumerate); |
| 1889 } | 1888 } |
| 1890 } | 1889 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 JSGlobalObject::cast(native_context()->global_object())); | 1978 JSGlobalObject::cast(native_context()->global_object())); |
| 1980 | 1979 |
| 1981 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( | 1980 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( |
| 1982 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1981 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
| 1983 JSArrayBuffer::kSizeWithInternalFields, | 1982 JSArrayBuffer::kSizeWithInternalFields, |
| 1984 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1983 isolate()->initial_object_prototype(), Builtins::kIllegal); |
| 1985 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 1984 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
| 1986 } | 1985 } |
| 1987 | 1986 |
| 1988 | 1987 |
| 1989 void Genesis::InitializeGlobal_harmony_simd() { | |
| 1990 Handle<JSGlobalObject> global( | |
| 1991 JSGlobalObject::cast(native_context()->global_object())); | |
| 1992 Isolate* isolate = global->GetIsolate(); | |
| 1993 Factory* factory = isolate->factory(); | |
| 1994 | |
| 1995 Handle<String> name = factory->InternalizeUtf8String("SIMD"); | |
| 1996 Handle<JSFunction> cons = factory->NewFunction(name); | |
| 1997 JSFunction::SetInstancePrototype( | |
| 1998 cons, | |
| 1999 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | |
| 2000 cons->SetInstanceClassName(*name); | |
| 2001 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); | |
| 2002 DCHECK(simd_object->IsJSObject()); | |
| 2003 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); | |
| 2004 | |
| 2005 Handle<JSFunction> float32x4_function = | |
| 2006 InstallFunction(simd_object, "Float32x4", JS_VALUE_TYPE, JSValue::kSize, | |
| 2007 isolate->initial_object_prototype(), Builtins::kIllegal); | |
| 2008 // Set the instance class name since InstallFunction only does this when | |
| 2009 // we install on the GlobalObject. | |
| 2010 float32x4_function->SetInstanceClassName(*factory->Float32x4_string()); | |
| 2011 native_context()->set_float32x4_function(*float32x4_function); | |
| 2012 } | |
| 2013 | |
| 2014 | |
| 2015 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, | 1988 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, |
| 2016 const char* name, | 1989 const char* name, |
| 2017 ElementsKind elements_kind) { | 1990 ElementsKind elements_kind) { |
| 2018 // --- I n t e r n a l A r r a y --- | 1991 // --- I n t e r n a l A r r a y --- |
| 2019 // An array constructor on the builtins object that works like | 1992 // An array constructor on the builtins object that works like |
| 2020 // the public Array constructor, except that its prototype | 1993 // the public Array constructor, except that its prototype |
| 2021 // doesn't inherit from Object.prototype. | 1994 // doesn't inherit from Object.prototype. |
| 2022 // To be used only for internal work by builtins. Instances | 1995 // To be used only for internal work by builtins. Instances |
| 2023 // must not be leaked to user code. | 1996 // must not be leaked to user code. |
| 2024 Handle<JSObject> prototype = | 1997 Handle<JSObject> prototype = |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 static const char* harmony_object_natives[] = {"native harmony-object.js", | 2562 static const char* harmony_object_natives[] = {"native harmony-object.js", |
| 2590 NULL}; | 2563 NULL}; |
| 2591 static const char* harmony_spread_arrays_natives[] = {nullptr}; | 2564 static const char* harmony_spread_arrays_natives[] = {nullptr}; |
| 2592 static const char* harmony_sharedarraybuffer_natives[] = { | 2565 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2593 "native harmony-sharedarraybuffer.js", NULL}; | 2566 "native harmony-sharedarraybuffer.js", NULL}; |
| 2594 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", | 2567 static const char* harmony_atomics_natives[] = {"native harmony-atomics.js", |
| 2595 nullptr}; | 2568 nullptr}; |
| 2596 static const char* harmony_new_target_natives[] = {nullptr}; | 2569 static const char* harmony_new_target_natives[] = {nullptr}; |
| 2597 static const char* harmony_concat_spreadable_natives[] = { | 2570 static const char* harmony_concat_spreadable_natives[] = { |
| 2598 "native harmony-concat-spreadable.js", nullptr}; | 2571 "native harmony-concat-spreadable.js", nullptr}; |
| 2599 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | |
| 2600 nullptr}; | |
| 2601 | 2572 |
| 2602 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2573 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 2603 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2574 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 2604 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2575 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 2605 if (FLAG_##id) { \ | 2576 if (FLAG_##id) { \ |
| 2606 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2577 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 2607 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | 2578 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 2608 if (strncmp(script_name.start(), id##_natives[j], \ | 2579 if (strncmp(script_name.start(), id##_natives[j], \ |
| 2609 script_name.length()) == 0) { \ | 2580 script_name.length()) == 0) { \ |
| 2610 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | 2581 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3314 } | 3285 } |
| 3315 | 3286 |
| 3316 | 3287 |
| 3317 // Called when the top-level V8 mutex is destroyed. | 3288 // Called when the top-level V8 mutex is destroyed. |
| 3318 void Bootstrapper::FreeThreadResources() { | 3289 void Bootstrapper::FreeThreadResources() { |
| 3319 DCHECK(!IsActive()); | 3290 DCHECK(!IsActive()); |
| 3320 } | 3291 } |
| 3321 | 3292 |
| 3322 } // namespace internal | 3293 } // namespace internal |
| 3323 } // namespace v8 | 3294 } // namespace v8 |
| OLD | NEW |