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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins.h » ('j') | test/mjsunit/harmony/reflect.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index a7754dba1a861935354ad2be18e793cb650e9f26..d2820fde853c0eaaf046a5c3ac63800f6d989c50 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1880,6 +1880,16 @@ void Genesis::InitializeGlobal_harmony_tolength() {
}
+static void SimpleInstallFunction(
+ Handle<JSObject>& base, const char* name, Builtins::Name call, int len) {
+ Handle<JSFunction> fun =
+ InstallFunction(base, name, JS_OBJECT_TYPE, JSObject::kHeaderSize,
+ MaybeHandle<JSObject>(), call);
+ fun->shared()->set_internal_formal_parameter_count(len);
+ fun->shared()->set_length(len);
+}
+
+
void Genesis::InitializeGlobal_harmony_reflect() {
if (!FLAG_harmony_reflect) return;
@@ -1887,11 +1897,19 @@ void Genesis::InitializeGlobal_harmony_reflect() {
native_context()->global_object()));
Handle<String> reflect_string =
factory()->NewStringFromStaticChars("Reflect");
- Handle<Object> reflect =
+ Handle<JSObject> reflect =
factory()->NewJSObject(isolate()->object_function(), TENURED);
JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM);
-}
+ SimpleInstallFunction(reflect, "deleteProperty",
+ Builtins::kReflectDeleteProperty, 2);
+ SimpleInstallFunction(reflect, "get",
+ Builtins::kReflectGet, 3);
+ SimpleInstallFunction(reflect, "has",
+ Builtins::kReflectHas, 2);
+ SimpleInstallFunction(reflect, "isExtensible",
+ Builtins::kReflectIsExtensible, 1);
+}
void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
« 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