| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "codegen-inl.h" | 31 #include "codegen-inl.h" |
| 32 #include "compilation-cache.h" | 32 #include "compilation-cache.h" |
| 33 #include "compiler.h" | 33 #include "compiler.h" |
| 34 #include "debug.h" | 34 #include "debug.h" |
| 35 #include "fast-codegen.h" | 35 #include "fast-codegen.h" |
| 36 #include "full-codegen.h" | 36 #include "full-codegen.h" |
| 37 #include "oprofile-agent.h" | 37 #include "oprofile-agent.h" |
| 38 #include "rewriter.h" | 38 #include "rewriter.h" |
| 39 #include "scopes.h" | 39 #include "scopes.h" |
| 40 #include "usage-analyzer.h" | 40 #include "usage-analyzer.h" |
| 41 #include "liveedit.h" |
| 41 | 42 |
| 42 namespace v8 { | 43 namespace v8 { |
| 43 namespace internal { | 44 namespace internal { |
| 44 | 45 |
| 45 | 46 |
| 46 static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) { | 47 static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) { |
| 47 FunctionLiteral* function = info->function(); | 48 FunctionLiteral* function = info->function(); |
| 48 ASSERT(function != NULL); | 49 ASSERT(function != NULL); |
| 49 // Rewrite the AST by introducing .result assignments where needed. | 50 // Rewrite the AST by introducing .result assignments where needed. |
| 50 if (!Rewriter::Process(function) || !AnalyzeVariableUsage(function)) { | 51 if (!Rewriter::Process(function) || !AnalyzeVariableUsage(function)) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // We should not try to compile the same function literal more than | 423 // We should not try to compile the same function literal more than |
| 423 // once. | 424 // once. |
| 424 literal->mark_as_compiled(); | 425 literal->mark_as_compiled(); |
| 425 #endif | 426 #endif |
| 426 | 427 |
| 427 // Determine if the function can be lazily compiled. This is | 428 // Determine if the function can be lazily compiled. This is |
| 428 // necessary to allow some of our builtin JS files to be lazily | 429 // necessary to allow some of our builtin JS files to be lazily |
| 429 // compiled. These builtins cannot be handled lazily by the parser, | 430 // compiled. These builtins cannot be handled lazily by the parser, |
| 430 // since we have to know if a function uses the special natives | 431 // since we have to know if a function uses the special natives |
| 431 // syntax, which is something the parser records. | 432 // syntax, which is something the parser records. |
| 432 bool allow_lazy = literal->AllowsLazyCompilation(); | 433 bool allow_lazy = literal->AllowsLazyCompilation() && |
| 434 !LiveEditFunctionTracker::IsActive(); |
| 433 | 435 |
| 434 // Generate code | 436 // Generate code |
| 435 Handle<Code> code; | 437 Handle<Code> code; |
| 436 if (FLAG_lazy && allow_lazy) { | 438 if (FLAG_lazy && allow_lazy) { |
| 437 code = ComputeLazyCompile(literal->num_parameters()); | 439 code = ComputeLazyCompile(literal->num_parameters()); |
| 438 } else { | 440 } else { |
| 439 // The bodies of function literals have not yet been visited by | 441 // The bodies of function literals have not yet been visited by |
| 440 // the AST optimizer/analyzer. | 442 // the AST optimizer/analyzer. |
| 441 if (!Rewriter::Optimize(literal)) { | 443 if (!Rewriter::Optimize(literal)) { |
| 442 return Handle<JSFunction>::null(); | 444 return Handle<JSFunction>::null(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 LOG(CodeCreateEvent(tag, *code, *func_name)); | 563 LOG(CodeCreateEvent(tag, *code, *func_name)); |
| 562 OProfileAgent::CreateNativeCodeRegion(*func_name, | 564 OProfileAgent::CreateNativeCodeRegion(*func_name, |
| 563 code->instruction_start(), | 565 code->instruction_start(), |
| 564 code->instruction_size()); | 566 code->instruction_size()); |
| 565 } | 567 } |
| 566 } | 568 } |
| 567 } | 569 } |
| 568 #endif | 570 #endif |
| 569 | 571 |
| 570 } } // namespace v8::internal | 572 } } // namespace v8::internal |
| OLD | NEW |