| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index eb2269c15ecf6292d86e553157b532a33d5894ab..624a6c2b2d83a623687d54f55ab613956e570289 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -1664,6 +1664,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() {
|
| @@ -1696,6 +1697,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());
|
| @@ -2086,6 +2088,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;
|
| @@ -2286,6 +2318,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++) {
|
| @@ -2891,6 +2925,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.
|
| if (!InstallExperimentalNatives()) return;
|
| InitializeExperimentalGlobal();
|
|
|