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( |
| 1895 Handle<JSObject>& base, const char* name, Builtins::Name call, int len) { |
| 1896 Handle<JSFunction> fun = |
| 1897 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 1898 MaybeHandle<JSObject>(), call); |
| 1899 fun->shared()->set_internal_formal_parameter_count(len); |
| 1900 fun->shared()->set_length(len); |
| 1901 } |
| 1902 |
| 1903 |
1894 void Genesis::InitializeGlobal_harmony_reflect() { | 1904 void Genesis::InitializeGlobal_harmony_reflect() { |
1895 if (!FLAG_harmony_reflect) return; | 1905 if (!FLAG_harmony_reflect) return; |
1896 | 1906 |
1897 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1907 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1898 native_context()->global_object())); | 1908 native_context()->global_object())); |
1899 Handle<String> reflect_string = | 1909 Handle<String> reflect_string = |
1900 factory()->NewStringFromStaticChars("Reflect"); | 1910 factory()->NewStringFromStaticChars("Reflect"); |
1901 Handle<Object> reflect = | 1911 Handle<JSObject> reflect = |
1902 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1912 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1903 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 1913 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
| 1914 |
| 1915 SimpleInstallFunction(reflect, "deleteProperty", |
| 1916 Builtins::kReflectDeleteProperty, 2); |
| 1917 SimpleInstallFunction(reflect, "get", |
| 1918 Builtins::kReflectGet, 3); |
| 1919 SimpleInstallFunction(reflect, "has", |
| 1920 Builtins::kReflectHas, 2); |
| 1921 SimpleInstallFunction(reflect, "isExtensible", |
| 1922 Builtins::kReflectIsExtensible, 1); |
1904 } | 1923 } |
1905 | 1924 |
1906 | 1925 |
1907 | |
1908 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 1926 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
1909 if (!FLAG_harmony_sharedarraybuffer) return; | 1927 if (!FLAG_harmony_sharedarraybuffer) return; |
1910 | 1928 |
1911 Handle<JSGlobalObject> global( | 1929 Handle<JSGlobalObject> global( |
1912 JSGlobalObject::cast(native_context()->global_object())); | 1930 JSGlobalObject::cast(native_context()->global_object())); |
1913 | 1931 |
1914 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( | 1932 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( |
1915 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1933 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
1916 JSArrayBuffer::kSizeWithInternalFields, | 1934 JSArrayBuffer::kSizeWithInternalFields, |
1917 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1935 isolate()->initial_object_prototype(), Builtins::kIllegal); |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 } | 3298 } |
3281 | 3299 |
3282 | 3300 |
3283 // Called when the top-level V8 mutex is destroyed. | 3301 // Called when the top-level V8 mutex is destroyed. |
3284 void Bootstrapper::FreeThreadResources() { | 3302 void Bootstrapper::FreeThreadResources() { |
3285 DCHECK(!IsActive()); | 3303 DCHECK(!IsActive()); |
3286 } | 3304 } |
3287 | 3305 |
3288 } // namespace internal | 3306 } // namespace internal |
3289 } // namespace v8 | 3307 } // namespace v8 |
OLD | NEW |