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

Side by Side Diff: src/bootstrapper.cc

Issue 1379313002: [es6] Implement parts of the Reflect object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 5 years, 2 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
« no previous file with comments | « no previous file | src/builtins.h » ('j') | test/mjsunit/harmony/reflect.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 1873
1874 void Genesis::InitializeGlobal_harmony_tolength() { 1874 void Genesis::InitializeGlobal_harmony_tolength() {
1875 Handle<JSObject> builtins(native_context()->builtins()); 1875 Handle<JSObject> builtins(native_context()->builtins());
1876 Handle<Object> flag(factory()->ToBoolean(FLAG_harmony_tolength)); 1876 Handle<Object> flag(factory()->ToBoolean(FLAG_harmony_tolength));
1877 Runtime::SetObjectProperty(isolate(), builtins, 1877 Runtime::SetObjectProperty(isolate(), builtins,
1878 factory()->harmony_tolength_string(), flag, 1878 factory()->harmony_tolength_string(), flag,
1879 STRICT).Assert(); 1879 STRICT).Assert();
1880 } 1880 }
1881 1881
1882 1882
1883 static void SimpleInstallFunction(
1884 Handle<JSObject>& base, const char* name, Builtins::Name call, int len) {
1885 Handle<JSFunction> fun =
1886 InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize,
1887 MaybeHandle<JSObject>(), call);
1888 fun->shared()->set_internal_formal_parameter_count(len);
1889 fun->shared()->set_length(len);
1890 }
1891
1892
1883 void Genesis::InitializeGlobal_harmony_reflect() { 1893 void Genesis::InitializeGlobal_harmony_reflect() {
1884 if (!FLAG_harmony_reflect) return; 1894 if (!FLAG_harmony_reflect) return;
1885 1895
1886 Handle<JSGlobalObject> global(JSGlobalObject::cast( 1896 Handle<JSGlobalObject> global(JSGlobalObject::cast(
1887 native_context()->global_object())); 1897 native_context()->global_object()));
1888 Handle<String> reflect_string = 1898 Handle<String> reflect_string =
1889 factory()->NewStringFromStaticChars("Reflect"); 1899 factory()->NewStringFromStaticChars("Reflect");
1890 Handle<Object> reflect = 1900 Handle<JSObject> reflect =
1891 factory()->NewJSObject(isolate()->object_function(), TENURED); 1901 factory()->NewJSObject(isolate()->object_function(), TENURED);
1892 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); 1902 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM);
1903
1904 SimpleInstallFunction(reflect, "deleteProperty",
1905 Builtins::kReflectDeleteProperty, 2);
1906 SimpleInstallFunction(reflect, "get",
1907 Builtins::kReflectGet, 3);
1908 SimpleInstallFunction(reflect, "has",
1909 Builtins::kReflectHas, 2);
1910 SimpleInstallFunction(reflect, "isExtensible",
1911 Builtins::kReflectIsExtensible, 1);
1893 } 1912 }
1894 1913
1895 1914
1896
1897 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { 1915 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
1898 if (!FLAG_harmony_sharedarraybuffer) return; 1916 if (!FLAG_harmony_sharedarraybuffer) return;
1899 1917
1900 Handle<JSGlobalObject> global( 1918 Handle<JSGlobalObject> global(
1901 JSGlobalObject::cast(native_context()->global_object())); 1919 JSGlobalObject::cast(native_context()->global_object()));
1902 1920
1903 Handle<JSFunction> shared_array_buffer_fun = InstallFunction( 1921 Handle<JSFunction> shared_array_buffer_fun = InstallFunction(
1904 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE, 1922 global, "SharedArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1905 JSArrayBuffer::kSizeWithInternalFields, 1923 JSArrayBuffer::kSizeWithInternalFields,
1906 isolate()->initial_object_prototype(), Builtins::kIllegal); 1924 isolate()->initial_object_prototype(), Builtins::kIllegal);
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 } 3287 }
3270 3288
3271 3289
3272 // Called when the top-level V8 mutex is destroyed. 3290 // Called when the top-level V8 mutex is destroyed.
3273 void Bootstrapper::FreeThreadResources() { 3291 void Bootstrapper::FreeThreadResources() {
3274 DCHECK(!IsActive()); 3292 DCHECK(!IsActive());
3275 } 3293 }
3276 3294
3277 } // namespace internal 3295 } // namespace internal
3278 } // namespace v8 3296 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | test/mjsunit/harmony/reflect.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698