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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 | 1884 |
1885 void Genesis::InitializeGlobal_harmony_tolength() { | 1885 void Genesis::InitializeGlobal_harmony_tolength() { |
1886 Handle<JSObject> builtins(native_context()->builtins()); | 1886 Handle<JSObject> builtins(native_context()->builtins()); |
1887 Handle<Object> flag(factory()->ToBoolean(FLAG_harmony_tolength)); | 1887 Handle<Object> flag(factory()->ToBoolean(FLAG_harmony_tolength)); |
1888 Runtime::SetObjectProperty(isolate(), builtins, | 1888 Runtime::SetObjectProperty(isolate(), builtins, |
1889 factory()->harmony_tolength_string(), flag, | 1889 factory()->harmony_tolength_string(), flag, |
1890 STRICT).Assert(); | 1890 STRICT).Assert(); |
1891 } | 1891 } |
1892 | 1892 |
1893 | 1893 |
1894 static void SimpleInstallFunction( | 1894 static void SimpleInstallFunction(Handle<JSObject>& base, const char* name, |
1895 Handle<JSObject>& base, const char* name, Builtins::Name call, int len) { | 1895 Builtins::Name call, int len, bool adapt) { |
1896 Handle<JSFunction> fun = | 1896 Handle<JSFunction> fun = |
1897 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1897 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1898 MaybeHandle<JSObject>(), call); | 1898 MaybeHandle<JSObject>(), call); |
1899 fun->shared()->set_internal_formal_parameter_count(len); | 1899 if (adapt) { |
| 1900 fun->shared()->set_internal_formal_parameter_count(len); |
| 1901 } else { |
| 1902 fun->shared()->DontAdaptArguments(); |
| 1903 } |
1900 fun->shared()->set_length(len); | 1904 fun->shared()->set_length(len); |
1901 } | 1905 } |
1902 | 1906 |
1903 | 1907 |
1904 void Genesis::InitializeGlobal_harmony_reflect() { | 1908 void Genesis::InitializeGlobal_harmony_reflect() { |
1905 if (!FLAG_harmony_reflect) return; | 1909 if (!FLAG_harmony_reflect) return; |
1906 | 1910 |
1907 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1911 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1908 native_context()->global_object())); | 1912 native_context()->global_object())); |
1909 Handle<String> reflect_string = | 1913 Handle<String> reflect_string = |
1910 factory()->NewStringFromStaticChars("Reflect"); | 1914 factory()->NewStringFromStaticChars("Reflect"); |
1911 Handle<JSObject> reflect = | 1915 Handle<JSObject> reflect = |
1912 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1916 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1913 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 1917 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
1914 | 1918 |
1915 SimpleInstallFunction(reflect, "deleteProperty", | 1919 SimpleInstallFunction(reflect, "deleteProperty", |
1916 Builtins::kReflectDeleteProperty, 2); | 1920 Builtins::kReflectDeleteProperty, 2, true); |
1917 SimpleInstallFunction(reflect, "get", | 1921 SimpleInstallFunction(reflect, "get", |
1918 Builtins::kReflectGet, 3); | 1922 Builtins::kReflectGet, 3, false); |
1919 SimpleInstallFunction(reflect, "has", | 1923 SimpleInstallFunction(reflect, "has", |
1920 Builtins::kReflectHas, 2); | 1924 Builtins::kReflectHas, 2, true); |
1921 SimpleInstallFunction(reflect, "isExtensible", | 1925 SimpleInstallFunction(reflect, "isExtensible", |
1922 Builtins::kReflectIsExtensible, 1); | 1926 Builtins::kReflectIsExtensible, 1, true); |
1923 } | 1927 } |
1924 | 1928 |
1925 | 1929 |
1926 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 1930 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
1927 if (!FLAG_harmony_sharedarraybuffer) return; | 1931 if (!FLAG_harmony_sharedarraybuffer) return; |
1928 | 1932 |
1929 Handle<JSGlobalObject> global( | 1933 Handle<JSGlobalObject> global( |
1930 JSGlobalObject::cast(native_context()->global_object())); | 1934 JSGlobalObject::cast(native_context()->global_object())); |
1931 | 1935 |
1932 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( | 1936 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3298 } | 3302 } |
3299 | 3303 |
3300 | 3304 |
3301 // Called when the top-level V8 mutex is destroyed. | 3305 // Called when the top-level V8 mutex is destroyed. |
3302 void Bootstrapper::FreeThreadResources() { | 3306 void Bootstrapper::FreeThreadResources() { |
3303 DCHECK(!IsActive()); | 3307 DCHECK(!IsActive()); |
3304 } | 3308 } |
3305 | 3309 |
3306 } // namespace internal | 3310 } // namespace internal |
3307 } // namespace v8 | 3311 } // namespace v8 |
OLD | NEW |