| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index f57a1f6fd8fb69cbb3ac633382283fa7e6556486..1b116cdce0c36043733689af83bab62f02eb9284 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -1321,6 +1321,46 @@ void Genesis::InitializeExperimentalGlobal() {
|
| Builtins::kIllegal, true);
|
| }
|
| }
|
| +
|
| + if (FLAG_harmony_generators) {
|
| + // Create generator meta-objects and install them on the builtins object.
|
| + Handle<JSObject> builtins(native_context()->builtins());
|
| + Handle<JSObject> generator_object_prototype =
|
| + factory()->NewJSObject(isolate()->object_function(), TENURED);
|
| + Handle<JSFunction> generator_function_prototype =
|
| + InstallFunction(builtins, "GeneratorFunctionPrototype",
|
| + JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
|
| + generator_object_prototype, Builtins::kIllegal,
|
| + false);
|
| + InstallFunction(builtins, "GeneratorFunction",
|
| + JS_FUNCTION_TYPE, JSFunction::kSize,
|
| + generator_function_prototype, Builtins::kIllegal,
|
| + false);
|
| +
|
| + // Create maps for generator functions and their prototypes. Store those
|
| + // maps in the native context.
|
| + Handle<Map> function_map(native_context()->function_map());
|
| + Handle<Map> generator_function_map = factory()->CopyMap(function_map);
|
| + generator_function_map->set_prototype(*generator_function_prototype);
|
| + native_context()->set_generator_function_map(*generator_function_map);
|
| +
|
| + Handle<Map> strict_mode_function_map(
|
| + native_context()->strict_mode_function_map());
|
| + Handle<Map> strict_mode_generator_function_map = factory()->CopyMap(
|
| + strict_mode_function_map);
|
| + strict_mode_generator_function_map->set_prototype(
|
| + *generator_function_prototype);
|
| + native_context()->set_strict_mode_generator_function_map(
|
| + *strict_mode_generator_function_map);
|
| +
|
| + Handle<Map> object_map(native_context()->object_function()->initial_map());
|
| + Handle<Map> generator_object_prototype_map = factory()->CopyMap(
|
| + object_map, 0);
|
| + generator_object_prototype_map->set_prototype(
|
| + *generator_object_prototype);
|
| + native_context()->set_generator_object_prototype_map(
|
| + *generator_object_prototype_map);
|
| + }
|
| }
|
|
|
|
|
| @@ -1933,6 +1973,11 @@ bool Genesis::InstallExperimentalNatives() {
|
| "native typedarray.js") == 0) {
|
| if (!CompileExperimentalBuiltin(isolate(), i)) return false;
|
| }
|
| + if (FLAG_harmony_generators &&
|
| + strcmp(ExperimentalNatives::GetScriptName(i).start(),
|
| + "native generator.js") == 0) {
|
| + if (!CompileExperimentalBuiltin(isolate(), i)) return false;
|
| + }
|
| }
|
|
|
| InstallExperimentalNativeFunctions();
|
|
|