| Index: src/codegen.cc
 | 
| ===================================================================
 | 
| --- src/codegen.cc	(revision 3788)
 | 
| +++ src/codegen.cc	(working copy)
 | 
| @@ -126,7 +126,7 @@
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void CodeGenerator::MakeCodePrologue(FunctionLiteral* fun) {
 | 
| +void CodeGenerator::MakeCodePrologue(CompilationInfo* info) {
 | 
|  #ifdef DEBUG
 | 
|    bool print_source = false;
 | 
|    bool print_ast = false;
 | 
| @@ -147,34 +147,35 @@
 | 
|  
 | 
|    if (FLAG_trace_codegen || print_source || print_ast) {
 | 
|      PrintF("*** Generate code for %s function: ", ftype);
 | 
| -    fun->name()->ShortPrint();
 | 
| +    info->function()->name()->ShortPrint();
 | 
|      PrintF(" ***\n");
 | 
|    }
 | 
|  
 | 
|    if (print_source) {
 | 
| -    PrintF("--- Source from AST ---\n%s\n", PrettyPrinter().PrintProgram(fun));
 | 
| +    PrintF("--- Source from AST ---\n%s\n",
 | 
| +           PrettyPrinter().PrintProgram(info->function()));
 | 
|    }
 | 
|  
 | 
|    if (print_ast) {
 | 
| -    PrintF("--- AST ---\n%s\n", AstPrinter().PrintProgram(fun));
 | 
| +    PrintF("--- AST ---\n%s\n",
 | 
| +           AstPrinter().PrintProgram(info->function()));
 | 
|    }
 | 
|  
 | 
|    if (print_json_ast) {
 | 
|      JsonAstBuilder builder;
 | 
| -    PrintF("%s", builder.BuildProgram(fun));
 | 
| +    PrintF("%s", builder.BuildProgram(info->function()));
 | 
|    }
 | 
|  #endif  // DEBUG
 | 
|  }
 | 
|  
 | 
|  
 | 
| -Handle<Code> CodeGenerator::MakeCodeEpilogue(FunctionLiteral* fun,
 | 
| -                                             MacroAssembler* masm,
 | 
| +Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
 | 
|                                               Code::Flags flags,
 | 
| -                                             Handle<Script> script) {
 | 
| +                                             CompilationInfo* info) {
 | 
|    // Allocate and install the code.
 | 
|    CodeDesc desc;
 | 
|    masm->GetCode(&desc);
 | 
| -  ZoneScopeInfo sinfo(fun->scope());
 | 
| +  ZoneScopeInfo sinfo(info->scope());
 | 
|    Handle<Code> code =
 | 
|        Factory::NewCode(desc, &sinfo, flags, masm->CodeObject());
 | 
|  
 | 
| @@ -187,20 +188,23 @@
 | 
|        : FLAG_print_code;
 | 
|    if (print_code) {
 | 
|      // Print the source code if available.
 | 
| +    Handle<Script> script = info->script();
 | 
| +    FunctionLiteral* function = info->function();
 | 
|      if (!script->IsUndefined() && !script->source()->IsUndefined()) {
 | 
|        PrintF("--- Raw source ---\n");
 | 
|        StringInputBuffer stream(String::cast(script->source()));
 | 
| -      stream.Seek(fun->start_position());
 | 
| +      stream.Seek(function->start_position());
 | 
|        // fun->end_position() points to the last character in the stream. We
 | 
|        // need to compensate by adding one to calculate the length.
 | 
| -      int source_len = fun->end_position() - fun->start_position() + 1;
 | 
| +      int source_len =
 | 
| +          function->end_position() - function->start_position() + 1;
 | 
|        for (int i = 0; i < source_len; i++) {
 | 
|          if (stream.has_more()) PrintF("%c", stream.GetNext());
 | 
|        }
 | 
|        PrintF("\n\n");
 | 
|      }
 | 
|      PrintF("--- Code ---\n");
 | 
| -    code->Disassemble(*fun->name()->ToCString());
 | 
| +    code->Disassemble(*function->name()->ToCString());
 | 
|    }
 | 
|  #endif  // ENABLE_DISASSEMBLER
 | 
|  
 | 
| @@ -214,21 +218,19 @@
 | 
|  // Generate the code. Takes a function literal, generates code for it, assemble
 | 
|  // all the pieces into a Code object. This function is only to be called by
 | 
|  // the compiler.cc code.
 | 
| -Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* fun,
 | 
| -                                     Handle<Script> script,
 | 
| -                                     bool is_eval,
 | 
| -                                     CompilationInfo* info) {
 | 
| +Handle<Code> CodeGenerator::MakeCode(CompilationInfo* info) {
 | 
| +  Handle<Script> script = info->script();
 | 
|    if (!script->IsUndefined() && !script->source()->IsUndefined()) {
 | 
|      int len = String::cast(script->source())->length();
 | 
|      Counters::total_old_codegen_source_size.Increment(len);
 | 
|    }
 | 
| -  MakeCodePrologue(fun);
 | 
| +  MakeCodePrologue(info);
 | 
|    // Generate code.
 | 
|    const int kInitialBufferSize = 4 * KB;
 | 
|    MacroAssembler masm(NULL, kInitialBufferSize);
 | 
| -  CodeGenerator cgen(&masm, script, is_eval);
 | 
| +  CodeGenerator cgen(&masm);
 | 
|    CodeGeneratorScope scope(&cgen);
 | 
| -  cgen.Generate(fun, PRIMARY, info);
 | 
| +  cgen.Generate(info, PRIMARY);
 | 
|    if (cgen.HasStackOverflow()) {
 | 
|      ASSERT(!Top::has_pending_exception());
 | 
|      return Handle<Code>::null();
 | 
| @@ -236,7 +238,7 @@
 | 
|  
 | 
|    InLoopFlag in_loop = (cgen.loop_nesting() != 0) ? IN_LOOP : NOT_IN_LOOP;
 | 
|    Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop);
 | 
| -  return MakeCodeEpilogue(fun, cgen.masm(), flags, script);
 | 
| +  return MakeCodeEpilogue(cgen.masm(), flags, info);
 | 
|  }
 | 
|  
 | 
|  
 | 
| 
 |