Chromium Code Reviews| Index: src/bootstrapper.cc |
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
| index f57a1f6fd8fb69cbb3ac633382283fa7e6556486..fdae2253e662203c775f0026029b85b7a26493ed 100644 |
| --- a/src/bootstrapper.cc |
| +++ b/src/bootstrapper.cc |
| @@ -1426,6 +1426,14 @@ bool Genesis::CompileScriptCached(Isolate* isolate, |
| } |
| +#define LOOKUP_NATIVE(Type, name, var) \ |
| + Handle<String> var##_name = \ |
| + factory()->NewStringFromOneByte(STATIC_ASCII_VECTOR(name)); \ |
| + Object* var##_obj = \ |
| + native_context()->builtins()->GetPropertyNoExceptionThrown( \ |
| + *var##_name); \ |
| + Handle<Type> var(Type::cast(var##_obj)); |
| + |
| #define INSTALL_NATIVE(Type, name, var) \ |
| Handle<String> var##_name = \ |
| factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ |
| @@ -1467,6 +1475,35 @@ void Genesis::InstallExperimentalNativeFunctions() { |
| INSTALL_NATIVE(JSFunction, "DeliverChangeRecords", |
| observers_deliver_changes); |
| } |
| + if (FLAG_harmony_generators) { |
|
rossberg
2013/04/09 16:44:14
Why do these have to be created in a different man
wingo
2013/04/10 14:28:52
I have taken a look at this and I don't catch your
wingo
2013/04/10 14:44:28
I think I misunderstood and found my error. Pleas
|
| + HandleScope scope(isolate()); |
| + LOOKUP_NATIVE(JSFunction, "GeneratorFunctionPrototype", |
| + generator_function_prototype); |
| + LOOKUP_NATIVE(JSObject, "GeneratorIteratorPrototype", |
| + generator_iterator_prototype); |
| + Handle<Map> function_map(native_context()->function_map()); |
| + Handle<Map> strict_mode_function_map( |
| + native_context()->strict_mode_function_map()); |
| + Handle<Map> object_map(native_context()->object_function()->initial_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_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> generator_iterator_prototype_map = factory()->CopyMap( |
| + object_map, 0); |
| + generator_iterator_prototype_map->set_prototype( |
| + *generator_iterator_prototype); |
| + native_context()->set_generator_iterator_prototype_map( |
| + *generator_iterator_prototype_map); |
| + } |
| } |
| #undef INSTALL_NATIVE |
| @@ -1933,6 +1970,11 @@ bool Genesis::InstallExperimentalNatives() { |
| "native typedarray.js") == 0) { |
| if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
| } |
| + if (FLAG_harmony_generators && |
| + strcmp(ExperimentalNatives::GetScriptName(i).start(), |
| + "native generators.js") == 0) { |
| + if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
| + } |
| } |
| InstallExperimentalNativeFunctions(); |