| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index ff4026ce6ba4dfada69e9f831470bd4a215c1bc6..c37ff4d8641b92d14af87c3c1668f6aad8aef327 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -1668,6 +1668,7 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_computed_property_names)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_rest_parameters)
|
| +EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect)
|
|
|
|
|
| void Genesis::InstallNativeFunctions_harmony_proxies() {
|
| @@ -1700,6 +1701,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
|
| EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode)
|
| EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names)
|
| EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters)
|
| +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_reflect)
|
|
|
| void Genesis::InitializeGlobal_harmony_regexps() {
|
| Handle<JSObject> builtins(native_context()->builtins());
|
| @@ -2090,6 +2092,36 @@ bool Genesis::InstallNatives() {
|
| *generator_object_prototype_map);
|
| }
|
|
|
| + // Install references to functions of the Reflect object
|
| + {
|
| + Handle<JSFunction> apply =
|
| + InstallFunction(builtins, "ReflectApply", JS_OBJECT_TYPE,
|
| + JSObject::kHeaderSize, MaybeHandle<JSObject>(),
|
| + Builtins::kReflectApply);
|
| + Handle<JSFunction> construct =
|
| + InstallFunction(builtins, "ReflectConstruct", JS_OBJECT_TYPE,
|
| + JSObject::kHeaderSize, MaybeHandle<JSObject>(),
|
| + Builtins::kReflectConstruct);
|
| + if (FLAG_vector_ics) {
|
| + // Apply embeds an IC, so we need a type vector of size 1 in the shared
|
| + // function info.
|
| + FeedbackVectorSpec spec(0, 1);
|
| + spec.SetKind(0, Code::CALL_IC);
|
| + Handle<TypeFeedbackVector> feedback_vector =
|
| + factory()->NewTypeFeedbackVector(spec);
|
| + apply->shared()->set_feedback_vector(*feedback_vector);
|
| +
|
| + feedback_vector = factory()->NewTypeFeedbackVector(spec);
|
| + construct->shared()->set_feedback_vector(*feedback_vector);
|
| + }
|
| +
|
| + apply->shared()->set_internal_formal_parameter_count(3);
|
| + apply->shared()->set_length(3);
|
| +
|
| + construct->shared()->set_internal_formal_parameter_count(3);
|
| + construct->shared()->set_length(2);
|
| + }
|
| +
|
| if (FLAG_disable_native_files) {
|
| PrintF("Warning: Running without installed natives!\n");
|
| return true;
|
| @@ -2290,6 +2322,8 @@ bool Genesis::InstallExperimentalNatives() {
|
| static const char* harmony_unicode_regexps_natives[] = {NULL};
|
| static const char* harmony_computed_property_names_natives[] = {NULL};
|
| static const char* harmony_rest_parameters_natives[] = {NULL};
|
| + static const char* harmony_reflect_natives[] = {"native harmony-reflect.js",
|
| + NULL};
|
|
|
| for (int i = ExperimentalNatives::GetDebuggerCount();
|
| i < ExperimentalNatives::GetBuiltinsCount(); i++) {
|
| @@ -2887,6 +2921,19 @@ Genesis::Genesis(Isolate* isolate,
|
| isolate->counters()->contexts_created_from_scratch()->Increment();
|
| }
|
|
|
| + if (FLAG_harmony_reflect) {
|
| + // TODO(caitp): this should not be here, there's got to be a better way.
|
| + // Shouldn't InitializeExperimentalGlobal() happen before
|
| + // InitializeExperimentalNatives()?
|
| + Handle<JSGlobalObject> global(JSGlobalObject::cast(
|
| + native_context()->global_object()));
|
| + Handle<String> reflect_string =
|
| + factory()->NewStringFromStaticChars("Reflect");
|
| + Handle<Object> reflect =
|
| + factory()->NewJSObject(isolate->object_function(), TENURED);
|
| + JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM);
|
| + }
|
| +
|
| // Install experimental natives. Do not include them into the snapshot as we
|
| // should be able to turn them off at runtime. Re-installing them after
|
| // they have already been deserialized would also fail.
|
|
|