Commit ca3f314f authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: * src/generator.js: Add methods and intialization for generator meta-objects.

Port r14236 (7d56d7c5)

Original commit message:
* src/generator.js: Add methods and intialization for generator meta-objects.

* src/contexts.h:
* src/bootstrapper.cc (InitializeExperimentalGlobal): Make generator
  meta-objects, and store maps for constructing generator functions
  and their prototypes.

* src/factory.h:
* src/factory.cc (MapForNewFunction): New helper.
  (NewFunctionFromSharedFunctionInfo): Use the new helper.

* src/heap.cc (AllocateFunctionPrototype, AllocateInitialMap): For
   generators, allocate appropriate prototypes and maps.

* src/code-stubs.h:
* src/arm/code-stubs-arm.h:
* src/arm/full-codegen-arm.h:
* src/ia32/code-stubs-ia32.h:
* src/ia32/full-codegen-ia32.h:
* src/x64/code-stubs-x64.h:
* src/x64/full-codegen-x64.h: Allow fast closure creation for generators,
using the appropriate map.

* test/mjsunit/harmony/builtins.js: Add a special case for
  GeneratorFunctionPrototype.prototype.__proto__.

BUG=

Review URL: https://codereview.chromium.org/13988003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14238 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ef7dc61a
......@@ -196,9 +196,7 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ IncrementCounter(counters->fast_new_closure_total(), 1, t2, t3);
int map_index = (language_mode_ == CLASSIC_MODE)
? Context::FUNCTION_MAP_INDEX
: Context::STRICT_MODE_FUNCTION_MAP_INDEX;
int map_index = Context::FunctionMapIndex(language_mode_, is_generator_);
// Compute the function map in the current native context and set that
// as the map of the allocated object.
......
......@@ -1277,7 +1277,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
!pretenure &&
scope()->is_function_scope() &&
info->num_literals() == 0) {
FastNewClosureStub stub(info->language_mode());
FastNewClosureStub stub(info->language_mode(), info->is_generator());
__ li(a0, Operand(info));
__ push(a0);
__ CallStub(&stub);
......
......@@ -5490,7 +5490,8 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
Handle<SharedFunctionInfo> shared_info = instr->shared_info();
bool pretenure = instr->hydrogen()->pretenure();
if (!pretenure && shared_info->num_literals() == 0) {
FastNewClosureStub stub(shared_info->language_mode());
FastNewClosureStub stub(shared_info->language_mode(),
shared_info->is_generator());
__ li(a1, Operand(shared_info));
__ push(a1);
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment